Skip to content
Snippets Groups Projects
Commit 6e2b15a2 authored by Otowa Kotori's avatar Otowa Kotori
Browse files

Bundled update

Integrates commits fixing 120+ bugs in the current version of the translation framework.
parent d530b91d
No related branches found
No related tags found
No related merge requests found
Pipeline #
Showing
with 3735 additions and 1654 deletions
......@@ -26,6 +26,8 @@ newPackage{ id = "basic", name = "Basic", weight = 1,
bignews = {font="/data/font/VeraMono.ttf", normal=30},
resources_normal = {font="/data/font/Vera.ttf", bold=true, normal=12},
resources_small = {font="/data/font/Vera.ttf", bold=true, normal=10},
classic = {font="/data/font/Vera.ttf", normal=12, small=10, big=14},
classic_mono = {font="/data/font/VeraMono.ttf", normal=12, small=10, big=14},
}
newPackage{ id = "web", name = "Web", weight = 10,
......@@ -39,6 +41,8 @@ newPackage{ id = "web", name = "Web", weight = 10,
bignews = {font="/data/font/DroidSansMono.ttf", normal=30},
resources_normal = {font="/data/font/DroidSans.ttf", bold=true, normal=12},
resources_small = {font="/data/font/DroidSans.ttf", bold=true, normal=10},
classic = {font="/data/font/USENET_.ttf", normal=16, small=14, big=18},
classic_mono = {font="/data/font/SVBasicManual.ttf", normal=14, small=10, big=16},
}
newPackage{ id = "fantasy", name = "Fantasy", weight = 100,
......@@ -51,17 +55,21 @@ newPackage{ id = "fantasy", name = "Fantasy", weight = 100,
bignews = {font="/data/font/Salsa-Regular.ttf", normal=30},
resources_normal = {font="/data/font/Salsa-Regular.ttf", normal=14},
resources_small = {font="/data/font/Salsa-Regular.ttf", normal=12},
classic = {font="/data/font/USENET_.ttf", normal=16, small=14, big=18},
classic_mono = {font="/data/font/SVBasicManual.ttf", normal=14, small=10, big=16},
}
newPackage{ id = "chinese", name = "Chinese", weight = 100,
small = {font="/data/font/WenQuanYiMicroHei.ttf", normal=12, small=10, big=14},
default = {font="/data/font/WenQuanYiMicroHei.ttf", normal=16, small=12, big=18},
bold = {font="/data/font/WenQuanYiMicroHei.ttf", bold=true, normal=16, small=12, big=18},
bold = {font="/data/font/WenQuanYiMicroHei.ttf", normal=16, small=12, big=18},
mono = {font="/data/font/WenQuanYiMicroHeiMono.ttf", normal=16, small=12, big=18},
mono_small = {font="/data/font/WenQuanYiMicroHeiMono.ttf", normal=14, small=10, big=16},
flyer = {font="/data/font/WenQuanYiMicroHei.ttf", normal=14, small=12, big=16},
bignews = {font="/data/font/WenQuanYiMicroHei.ttf", normal=30},
resources_normal = {font="/data/font/WenQuanYiMicroHei.ttf", normal=14},
resources_small = {font="/data/font/WenQuanYiMicroHei.ttf", normal=12},
classic = {font="/data/font/WenQuanYiMicroHei.ttf", normal=16, small=14, big=18},
classic_mono = {font="/data/font/WenQuanYiMicroHeiMono.ttf", normal=14, small=10, big=16},
}
This diff is collapsed.
......@@ -611,3 +611,7 @@ function _M:him_her() return string.him_her(self) end
--- he/she/self formatting
-- @return string.his_her_self(self)
function _M:his_her_self() return string.his_her_self(self) end
function _M:getName()
return _t(self.name)
end
\ No newline at end of file
......@@ -19,6 +19,7 @@
require "engine.class"
require "engine.Dialog"
local FontPackage = require "engine.FontPackage"
--- Debug Console
-- @classmod engine.DebugConsole
......@@ -133,7 +134,7 @@ function _M:init()
self.blink_period = 20
self.blink = self.blink_period
local w, h = core.display.size()
engine.Dialog.init(self, _t"Lua Console", w, h, 0, 0, nil, core.display.newFont("/data/font/DroidSansMono.ttf", 12))
engine.Dialog.init(self, _t"Lua Console", w, h, 0, 0, nil, core.display.newFont(FontPackage:getFont("mono"), 12))
game:onTickEnd(function() self.key:unicodeInput(true) end)
self:keyCommands{
_RETURN = function()
......
......@@ -32,6 +32,9 @@ local cur_unlocalized = {}
local flags = {}
_G._t = function(s, debugadd)
if not s then
return nil
end
if config.settings.cheat and not cur_locale[s] then
debugadd = debugadd or 0
local info = {}
......
......@@ -765,7 +765,7 @@ function _M:loadScreen(mod)
local i = core.display.loadImage(l.image)
if i then img = {i:glTexture()} end
end
local text = bfont:draw(l.text, dw - (img and img[6] or 0), 255, 255, 255)
local text = bfont:draw(_t(l.text), dw - (img and img[6] or 0), 255, 255, 255)
local text_h = #text * text[1].h
local Base = require "engine.ui.Base"
......@@ -948,7 +948,7 @@ function _M:instanciate(mod, name, new_game, no_reboot, extra_module_info)
I18N:loadLocale("/data/locales/zh_CN.lua")
I18N:setLocale("zh_CN")
I18N.setFlag("ego_always_prefix", true)
config.settings.tome.fonts = {type="chinese", size="normal"}
config.settings.tome.fonts = {type="chinese", size="big"}
-- Load font packages
FontPackage:loadDefinition("/data/font/packages/default.lua")
......
......@@ -22,7 +22,7 @@ local Shader = require "engine.Shader"
local Dialog = require "engine.ui.Dialog"
local Image = require "engine.ui.Image"
local Textzone = require "engine.ui.Textzone"
local FontPackage = require "engine.FontPackage"
--- A sub dialog for defining an achievement
--
-- See also: @{ShowAchievements}
......@@ -33,7 +33,7 @@ function _M:init(title, a)
local c_frame = Image.new{file="achievement-ui/runes_inner.png", width=154, height=154}
local c_image = Image.new{file=a.image or "trophy_gold.png", width=128, height=128}
local color = a.huge and "#GOLD#" or "#LIGHT_GREEN#"
local c_desc = Textzone.new{width=500, auto_height=true, text=color..a.name.."#LAST#\n"..a.desc, font={"/data/font/DroidSans-Bold.ttf", 26}}
local c_desc = Textzone.new{width=500, auto_height=true, text=color..a.name.."#LAST#\n"..a.desc, font={FontPackage:getFont("bold"), 26}}
c_desc:setTextShadow(1)
c_desc:setShadowShader(Shader.default.textoutline and Shader.default.textoutline.shad, 1.2)
self:setTitleShadowShader(Shader.default.textoutline and Shader.default.textoutline.shad, 1.5)
......
......@@ -32,8 +32,8 @@ function _M:init(chat)
local list = {
{name = _t"Global", kind = "global"},
{name = game.__mod_info.long_name, kind = mod},
{name = game.__mod_info.long_name.._t" [spoilers]", kind = mod.."-spoiler"},
{name = _t(game.__mod_info.long_name), kind = mod},
{name = _t(game.__mod_info.long_name).._t" [spoilers]", kind = mod.."-spoiler"},
}
for i, l in pairs(profile.chat.channels) do
if i ~= "global" and i ~= mod and i ~= mod.."-spoiler" then
......
......@@ -27,7 +27,7 @@ module(..., package.seeall, class.inherit(Dialog))
_M.force_ui_inside = "microtxn"
function _M:init(mode)
self.base_title_text = ("%s #GOLD#Purchasables#LAST#"):tformat(game.__mod_info.long_name)
self.base_title_text = ("%s #GOLD#Purchasables#LAST#"):tformat(_t(game.__mod_info.long_name))
Dialog.init(self, self.base_title_text, 200, game.h * 0.8)
local do_purchase = ButtonImage.new{alpha_unfocus=1, file="microtxn-ui/action_purchase.png", fct=function() game:unregisterDialog(self) game.key:triggerVirtual("MTXN_PURCHASE") end}
......
......@@ -48,7 +48,7 @@ function _M:init(mode)
self.cart = {}
self.base_title_text = game.__mod_info.long_name.." #GOLD#Online Store#LAST#"
self.base_title_text = ("%s #GOLD#Online Store#LAST#"):tformat(_t(game.__mod_info.long_name))
Dialog.init(self, self.base_title_text, game.w * 0.8, game.h * 0.8)
game.tooltip:generate()
......
......@@ -35,7 +35,7 @@ function _M:init(mode)
self.cart = {}
self.base_title_text = ("%s #GOLD#Purchased Options#LAST#"):tformat(game.__mod_info.long_name)
self.base_title_text = ("%s #GOLD#Purchased Options#LAST#"):tformat(_t(game.__mod_info.long_name))
Dialog.init(self, self.base_title_text, 600, game.h * 0.8)
self.categories_icons = {
......
......@@ -127,7 +127,7 @@ end
I18N:loadLocale("/data/locales/zh_CN.lua")
I18N:setLocale("zh_CN")
config.settings.tome.fonts = {type="chinese", size="normal"}
config.settings.tome.fonts = {type="chinese", size="big"}
-- Default resolution as big as possible
......
......@@ -74,7 +74,7 @@ function _M:takeHit(value, src, death_note)
self.changed = true
if self.life <= self.die_at and not self.dead then
if src and src.on_kill and src:on_kill(self) then return false, value end
game.logSeen(self, "#{bold}#%s killed %s!#{normal}#", src and src.name:capitalize() or _t"something", self:getName())
game.logSeen(self, "#{bold}#%s killed %s!#{normal}#", src and src:getName():capitalize() or _t"something", self:getName())
return self:die(src, death_note), value
end
return false, value
......
......@@ -730,12 +730,12 @@ function _M:canLearnTalent(t, offset, ignore_special)
if req.stat then
for s, v in pairs(req.stat) do
v = util.getval(v, tlev)
if self:getStat(s) < v then return nil, "not enough stat: "..s:upper() end
if self:getStat(s) < v then return nil, ("not enough stat: %s"):tformat(s:upper()) end
end
end
if req.level then
if self.level < util.getval(req.level, tlev) then
return nil, "not enough levels"
return nil, _t"not enough levels"
end
end
if req.special and not ignore_special then
......@@ -757,28 +757,28 @@ function _M:canLearnTalent(t, offset, ignore_special)
for _, tid in ipairs(req.talent) do
if type(tid) == "table" then
if type(tid[2]) == "boolean" and tid[2] == false then
if self:knowTalent(tid[1]) then return nil, "missing dependency" end
if self:knowTalent(tid[1]) then return nil, _t"missing dependency" end
else
if self:getTalentLevelRaw(tid[1]) < tid[2] then return nil, "missing dependency" end
if self:getTalentLevelRaw(tid[1]) < tid[2] then return nil, _t"missing dependency" end
end
else
if not self:knowTalent(tid) then return nil, "missing dependency" end
if not self:knowTalent(tid) then return nil, _t"missing dependency" end
end
end
end
if req.birth_descriptors then
for _, d in ipairs(req.birth_descriptors) do
if not self.descriptor or self.descriptor[d[1]] ~= d[2] then return nil, ("is not %s"):format(d[2]) end
if not self.descriptor or self.descriptor[d[1]] ~= d[2] then return nil, ("is not %s"):tformat(d[2]) end
end
end
end
if not self:knowTalentType(t.type[1]) and not t.type_no_req then return nil, "unknown talent type" end
if not self:knowTalentType(t.type[1]) and not t.type_no_req then return nil, _t"unknown talent type" end
-- Check talent type
local known = self:numberKnownTalent(t.type[1], t.id, t.type[2])
if t.type[2] and known < t.type[2] - 1 then
return nil, "not enough talents of this type known"
return nil, _t"not enough talents of this type known"
end
-- Ok!
......
......@@ -34,7 +34,7 @@ end
--- Defines the default IDed status
function _M:resolveIdentify()
if not self.unided_name then
self.unided_name = self.name
self.unided_name = _t(self.name)
end
end
......
......@@ -371,7 +371,7 @@ function _M:runStop(msg)
game:unregisterDialog(self.running.dialog)
if not msg and self.running.explore and self.running.path and self.running.cnt == #self.running.path + 1 then
msg = "at " .. self.running.explore
msg = ("at %s"):tformat(_t(self.running.explore))
end
if msg then
game.log("Ran for %d turns (stop reason: %s).", self.running.cnt, msg)
......
......@@ -174,7 +174,7 @@ end
--- Show an achievement gain dialog
function _M:showAchievement(title, a)
if not config.settings.cheat then
game:registerDialog(Achievement.new("New Achievement", a))
game:registerDialog(Achievement.new(_t"New Achievement", a))
end
end
......
......@@ -368,6 +368,28 @@ function table.ts(t)
return tt
end
function table.lower(t)
local tt = {}
for i, e in ipairs(t) do tt[i] = e:lower() end
return tt
end
function table.capitalize(t)
local tt = {}
for i, e in ipairs(t) do tt[i] = e:capitalize() end
return tt
end
function string.tslash(str)
if str:find("/") then
local pos, _ = str:find("/")
return _t(str:sub(1, pos - 1)) .. "/" .. string.tslash(str:sub(pos + 1))
else
return _t(str)
end
end
function table.values(t)
local tt = {}
for k, e in pairs(t) do tt[#tt+1] = e end
......@@ -813,17 +835,17 @@ end
string.nextUTF = core.display.stringNextUTF
function string.ordinal(number)
local suffix = "th"
local suffix = _t"%dth"
number = tonumber(number)
local base = number % 10
if base == 1 then
suffix = "st"
suffix = _t"%dst"
elseif base == 2 then
suffix = "nd"
suffix = _t"%dnd"
elseif base == 3 then
suffix = "rd"
suffix = _t"%drd"
end
return number..suffix
return (suffix):tformat(number)
end
function string.trim(str)
......
......@@ -75,10 +75,11 @@ function _M:init()
end
self:handleEvents()
local default_font, _ = FontPackage:getFont("default")
if not profile.connected then core.webview, core.webview_inactive = nil, core.webview end
if not core.webview then self.tooltip = Tooltip.new(nil, 14, nil, colors.DARK_GREY, 380) end
if not core.webview then self.tooltip = Tooltip.new(default_font, 14, nil, colors.DARK_GREY, 380) end
self.floating_tooltip = Tooltip.new(nil, 14, nil, colors.DARK_GREY, 467)
self.floating_tooltip = Tooltip.new(default_font, 14, nil, colors.DARK_GREY, 467)
-- self.refuse_threads = true
self.normal_key = self.key
......@@ -108,7 +109,8 @@ function _M:makeWebtooltip()
}
if self.webtooltip.unusable then
self.webtooltip = nil
self.tooltip = Tooltip.new(nil, 14, nil, colors.DARK_GREY, 380)
local default_font, _ = FontPackage:getFont("default")
self.tooltip = Tooltip.new(default_font, 14, nil, colors.DARK_GREY, 380)
end
end
......@@ -304,7 +306,7 @@ function _M:grabAddons()
local co co = coroutine.create(function()
for i, add in ipairs(update_list) do
if core.webview then
local d = Downloader.new{title="Updating addon: #LIGHT_GREEN#"..list[add.name].long_name, co=co, dest=add.file..".tmp", url=add.download_url, allow_downloads={addons=true}}
local d = Downloader.new{title=("Updating addon: #LIGHT_GREEN#%s"):tformat(list[add.name].long_name), co=co, dest=add.file..".tmp", url=add.download_url, allow_downloads={addons=true}}
local ok = d:start()
if ok then
local wdir = fs.getWritePath()
......
......@@ -110,7 +110,7 @@ function _M:onTalentCooledDown(tid)
local t = self:getTalentFromId(tid)
local x, y = game.level.map:getTileToScreen(self.x, self.y, true)
game.flyers:add(x, y, 30, -0.3, -3.5, ("%s available"):format(t.name:capitalize()), {0,255,00})
game.flyers:add(x, y, 30, -0.3, -3.5, ("%s available"):tformat(t.name:capitalize()), {0,255,00})
game.log("#00ff00#Talent %s is ready to use.", t.name)
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment