diff --git a/modules/client/client.lua b/modules/client/client.lua index 6a9ff85b..8bd0f4ee 100644 --- a/modules/client/client.lua +++ b/modules/client/client.lua @@ -3,8 +3,9 @@ Client = {} function Client.reloadScripts() dofile '/otclientrc' reloadModules() - TextMessage.displayEventAdvance('All modules and scripts were reloaded.') - print('All modules and scripts were reloaded.') + local message = tr('All modules and scripts were reloaded.') + TextMessage.displayEventAdvance(message) + print(message) end function Client.init() diff --git a/modules/client_about/about.lua b/modules/client_about/about.lua deleted file mode 100644 index 795da653..00000000 --- a/modules/client_about/about.lua +++ /dev/null @@ -1,34 +0,0 @@ -About = {} - --- private variables -local aboutButton -local aboutWindow - --- public functions -function About.init() - aboutButton = TopMenu.addRightButton('aboutButton', 'About', 'about.png', About.show) - aboutWindow = displayUI('about.otui') - aboutWindow:hide() -end - -function About.terminate() - aboutButton:destroy() - aboutButton = nil - aboutWindow:destroy() - aboutWindow = nil - About = nil -end - -function About.show() - aboutWindow:show() - aboutWindow:raise() - aboutWindow:focus() -end - -function About.hide() - aboutWindow:hide() -end - -function About.openWebpage() - displayErrorBox("Error", "Not implemented yet") -end diff --git a/modules/client_about/about.otmod b/modules/client_about/about.otmod deleted file mode 100644 index 4aa758e2..00000000 --- a/modules/client_about/about.otmod +++ /dev/null @@ -1,15 +0,0 @@ -Module - name: client_about - description: Create the about window - author: OTClient team - website: https://github.com/edubart/otclient - - dependencies: - - client_topmenu - - @onLoad: | - dofile 'about' - About.init() - - @onUnload: | - About.terminate() diff --git a/modules/client_about/about.otui b/modules/client_about/about.otui deleted file mode 100644 index 2dc9f88f..00000000 --- a/modules/client_about/about.otui +++ /dev/null @@ -1,58 +0,0 @@ -MainWindow - id: about - text: Info - size: 244 221 - - @onEnter: About.hide() - @onEscape: About.hide() - - FlatPanel - size: 208 129 - anchors.left: parent.left - anchors.top: parent.top - - Label - text-align: center - text: |- - OTClient - Version 0.4.0 - Created by edubart - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - margin-top: 20 - - HorizontalSeparator - size: 190 2 - anchors.left: parent.left - anchors.top: parent.top - margin-top: 83 - margin-left: 9 - - Label - text: Official Website - anchors.left: parent.left - anchors.bottom: parent.bottom - margin-bottom: 14 - margin-left: 9 - - Button - text: Github Page - size: 88 24 - anchors.right: parent.right - anchors.bottom: parent.bottom - margin-bottom: 9 - margin-right: 9 - @onClick: About.openWebpage() - - HorizontalSeparator - anchors.left: parent.left - anchors.right: parent.right - anchors.top: prev.bottom - margin-top: 12 - - Button - text: Ok - size: 46 24 - anchors.right: parent.right - anchors.bottom: parent.bottom - @onClick: About.hide() diff --git a/modules/client_about/about.png b/modules/client_about/about.png deleted file mode 100644 index 5e30545c..00000000 Binary files a/modules/client_about/about.png and /dev/null differ diff --git a/modules/client_entergame/characterlist.lua b/modules/client_entergame/characterlist.lua index 7bab4180..c0454d30 100644 --- a/modules/client_entergame/characterlist.lua +++ b/modules/client_entergame/characterlist.lua @@ -25,14 +25,14 @@ local function tryLogin(charInfo, tries) if tries > 4 then CharacterList.destroyLoadBox() - displayErrorBox('Error', 'Could not logout.') + displayErrorBox(tr('Error'), tr('Unable to logout.')) return end if g_game.isOnline() then g_game.safeLogout() if tries == 1 then - loadBox = displayCancelBox('Please wait', 'Loggin out...') + loadBox = displayCancelBox(tr('Please wait'), tr('Loggin out...')) end scheduleEvent(function() tryLogin(charInfo, tries+1) end, 250) return @@ -42,7 +42,7 @@ local function tryLogin(charInfo, tries) g_game.loginWorld(EnterGame.account, EnterGame.password, charInfo.worldName, charInfo.worldHost, charInfo.worldPort, charInfo.characterName) - loadBox = displayCancelBox('Please wait', 'Connecting to game server...') + loadBox = displayCancelBox(tr('Please wait'), tr('Connecting to game server...')) connect(loadBox, { onCancel = function() loadBox = nil g_game.cancelLogin() @@ -55,7 +55,7 @@ end function onGameLoginError(message) CharacterList.destroyLoadBox() - errorBox = displayErrorBox("Login Error", "Login error: " .. message) + errorBox = displayErrorBox(tr("Login Error"), message) errorBox.onOk = function() errorBox = nil CharacterList.showAgain() @@ -64,7 +64,7 @@ end function onGameConnectionError(message) CharacterList.destroyLoadBox() - errorBox = displayErrorBox("Login Error", "Connection error: " .. message) + errorBox = displayErrorBox(tr("Login Error"), message) errorBox.onOk = function() errorBox = nil CharacterList.showAgain() @@ -128,7 +128,7 @@ function CharacterList.create(characters, premDays) characterList:focusChild(focusLabel, ActiveFocusReason) if premDays > 0 then - accountStatusLabel:setText("Account Status:\nPremium Account (" .. premDays .. ' days left)') + accountStatusLabel:setText(tr("Account Status:\nPremium Account (%s) days left", premDays)) end end @@ -173,7 +173,7 @@ function CharacterList.doLogin() CharacterList.hide() tryLogin(charInfo) else - displayErrorBox('Error', 'You must select a character to login!') + displayErrorBox(tr('Error'), tr('You must select a character to login!')) end end diff --git a/modules/client_entergame/characterlist.otui b/modules/client_entergame/characterlist.otui index 71009b6d..801e18fc 100644 --- a/modules/client_entergame/characterlist.otui +++ b/modules/client_entergame/characterlist.otui @@ -51,7 +51,7 @@ MainWindow //CheckBox // id: charAutoLoginBox // !text: tr('Auto login') - // tooltip: Auto login selected character on next charlist load + // !tooltip: tr('Auto login selected character on next charlist load') // anchors.left: parent.left // anchors.right: parent.right // anchors.bottom: next.top diff --git a/modules/client_entergame/entergame.lua b/modules/client_entergame/entergame.lua index 09f8c297..67953e3c 100644 --- a/modules/client_entergame/entergame.lua +++ b/modules/client_entergame/entergame.lua @@ -24,7 +24,7 @@ local function onError(protocol, message, connectionError) if not connectionError then clearAccountFields() end - local errorBox = displayErrorBox('Login Error', message) + local errorBox = displayErrorBox(tr('Login Error'), message) connect(errorBox, { onOk = EnterGame.show }) end @@ -51,7 +51,7 @@ local function onCharacterList(protocol, characters, premDays) local lastMotdNumber = Settings.getNumber("motd") if motdNumber and motdNumber ~= lastMotdNumber then Settings.set("motd", motdNumber) - local motdBox = displayInfoBox("Message of the day", motdMessage) + local motdBox = displayInfoBox(tr('Message of the day'), motdMessage) connect(motdBox, { onOk = CharacterList.show }) CharacterList.hide() end @@ -60,8 +60,8 @@ end -- public functions function EnterGame.init() enterGame = displayUI('entergame.otui') - enterGameButton = TopMenu.addLeftButton('enterGameButton', 'Login (Ctrl + G)', 'login.png', EnterGame.openWindow) - motdButton = TopMenu.addLeftButton('motdButton', 'Message of the day', 'motd.png', EnterGame.displayMotd) + enterGameButton = TopMenu.addLeftButton('enterGameButton', tr('Login') .. ' (Ctrl + G)', 'login.png', EnterGame.openWindow) + motdButton = TopMenu.addLeftButton('motdButton', tr('Message of the day'), 'motd.png', EnterGame.displayMotd) motdButton:hide() Keyboard.bindKeyDown('Ctrl+G', EnterGame.openWindow) @@ -133,7 +133,7 @@ function EnterGame.doLogin() protocolLogin.onMotd = onMotd protocolLogin.onCharacterList = onCharacterList - loadBox = displayCancelBox('Please wait', 'Connecting to login server...') + loadBox = displayCancelBox(tr('Please wait'), tr('Connecting to login server...')) connect(loadBox, { onCancel = function(msgbox) loadBox = nil protocolLogin:cancelLogin() @@ -144,5 +144,5 @@ function EnterGame.doLogin() end function EnterGame.displayMotd() - displayInfoBox('Message of the day', motdMessage) + displayInfoBox(tr('Message of the day'), motdMessage) end diff --git a/modules/client_locales/locales.lua b/modules/client_locales/locales.lua index c45cf9e0..23e781a5 100644 --- a/modules/client_locales/locales.lua +++ b/modules/client_locales/locales.lua @@ -12,12 +12,12 @@ function Locales.init() Locales.installLocales('locales') local userLocaleName = Settings.get('locale') - if not userLocaleName or not Locales.setLocale(userLocaleName) then - print('Locale ' .. userLocaleName .. ' is not loaded. Using default. ' .. defaultLocaleName) - if not Locales.setLocale(defaultLocaleName) then - fatal('Default locale could not be loaded. Re-install the program.') - return - end + if userLocaleName then + print('Using configurated locale: ' .. userLocaleName) + Locales.setLocale(userLocaleName) + else + print('Using default locale: ' .. defaultLocaleName) + Locales.setLocale(defaultLocaleName) Settings.set('locale', defaultLocaleName) end @@ -33,14 +33,8 @@ function Locales.terminate() end function Locales.installLocale(locale) - if not locale then - print('Coult not install locale.') - return false - end - - if not locale.name then - printf('Coult not install locale.') - return false + if not locale or not locale.name then + error('Unable to install locale.') end local installedLocale = installedLocales[locale.name] @@ -62,13 +56,10 @@ end function Locales.setLocale(name) local locale = installedLocales[name] - if locale then - currentLocale = locale - return true + if not locale then + error("Locale " .. name .. ' does not exist.') end - - print("Locale " .. name .. ' does not exist.') - return false + currentLocale = locale end function tr(text, ...) @@ -86,12 +77,14 @@ function tr(text, ...) return out:reverse() elseif tostring(text) then local translation = currentLocale.translation[text] - if translation then - return string.format(translation, ...) - elseif currentLocale.name ~= defaultLocaleName then - print('WARNING: \"' .. text .. '\" could not be translated.') + if not translation then + if currentLocale.name ~= defaultLocaleName then + warning('Unable to translate: \"' .. text .. '\"') + end + translation = text end + return string.format(translation, ...) end end return text -end \ No newline at end of file +end diff --git a/modules/client_locales/locales/pt-br.lua b/modules/client_locales/locales/pt-br.lua index 8dc8bfd9..33d8eaf0 100644 --- a/modules/client_locales/locales/pt-br.lua +++ b/modules/client_locales/locales/pt-br.lua @@ -1,26 +1,199 @@ +-- to find all possible translations in the source code use the following command: +-- find \( -name '*.lua' -o -name '*.otui' \) -exec grep -oE "tr\\('(\\\\'|[^'])*'" {} \; -exec grep -oE "tr\\(\"(\\\\\"|[^\"])*\nil {} \; | sort | uniq | sed "s/^tr(.\(.*\).$/[\"\1\"] = nil,/" + locale = { - name = 'pt-br', + name = 'pt-br', - -- As traduções devem vir sempre em ordem alfabética. - translation = { - ['Account name'] = 'Nome da conta', - ['Account Status:\nFree Account'] = 'Estado da Conta:\nGrátis', - ['Auto login'] = 'Entrar automaticamente', - ['Cancel'] = 'Cancelar', - ['Character List'] = 'Lista de Personagens', - ['Enter Game'] = 'Entrar no Jogo', - ['Make sure that your client uses\nthe correct game protocol version'] = 'Tenha certeza de que o cliente usa\na versão correta do protocolo do jogo', - ['Ok'] = 'Ok', - ['Open charlist automatically when starting otclient'] = 'Abrir a lista de personagens automaticamente ao iniciar o otclient', - ['Options'] = 'Opções', - ['Password'] = 'Senha', - ['Port'] = 'Porta', - ['Remember account and password when starts otclient'] = 'Lembrar conta e senha ao iniciar o otclient', - ['Remember password'] = 'Lembrar senha', - ['Server'] = 'Servidor' - } + -- As traduções devem vir sempre em ordem alfabética. + translation = { + ["Account name"] = "Nome da conta", + ["Account Status:\nFree Account"] = "Estado da conta:\nGratís", + ["Account Status:\nPremium Account (%s) days left"] = "Estado da conta:\nConta premium (%s) dias faltando", + ["Add"] = "Adicionar", + ["Add new VIP"] = "Adicionar nova VIP", + ["Addon 1"] = "Addon 1", + ["Addon 2"] = "Addon 2", + ["Addon 3"] = "Addon 3", + ["Add to VIP list"] = "Adicionar a lista VIP", + ["Adjust volume"] = "Ajustar volume", + ["All modules and scripts were reloaded."] = "Todos modules e scripts foram recarregados.", + ["Amount:"] = "Quantidade:", + ["Attack"] = "Atacar", + ["Author"] = "Autor", + ["Autoload"] = "Carregar automaticamente", + ["Autoload priority"] = "Prioridade de carregamento", + ["Auto login"] = "Entrar automaticamente", + ["Auto login selected character on next charlist load"] = "Entrar automaticamente com o personagem quando reabrir a lista de personagens", + ["Axe Fighting"] = "Machado", + ["Battle"] = "Batalha", + ["Button Assign"] = "Selecionar botão", + ["Buy"] = "Comprar", + ["Buy no backpack"] = "Comprar na backpack", + ["Buy with backpack"] = "Comprar com backpack", + ["Cancel"] = "Cancelar", + ["Capacity:"] = "Capacidade:", + ["Capacity"] = "Capacidade", + ["Channels"] = "Canais", + ["Character List"] = "Lista de personagens", + ["Classic control"] = "Controle clássico", + ["Clear object"] = "Limpar objeto", + ["Close"] = "Fechar", + ["Close this channel"] = "Fechar esse canal", + ["Club Fighting"] = "Porrete", + ["Combat Controls"] = nil, + ["Connecting to game server..."] = "Conectando no servidor do jogo...", + ["Connecting to login server..."] = "Conectando no servidor de autenticação...", + ["Consider capacity"] = "Considerar capacidade", + ["Consider equipped"] = "Considerar equipado", + ["Copy Name"] = "Copiar Nome", + ["Current hotkeys:"] = "Atalhos atuais", + ["Current hotkey to add: %s"] = "Atalho atual para adicionar: %s", + ["Default"] = "Default", + ["Description"] = "Descrição", + ["Detail"] = "Detalhe", + ["Disable Shared Experience"] = "Desativar experiência compartilhada", + ["Distance Fighting"] = "Flecha", + ["Edit hotkey text:"] = "Editar texto do atalho", + ["Edit Text"] = "Editar Texto", + ["Enable Shared Experience"] = "Ativar experiência compartilhada", + ["Enable vertical synchronization"] = "Ativar sincronização vertical", + ["Enter Game"] = "Entrar no jogo", + ["Error"] = "Erro", + ["Exclude from private chat"] = "Excluir do canal privado", + ["Experience"] = "Experiência", + ["Fishing"] = "Pesca", + ["Fist Fighting"] = "Porrada", + ["Follow"] = "Seguir", + ["Frame rate limit"] = "Limite de FPS", + ["Fullscreen"] = "Tela cheia", + ["Head"] = "Cabeça", + ["Health Bar"] = "Barra de Vida", + ["Hide monsters"] = "Esconder montros", + ["Hide non-skull players"] = "Esconder jogadores sem caveira", + ["Hide Npcs"] = "Esconder NPCs", + ["Hide party members"] = "Esconder membros do grupo", + ["Hide players"] = "Esconder jogadores", + ["Hit Points"] = "Vida", + ["Hotkeys"] = "Atalhos", + ["Ignore capacity"] = "Ignorar capacidade", + ["Ignore equipped"] = "Ignorar equipado", + ["Inventory"] = "Inventário", + ["Invite to Party"] = "Convidar para o grupo", + ["Invite to private chat"] = "Convidar para canal privado", + ["Join %s\'s Party"] = "Entrar no grupo do %s", + ["Leave Party"] = "Sair do grupo", + ["Level"] = "Nível", + ["Limits FPS to 60"] = "Limita o FPS para 60", + ["List of items that you're able to buy"] = "Listar itens que você não pode comprar", + ["List of items that you're able to sell"] = "Listar itens que você pode comprar", + ["Load"] = "Carregar", + ["Loggin out..."] = "Saindo...", + ["Login"] = "Entrar", + ["Login Error"] = "Erro de Autenticação", + ["Look"] = "Olhar", + ["Magic Level"] = "Nível Mágico", + ["Make sure that your client uses\nthe correct game protocol version"] = "Tenha certeza que o seu cliente use\no mesmo protocolo do server do jogo", + ["Mana"] = "Mana", + ["Manage hotkeys:"] = "Configurar atalhos:", + ["Message of the day"] = "Mensagem do dia", + ["Message to %s"] = "Mandar mensagem para %s", + ["Minimap"] = "Minimapa", + ["Module Manager"] = "Gerenciador de Módulos", + ["Module name"] = "Nomo do módulo", + ["Money:"] = "Dinheiro:", + ["Move Stackable Item"] = "Move item contável", + ["Move up"] = "Mover para cima", + ["Name:"] = "Nome:", + ["NPC Trade"] = "Troca com NPC", + ["Ok"] = "Ok", + ["Open"] = "Abrir", + ["Open a private message channel:"] = "Abrir um canal privado:", + ["Open charlist automatically when starting otclient"] = "Abrir lista de personágens", + ["Open in new window"] = nil, + ["Open new channel"] = nil, + ["Options"] = nil, + ["Outfit Name"] = nil, + ["Pass Leadership to %s"] = nil, + ["Password"] = nil, + ["Please enter a character name:"] = nil, + ["Please, press the key you wish to add onto your hotkeys manager"] = nil, + ["Please wait"] = nil, + ["Port"] = nil, + ["Price:"] = nil, + ["Primary"] = nil, + ["Quantity:"] = nil, + ["Refresh"] = nil, + ["Reload All"] = nil, + ["Remember account and password when starts otclient"] = nil, + ["Remember password"] = nil, + ["Remove"] = nil, + ["Remove %s"] = nil, + ["Revoke %s\'s Invitation"] = nil, + ["Rotate"] = nil, + ["Search:"] = nil, + ["Secondary"] = nil, + ["Select object"] = nil, + ["Select Outfit"] = nil, + ["Sell"] = nil, + ["Send automatically"] = nil, + ["Server"] = nil, + ["Server Log"] = nil, + ["Set Outfit"] = nil, + ["Shielding"] = nil, + ["Show all items"] = nil, + ["Show event messages in console"] = nil, + ["Show frame rate"] = nil, + ["Show info messages in console"] = nil, + ["Show levels in console"] = nil, + ["Show only holding items"] = nil, + ["Show private messages in console"] = nil, + ["Show status messages in console"] = nil, + ["Show timestamps in console"] = nil, + ["Skills"] = nil, + ["Soul Points"] = nil, + ["Stamina"] = nil, + ["Stop Attack"] = nil, + ["Stop Follow"] = nil, + ["%s: (use object)"] = nil, + ["%s: (use object on target)"] = nil, + ["%s: (use object on yourself)"] = nil, + ["%s: (use object with crosshair)"] = nil, + ["Sword Fighting"] = nil, + ["Terminal"] = nil, + ["There is no way."] = nil, + ["Trade with ..."] = nil, + ["Unable to logout."] = nil, + ["Unload"] = nil, + ["Use"] = nil, + ["Use on target"] = nil, + ["Use on yourself"] = nil, + ["Use with ..."] = nil, + ["Version"] = nil, + ["VIP list"] = nil, + ["VIP List"] = nil, + ["Website"] = nil, + ["Weight:"] = nil, + ["With crosshair"] = nil, + ["You are burning"] = nil, + ["You are cursed"] = nil, + ["You are dazzled"] = nil, + ["You are drowing"] = nil, + ["You are electrified"] = nil, + ["You are freezing"] = nil, + ["You are hasted"] = nil, + ["You are paralysed"] = nil, + ["You are poisoned"] = nil, + ["You are protected by a magic shield"] = nil, + ["You are strengthened"] = nil, + ["You are within a protection zone"] = nil, + ["You have %s percent"] = nil, + ["You have %s percent to go"] = nil, + ["You may not logout during a fight"] = nil, + ["You may not logout or enter a protection zone"] = nil, + ["You must select a character to login!"] = nil, + } - -- Adicionar informações de números. 1.000 100,00 1.000,00 etc. + -- Adicionar informações de números. 1.000 100,00 1.000,00 etc. } Locales.installLocale(locale) \ No newline at end of file diff --git a/modules/client_modulemanager/modulemanager.lua b/modules/client_modulemanager/modulemanager.lua index dc372f49..7f41cb4e 100644 --- a/modules/client_modulemanager/modulemanager.lua +++ b/modules/client_modulemanager/modulemanager.lua @@ -16,7 +16,7 @@ function ModuleManager.init() Keyboard.bindKeyPress('Up', function() moduleList:focusPreviousChild(KeyboardFocusReason) end, moduleManagerWindow) Keyboard.bindKeyPress('Down', function() moduleList:focusNextChild(KeyboardFocusReason) end, moduleManagerWindow) - moduleManagerButton = TopMenu.addLeftButton('moduleManagerButton', 'Module manager', 'modulemanager.png', ModuleManager.toggle) + moduleManagerButton = TopMenu.addLeftButton('moduleManagerButton', tr('Module Manager'), 'modulemanager.png', ModuleManager.toggle) -- refresh modules only after all modules are loaded addEvent(ModuleManager.listModules) diff --git a/modules/client_modulemanager/modulemanager.otui b/modules/client_modulemanager/modulemanager.otui index 3cb4b6b5..f40ef722 100644 --- a/modules/client_modulemanager/modulemanager.otui +++ b/modules/client_modulemanager/modulemanager.otui @@ -34,7 +34,7 @@ ModuleValueLabel < UILabel MainWindow id: moduleManagerWindow size: 480 450 - text: Module Manager + !text: tr('Module Manager') @onEscape: ModuleManager.hide() @@ -54,7 +54,7 @@ MainWindow anchors.left: moduleList.left margin-top: 8 width: 80 - text: Refresh + !text: tr('Refresh') @onClick: ModuleManager.refreshModules() Button @@ -63,7 +63,7 @@ MainWindow anchors.right: moduleList.right margin-top: 8 width: 80 - text: Reload All + !text: tr('Reload All') @onClick: ModuleManager.reloadAllModules() Panel @@ -76,40 +76,40 @@ MainWindow height: 265 ModuleInfoLabel - text: Module name + !text: tr('Module name') ModuleValueLabel id: moduleName ModuleInfoLabel - text: Description + !text: tr('Description') ModuleValueLabel id: moduleDescription height: 100 text-wrap: true //ModuleInfoLabel - // text: Autoload + // !text: tr('Autoload') //ModuleValueLabel // id: moduleAutoload //ModuleInfoLabel - // text: Autoload priority + // !text: tr('Autoload priority') //ModuleValueLabel // id: moduleLoadPriority // text: 1000 ModuleInfoLabel - text: Author + !text: tr('Author') ModuleValueLabel id: moduleAuthor ModuleInfoLabel - text: Website + !text: tr('Website') ModuleValueLabel id: moduleWebsite ModuleInfoLabel - text: Version + !text: tr('Version') ModuleValueLabel id: moduleVersion @@ -118,7 +118,7 @@ MainWindow anchors.top: moduleInfo.bottom anchors.left: moduleInfo.left margin-top: 8 - text: Load + !text: tr('Load') enabled: false @onClick: ModuleManager.reloadCurrentModule() @@ -128,7 +128,7 @@ MainWindow anchors.right: moduleInfo.right margin-left: 10 margin-top: 8 - text: Unload + !text: tr('Unload') enabled: false @onClick: ModuleManager.unloadCurrentModule() @@ -136,7 +136,7 @@ MainWindow id: closeButton anchors.bottom: parent.bottom anchors.right: parent.right - text: Close + !text: tr('Close') width: 60 @onClick: ModuleManager.hide() diff --git a/modules/client_options/general.otui b/modules/client_options/general.otui index a492e4af..c0b0c32b 100644 --- a/modules/client_options/general.otui +++ b/modules/client_options/general.otui @@ -1,28 +1,28 @@ Panel OptionCheckBox id: classicControl - text: Classic control + !text: tr('Classic control') OptionCheckBox id: showInfoMessagesInConsole - text: Show info messages in console + !text: tr('Show info messages in console') OptionCheckBox id: showEventMessagesInConsole - text: Show event messages in console + !text: tr('Show event messages in console') OptionCheckBox id: showStatusMessagesInConsole - text: Show status messages in console + !text: tr('Show status messages in console') OptionCheckBox id: showTimestampsInConsole - text: Show timestamps in console + !text: tr('Show timestamps in console') OptionCheckBox id: showLevelsInConsole - text: Show levels in console + !text: tr('Show levels in console') OptionCheckBox id: showPrivateMessagesInConsole - text: Show private messages in console + !text: tr('Show private messages in console') diff --git a/modules/client_options/graphics.otui b/modules/client_options/graphics.otui index 2ca033ec..d2ed442c 100644 --- a/modules/client_options/graphics.otui +++ b/modules/client_options/graphics.otui @@ -1,19 +1,19 @@ Panel OptionCheckBox id: vsync - text: Enable vertical synchronization - tooltip: Limits FPS to 60 + !text: tr('Enable vertical synchronization') + !tooltip: tr('Limits FPS to 60') OptionCheckBox id: showfps - text: Show frame rate + !text: tr('Show frame rate') OptionCheckBox id: fullscreen - text: Fullscreen + !text: tr('Fullscreen') Label - text: Frame rate limit + !text: tr('Frame rate limit') anchors.left: parent.left anchors.right: parent.right anchors.top: prev.bottom diff --git a/modules/client_options/options.lua b/modules/client_options/options.lua index 21da8ae2..1f6c4f6c 100644 --- a/modules/client_options/options.lua +++ b/modules/client_options/options.lua @@ -28,7 +28,7 @@ function Options.init() optionsWindow = displayUI('options.otui') optionsWindow:hide() - optionsButton = TopMenu.addLeftButton('optionsButton', tr('Options') .. ' (Ctrl+O)', 'options.png', Options.toggle) + optionsButton = TopMenu.addLeftButton('optionsButton', tr('Options'), 'options.png', Options.toggle) optionsTabBar = optionsWindow:getChildById('optionsTabBar') optionsTabBar:setContentWidget(optionsWindow:getChildById('optionsTabContent')) optionsTabBar:addTab('General', loadUI('general.otui')) @@ -37,6 +37,7 @@ end function Options.terminate() Keyboard.unbindKeyDown('Ctrl+P') + Keyboard.unbindKeyDown('Ctrl+F') optionsWindow:destroy() optionsWindow = nil optionsButton:destroy() @@ -63,10 +64,6 @@ function Options.hide() optionsWindow:hide() end -function Options.openWebpage() - displayErrorBox("Error", "Not implemented yet") -end - function Options.toggleOption(key) Options.setOption(key, not Options.getOption(key)) end diff --git a/modules/client_options/options.otui b/modules/client_options/options.otui index a25e01a3..bc99ca27 100644 --- a/modules/client_options/options.otui +++ b/modules/client_options/options.otui @@ -16,7 +16,7 @@ OptionCheckBox < CheckBox MainWindow id: optionsWindow - text: Options + !text: tr('Options') size: 286 230 @onEnter: Options.hide() @@ -37,7 +37,7 @@ MainWindow margin-top: 10 Button - text: Ok + !text: tr('Ok') width: 64 anchors.right: parent.right anchors.bottom: parent.bottom diff --git a/modules/client_terminal/terminal.lua b/modules/client_terminal/terminal.lua index da00194e..60339a4c 100644 --- a/modules/client_terminal/terminal.lua +++ b/modules/client_terminal/terminal.lua @@ -127,7 +127,7 @@ function Terminal.init() end end - terminalButton = TopMenu.addLeftButton('terminalButton', 'Terminal (Ctrl + T)', 'terminal.png', Terminal.toggle) + terminalButton = TopMenu.addLeftButton('terminalButton', tr('Terminal') .. ' (Ctrl + T)', 'terminal.png', Terminal.toggle) Keyboard.bindKeyDown('Ctrl+T', Terminal.toggle) commandHistory = Settings.getList('terminal-history') diff --git a/modules/core_lib/util.lua b/modules/core_lib/util.lua index 386f6b6c..2f4707d5 100644 --- a/modules/core_lib/util.lua +++ b/modules/core_lib/util.lua @@ -1,11 +1,15 @@ function print(...) local msg = "" - for i,v in ipairs(arg) do + for i,v in ipairs({...}) do msg = msg .. tostring(v) .. "\t" end g_logger.log(LogInfo, msg) end +function warning(msg) + g_logger.log(LogWarning, msg) +end + function fatal(msg) g_logger.log(LogFatal, msg) end diff --git a/modules/game/gameinterface.lua b/modules/game/gameinterface.lua index b0e761e0..a656a7d7 100644 --- a/modules/game/gameinterface.lua +++ b/modules/game/gameinterface.lua @@ -161,40 +161,40 @@ function GameInterface.createThingMenu(menuPosition, lookThing, useThing, creatu local menu = createWidget('PopupMenu') if lookThing then - menu:addOption('Look', function() g_game.look(lookThing) end) + menu:addOption(tr('Look'), function() g_game.look(lookThing) end) end if useThing then if useThing:isContainer() then if useThing:getParentContainer() then - menu:addOption('Open', function() g_game.open(useThing, useThing:getParentContainer()) end) - menu:addOption('Open in new window', function() g_game.open(useThing, nil) end) + menu:addOption(tr('Open'), function() g_game.open(useThing, useThing:getParentContainer()) end) + menu:addOption(tr('Open in new window'), function() g_game.open(useThing, nil) end) else - menu:addOption('Open', function() g_game.open(useThing, nil) end) + menu:addOption(tr('Open'), function() g_game.open(useThing, nil) end) end else if useThing:isMultiUse() then - menu:addOption('Use with ...', function() GameInterface.startUseWith(useThing) end) + menu:addOption(tr('Use with ...'), function() GameInterface.startUseWith(useThing) end) else - menu:addOption('Use', function() g_game.use(useThing) end) + menu:addOption(tr('Use'), function() g_game.use(useThing) end) end end if useThing:isRotateable() then - menu:addOption('Rotate', function() g_game.rotate(useThing) end) + menu:addOption(tr('Rotate'), function() g_game.rotate(useThing) end) end end if lookThing and not lookThing:asCreature() and not lookThing:isNotMoveable() and lookThing:isPickupable() then menu:addSeparator() - menu:addOption('Trade with ...', function() GameInterface.startTradeWith(lookThing) end) + menu:addOption(tr('Trade with ...'), function() GameInterface.startTradeWith(lookThing) end) end if lookThing then local parentContainer = lookThing:getParentContainer() if parentContainer and parentContainer:hasParent() then - menu:addOption('Move up', function() g_game.moveToParentContainer(lookThing, lookThing:getCount()) end) + menu:addOption(tr('Move up'), function() g_game.moveToParentContainer(lookThing, lookThing:getCount()) end) end end @@ -202,64 +202,64 @@ function GameInterface.createThingMenu(menuPosition, lookThing, useThing, creatu menu:addSeparator() if creatureThing:asLocalPlayer() then - menu:addOption('Set Outfit', function() g_game.requestOutfit() end) + menu:addOption(tr('Set Outfit'), function() g_game.requestOutfit() end) if creatureThing:isPartyMember() --[[and not fighting]] then if creatureThing:isPartyLeader() then if creatureThing:isPartySharedExperienceActive() then - menu:addOption('Disable Shared Experience', function() g_game.partyShareExperience(false) end) + menu:addOption(tr('Disable Shared Experience'), function() g_game.partyShareExperience(false) end) else - menu:addOption('Enable Shared Experience', function() g_game.partyShareExperience(true) end) + menu:addOption(tr('Enable Shared Experience'), function() g_game.partyShareExperience(true) end) end end - menu:addOption('Leave Party', function() g_game.partyLeave() end) + menu:addOption(tr('Leave Party'), function() g_game.partyLeave() end) end else local localPlayer = g_game.getLocalPlayer() if localPlayer then if g_game.getAttackingCreature() ~= creatureThing then - menu:addOption('Attack', function() g_game.attack(creatureThing) end) + menu:addOption(tr('Attack'), function() g_game.attack(creatureThing) end) else - menu:addOption('Stop Attack', function() g_game.cancelAttack() end) + menu:addOption(tr('Stop Attack'), function() g_game.cancelAttack() end) end if g_game.getFollowingCreature() ~= creatureThing then - menu:addOption('Follow', function() g_game.follow(creatureThing) end) + menu:addOption(tr('Follow'), function() g_game.follow(creatureThing) end) else - menu:addOption('Stop Follow', function() g_game.cancelFollow() end) + menu:addOption(tr('Stop Follow'), function() g_game.cancelFollow() end) end if creatureThing:asPlayer() then menu:addSeparator() local creatureName = creatureThing:getName() - menu:addOption('Message to ' .. creatureName, function() g_game.openPrivateChannel(creatureName) end) + menu:addOption(tr('Message to %s', creatureName), function() g_game.openPrivateChannel(creatureName) end) if Console.getOwnPrivateTab() then - menu:addOption('Invite to private chat', function() g_game.inviteToOwnChannel(creatureName) end) - menu:addOption('Exclude from private chat', function() g_game.excludeFromOwnChannel(creatureName) end) -- [TODO] must be removed after message's popup labels been implemented + menu:addOption(tr('Invite to private chat'), function() g_game.inviteToOwnChannel(creatureName) end) + menu:addOption(tr('Exclude from private chat'), function() g_game.excludeFromOwnChannel(creatureName) end) -- [TODO] must be removed after message's popup labels been implemented end - menu:addOption('Add to VIP list', function() g_game.addVip(creatureName) end) + menu:addOption(tr('Add to VIP list'), function() g_game.addVip(creatureName) end) local localPlayerShield = localPlayer:asCreature():getShield() local creatureShield = creatureThing:getShield() if localPlayerShield == ShieldNone or localPlayerShield == ShieldWhiteBlue then if creatureShield == ShieldWhiteYellow then - menu:addOption('Join ' .. creatureThing:getName() .. '\'s Party', function() g_game.partyJoin(creatureThing:getId()) end) + menu:addOption(tr('Join %s\'s Party', creatureThing:getName()), function() g_game.partyJoin(creatureThing:getId()) end) else - menu:addOption('Invite to Party', function() g_game.partyInvite(creatureThing:getId()) end) + menu:addOption(tr('Invite to Party'), function() g_game.partyInvite(creatureThing:getId()) end) end elseif localPlayerShield == ShieldWhiteYellow then if creatureShield == ShieldWhiteBlue then - menu:addOption('Revoke ' .. creatureThing:getName() .. '\'s Invitation', function() g_game.partyRevokeInvitation(creatureThing:getId()) end) + menu:addOption(tr('Revoke %s\'s Invitation', creatureThing:getName()), function() g_game.partyRevokeInvitation(creatureThing:getId()) end) end elseif localPlayerShield == ShieldYellow or localPlayerShield == ShieldYellowSharedExp or localPlayerShield == ShieldYellowNoSharedExpBlink or localPlayerShield == ShieldYellowNoSharedExp then if creatureShield == ShieldWhiteBlue then - menu:addOption('Revoke ' .. creatureThing:getName() .. '\'s Invitation', function() g_game.partyRevokeInvitation(creatureThing:getId()) end) + menu:addOption(tr('Revoke %s\'s Invitation', creatureThing:getName()), function() g_game.partyRevokeInvitation(creatureThing:getId()) end) elseif creatureShield == ShieldBlue or creatureShield == ShieldBlueSharedExp or creatureShield == ShieldBlueNoSharedExpBlink or creatureShield == ShieldBlueNoSharedExp then - menu:addOption('Pass Leadership to ' .. creatureThing:getName(), function() g_game.partyPassLeadership(creatureThing:getId()) end) + menu:addOption(tr('Pass Leadership to %s'), function() g_game.partyPassLeadership(creatureThing:getId()) end) else - menu:addOption('Invite to Party', function() g_game.partyInvite(creatureThing:getId()) end) + menu:addOption(tr('Invite to Party'), function() g_game.partyInvite(creatureThing:getId()) end) end end end @@ -267,7 +267,7 @@ function GameInterface.createThingMenu(menuPosition, lookThing, useThing, creatu end menu:addSeparator() - menu:addOption('Copy Name', function() g_window.setClipboardText(creatureThing:getName()) end) + menu:addOption(tr('Copy Name'), function() g_window.setClipboardText(creatureThing:getName()) end) end diff --git a/modules/game/styles/countwindow.otui b/modules/game/styles/countwindow.otui index 1c8285a6..843e1c6c 100644 --- a/modules/game/styles/countwindow.otui +++ b/modules/game/styles/countwindow.otui @@ -1,11 +1,11 @@ CountWindow < MainWindow id: countWindow - text: Move Stackable Item + !text: tr('Move Stackable Item') size: 196 112 @onEscape: self:destroy() Label - text: Amount: + !text: tr('Amount:') width: 64 anchors.left: parent.left anchors.top: parent.top @@ -26,7 +26,7 @@ CountWindow < MainWindow Button id: buttonOk - text: Ok + !text: tr('Ok') width: 64 anchors.right: next.left anchors.bottom: parent.bottom @@ -34,7 +34,7 @@ CountWindow < MainWindow Button id: buttonCancel - text: Cancel + !text: tr('Cancel') width: 64 anchors.right: parent.right anchors.bottom: parent.bottom diff --git a/modules/game/styles/miniwindow.otui b/modules/game/styles/miniwindow.otui index 5b35a180..12e5e249 100644 --- a/modules/game/styles/miniwindow.otui +++ b/modules/game/styles/miniwindow.otui @@ -6,7 +6,6 @@ MiniWindow < UIMiniWindow text-offset: 24 5 text-align: topLeft margin-bottom: 2 - move-policy: free updated image-source: /game/images/miniwindow.png image-border: 4 image-border-top: 23 diff --git a/modules/game/widgets/uigamemap.lua b/modules/game/widgets/uigamemap.lua index 4a3bbc40..5bf80788 100644 --- a/modules/game/widgets/uigamemap.lua +++ b/modules/game/widgets/uigamemap.lua @@ -68,7 +68,7 @@ function UIGameMap:onMouseRelease(mousePosition, mouseButton) elseif mouseButton == MouseLeftButton and self:isPressed() then local dirs = g_map.findPath(g_game.getLocalPlayer():getPosition(), tile:getPosition(), 255) if #dirs == 0 then - TextMessage.displayStatus('There is no way.') + TextMessage.displayStatus(tr('There is no way.')) return true end g_game.autoWalk(dirs) diff --git a/modules/game_battle/battle.lua b/modules/game_battle/battle.lua index 250f9ad2..2301e369 100644 --- a/modules/game_battle/battle.lua +++ b/modules/game_battle/battle.lua @@ -37,7 +37,7 @@ table.insert(lifeBarColors, {percentAbove = -1, color = '#4F0000' } ) -- public functions function Battle.init() battleWindow = displayUI('battle.otui', GameInterface.getLeftPanel()) - battleButton = TopMenu.addGameToggleButton('battleButton', 'Battle (Ctrl+B)', 'battle.png', Battle.toggle) + battleButton = TopMenu.addGameToggleButton('battleButton', tr('Battle') .. ' (Ctrl+B)', 'battle.png', Battle.toggle) battleButton:setOn(true) Keyboard.bindKeyDown('Ctrl+B', Battle.toggle) diff --git a/modules/game_battle/battle.otui b/modules/game_battle/battle.otui index a559bb13..8039e1dd 100644 --- a/modules/game_battle/battle.otui +++ b/modules/game_battle/battle.otui @@ -38,7 +38,7 @@ BattleParty < BattleIcon MiniWindow id: battleWindow - text: Battle + !text: tr('Battle') height: 166 icon: battle.png @onClose: Battle.toggle() @@ -46,34 +46,34 @@ MiniWindow MiniWindowContents BattlePlayers id: hidePlayers - tooltip: Hide players + !tooltip: tr('Hide players') anchors.top: parent.top anchors.right: next.left margin-right: 5 BattleNPCs id: hideNPCs - tooltip: Hide Npc's + !tooltip: tr('Hide Npcs') anchors.top: parent.top anchors.right: next.left margin-right: 5 BattleMonsters id: hideMonsters - tooltip: Hide monsters + !tooltip: tr('Hide monsters') anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter BattleSkulls id: hideSkulls - tooltip: Hide non-skull players + !tooltip: tr('Hide non-skull players') anchors.top: prev.top anchors.left: prev.right margin-left: 5 BattleParty id: hideParty - tooltip: Hide party members + !tooltip: tr('Hide party members') anchors.top: prev.top anchors.left: prev.right margin-left: 5 diff --git a/modules/game_combatcontrols/combatcontrols.lua b/modules/game_combatcontrols/combatcontrols.lua index 9048f75e..348ae296 100644 --- a/modules/game_combatcontrols/combatcontrols.lua +++ b/modules/game_combatcontrols/combatcontrols.lua @@ -48,7 +48,7 @@ end -- public functions function CombatControls.init() - combatControlsButton = TopMenu.addGameToggleButton('combatControlsButton', 'Combat Controls', 'combatcontrols.png', CombatControls.toggle) + combatControlsButton = TopMenu.addGameToggleButton('combatControlsButton', tr('Combat Controls'), 'combatcontrols.png', CombatControls.toggle) combatControlsButton:setOn(true) combatControlsWindow = loadUI('combatcontrols.otui', GameInterface.getRightPanel()) diff --git a/modules/game_combatcontrols/combatcontrols.otui b/modules/game_combatcontrols/combatcontrols.otui index 366ad8db..4179754f 100644 --- a/modules/game_combatcontrols/combatcontrols.otui +++ b/modules/game_combatcontrols/combatcontrols.otui @@ -20,7 +20,7 @@ SafeFightBox < CombatBox image-source: /game_combatcontrols/icons/safefight.png MiniWindow - text: Combat Controls + !text: tr('Combat Controls') icon: combatcontrols.png height: 64 @onClose: CombatControls.toggle() diff --git a/modules/game_console/channelswindow.otui b/modules/game_console/channelswindow.otui index 4e3b2c10..94e4d402 100644 --- a/modules/game_console/channelswindow.otui +++ b/modules/game_console/channelswindow.otui @@ -10,7 +10,7 @@ ChannelListLabel < Label MainWindow id: channelsWindow - text: Channels + !text: tr('Channels') size: 250 238 @onEscape: self:destroy() @@ -25,7 +25,7 @@ MainWindow Label id: openPrivateChannelWithLabel - text: Open a private message channel: + !text: tr('Open a private message channel:') anchors.left: parent.left anchors.right: parent.right anchors.bottom: next.top @@ -41,7 +41,7 @@ MainWindow Button id: buttonOpen - text: Open + !text: tr('Open') width: 64 anchors.right: next.left anchors.bottom: parent.bottom @@ -50,7 +50,7 @@ MainWindow Button id: buttonCancel - text: Cancel + !text: tr('Cancel') width: 64 anchors.right: parent.right anchors.bottom: parent.bottom diff --git a/modules/game_console/console.lua b/modules/game_console/console.lua index e0376fcf..cea76dc1 100644 --- a/modules/game_console/console.lua +++ b/modules/game_console/console.lua @@ -91,7 +91,7 @@ local function onCreatureSpeak(name, level, speaktype, message, channelId, creat if speaktype.private then Console.addPrivateText(message, speaktype, name, false) else - local channel = 'Default' + local channel = tr('Default') if not defaultMessage then channel = channels[channelId] end @@ -177,7 +177,7 @@ local function onChannelList(channelList) end local function onGameStart() - local tab = Console.getTab('Default') + local tab = Console.getTab(tr('Default')) if tab then addEvent(function() consoleTabBar:selectTab(tab) end, false) end @@ -201,8 +201,8 @@ function Console.init() consoleTabBar:setContentWidget(consoleContentPanel) channels = {} - Console.addTab('Default', true) - Console.addTab('Server Log', false) + Console.addTab(tr('Default'), true) + Console.addTab(tr('Server Log'), false) Keyboard.bindKeyPress('Shift+Up', function() navigateMessageHistory(1) end, consolePanel) Keyboard.bindKeyPress('Shift+Down', function() navigateMessageHistory(-1) end, consolePanel) @@ -265,8 +265,8 @@ function Console.clear() channels = {} - consoleTabBar:getTab('Default').tabPanel:getChildById('consoleBuffer'):destroyChildren() - consoleTabBar:getTab('Server Log').tabPanel:getChildById('consoleBuffer'):destroyChildren() + consoleTabBar:getTab(tr('Default')).tabPanel:getChildById('consoleBuffer'):destroyChildren() + consoleTabBar:getTab(tr('Server Log')).tabPanel:getChildById('consoleBuffer'):destroyChildren() local npcTab = consoleTabBar:getTab('NPCs') if npcTab then @@ -289,14 +289,14 @@ function Console.addTab(name, focus) local tab = consoleTabBar:addTab(name) if focus then consoleTabBar:selectTab(tab) - elseif name ~= 'Server Log' then + elseif name ~= tr('Server Log') then consoleTabBar:blinkTab(tab) end return tab end function Console.onTabChange(tabBar, tab) - if tab:getText() == "Default" or tab:getText() == "Server Log" then + if tab:getText() == tr('Default') or tab:getText() == tr('Server Log') then consolePanel:getChildById('closeChannelButton'):disable() else consolePanel:getChildById('closeChannelButton'):enable() @@ -305,7 +305,7 @@ end function Console.removeCurrentTab() local tab = consoleTabBar:getCurrentTab() - if tab:getText() == "Default" or tab:getText() == "Server Log" then return end + if tab:getText() == tr('Default') or tab:getText() == tr('Server Log') then return end -- notificate the server that we are leaving the channel if tab.channelId then @@ -342,7 +342,7 @@ function Console.addPrivateText(text, speaktype, name, isPrivateCommand) local privateTab = Console.getTab(name) if privateTab == nil then if Options['showPrivateMessagesInConsole'] or (isPrivateCommand and not privateTab) then - privateTab = Console.getTab('Default') + privateTab = Console.getTab(tr('Default')) else privateTab = Console.addTab(name, focus) end @@ -424,14 +424,14 @@ function Console.sendCurrentMessage() -- when talking on server log, the message goes to default channel local name = tab:getText() - if name == 'Server Log' then - tab = Console.getTab('Default') - name = 'Default' + if name == tr('Server Log') then + tab = Console.getTab(tr('Default')) + name = tr('Default') end local speaktypedesc - if (tab.channelId or name == 'Default') and not chatCommandPrivateReady then - if name == 'Default' then + if (tab.channelId or name == tr('Default')) and not chatCommandPrivateReady then + if name == tr('Default') then speaktypedesc = chatCommandSayMode or SayModes[consolePanel:getChildById('sayModeButton').sayMode].speakTypeDesc if speaktypedesc ~= 'say' then Console.sayModeChange(2) end -- head back to say mode else diff --git a/modules/game_console/console.otui b/modules/game_console/console.otui index aa41aa48..ac84208f 100644 --- a/modules/game_console/console.otui +++ b/modules/game_console/console.otui @@ -64,7 +64,7 @@ Panel TabButton id: closeChannelButton - tooltip: Close this channel (Ctrl+E) + !tooltip: tr('Close this channel') .. ' (Ctrl+E)' icon: /core_styles/icons/closechannel.png anchors.right: next.left anchors.top: parent.top @@ -75,7 +75,7 @@ Panel TabButton id: channelsButton - tooltip: Open new channel (Ctrl+O) + !tooltip: tr('Open new channel') .. ' (Ctrl+O)' icon: /core_styles/icons/channels.png anchors.right: parent.right anchors.top: parent.top @@ -99,7 +99,7 @@ Panel TabButton id: sayModeButton icon: /core_styles/icons/say.png - tooltip: Adjust volume + !tooltip: tr('Adjust volume') &sayMode: 2 size: 20 20 anchors.left: parent.left diff --git a/modules/game_healthbar/healthbar.lua b/modules/game_healthbar/healthbar.lua index c4da7dee..08ff8ff4 100644 --- a/modules/game_healthbar/healthbar.lua +++ b/modules/game_healthbar/healthbar.lua @@ -2,21 +2,21 @@ HealthBar = {} -- constants local Icons = {} -Icons[1] = { tooltip = 'You are poisoned', path = '/game_healthbar/icons/poisoned.png', id = 'condition_poisoned' } -Icons[2] = { tooltip = 'You are burning', path = '/game_healthbar/icons/burning.png', id = 'condition_burning' } -Icons[4] = { tooltip = 'You are electrified', path = '/game_healthbar/icons/electrified.png', id = 'condition_electrified' } -Icons[8] = { tooltip = 'You are freezing', path = '/game_healthbar/icons/drunk.png', id = 'condition_drunk' } -Icons[16] = { tooltip = 'You are protected by a magic shield', path = '/game_healthbar/icons/magic_shield.png', id = 'condition_magic_shield' } -Icons[32] = { tooltip = 'You are paralysed', path = '/game_healthbar/icons/slowed.png', id = 'condition_slowed' } -Icons[64] = { tooltip = 'You are hasted', path = '/game_healthbar/icons/haste.png', id = 'condition_haste' } -Icons[128] = { tooltip = 'You may not logout during a fight', path = '/game_healthbar/icons/logout_block.png', id = 'condition_logout_block' } -Icons[256] = { tooltip = 'You are drowing', path = '/game_healthbar/icons/drowning.png', id = 'condition_drowning' } -Icons[512] = { tooltip = 'You are freezing', path = '/game_healthbar/icons/freezing.png', id = 'condition_freezing' } -Icons[1024] = { tooltip = 'You are dazzled', path = '/game_healthbar/icons/dazzled.png', id = 'condition_dazzled' } -Icons[2048] = { tooltip = 'You are cursed', path = '/game_healthbar/icons/cursed.png', id = 'condition_cursed' } -Icons[4096] = { tooltip = 'You are strengthened', path = '/game_healthbar/icons/strengthened.png', id = 'condition_strengthened' } -Icons[8192] = { tooltip = 'You may not logout or enter a protection zone', path = '/game_healthbar/icons/protection_zone_block.png', id = 'condition_protection_zone_block' } -Icons[16384] = { tooltip = 'You are within a protection zone', path = '/game_healthbar/icons/protection_zone.png', id = 'condition_protection_zone' } +Icons[1] = { tooltip = tr('You are poisoned'), path = '/game_healthbar/icons/poisoned.png', id = 'condition_poisoned' } +Icons[2] = { tooltip = tr('You are burning'), path = '/game_healthbar/icons/burning.png', id = 'condition_burning' } +Icons[4] = { tooltip = tr('You are electrified'), path = '/game_healthbar/icons/electrified.png', id = 'condition_electrified' } +Icons[8] = { tooltip = tr('You are freezing'), path = '/game_healthbar/icons/drunk.png', id = 'condition_drunk' } +Icons[16] = { tooltip = tr('You are protected by a magic shield'), path = '/game_healthbar/icons/magic_shield.png', id = 'condition_magic_shield' } +Icons[32] = { tooltip = tr('You are paralysed'), path = '/game_healthbar/icons/slowed.png', id = 'condition_slowed' } +Icons[64] = { tooltip = tr('You are hasted'), path = '/game_healthbar/icons/haste.png', id = 'condition_haste' } +Icons[128] = { tooltip = tr('You may not logout during a fight'), path = '/game_healthbar/icons/logout_block.png', id = 'condition_logout_block' } +Icons[256] = { tooltip = tr('You are drowing'), path = '/game_healthbar/icons/drowning.png', id = 'condition_drowning' } +Icons[512] = { tooltip = tr('You are freezing'), path = '/game_healthbar/icons/freezing.png', id = 'condition_freezing' } +Icons[1024] = { tooltip = tr('You are dazzled'), path = '/game_healthbar/icons/dazzled.png', id = 'condition_dazzled' } +Icons[2048] = { tooltip = tr('You are cursed'), path = '/game_healthbar/icons/cursed.png', id = 'condition_cursed' } +Icons[4096] = { tooltip = tr('You are strengthened'), path = '/game_healthbar/icons/strengthened.png', id = 'condition_strengthened' } +Icons[8192] = { tooltip = tr('You may not logout or enter a protection zone'), path = '/game_healthbar/icons/protection_zone_block.png', id = 'condition_protection_zone_block' } +Icons[16384] = { tooltip = tr('You are within a protection zone'), path = '/game_healthbar/icons/protection_zone.png', id = 'condition_protection_zone' } -- private variables local healthBarWindow @@ -34,7 +34,7 @@ function HealthBar.init() connect(g_game, { onGameEnd = HealthBar.offline }) healthBarWindow = displayUI('healthbar.otui', GameInterface.getLeftPanel()) - healthBarButton = TopMenu.addGameToggleButton('healthBarButton', 'Healh Bar', 'healthbar.png', HealthBar.toggle) + healthBarButton = TopMenu.addGameToggleButton('healthBarButton', tr('Health Bar'), 'healthbar.png', HealthBar.toggle) healthBarButton:setOn(true) healthBar = healthBarWindow:recursiveGetChildById('healthBar') manaBar = healthBarWindow:recursiveGetChildById('manaBar') diff --git a/modules/game_healthbar/healthbar.otui b/modules/game_healthbar/healthbar.otui index bdeb2d37..fa1de388 100644 --- a/modules/game_healthbar/healthbar.otui +++ b/modules/game_healthbar/healthbar.otui @@ -42,7 +42,7 @@ ConditionWidget < UIWidget MiniWindow icon: healthbar.png id: healthBarWindow - text: Health Bar + !text: tr('Health Bar') height: 86 @onClose: HealthBar.toggle() diff --git a/modules/game_hotkeys/hotkeys_manager.lua b/modules/game_hotkeys/hotkeys_manager.lua index 8d9e1f77..d2423b5f 100644 --- a/modules/game_hotkeys/hotkeys_manager.lua +++ b/modules/game_hotkeys/hotkeys_manager.lua @@ -37,7 +37,7 @@ function HotkeysManager.init() hotkeysWindow = displayUI('hotkeys_manager.otui') hotkeysWindow:setVisible(false) - hotkeysButton = TopMenu.addGameButton('hotkeysButton', 'Hotkeys (Ctrl+K)', '/game_hotkeys/icon.png', HotkeysManager.toggle) + hotkeysButton = TopMenu.addGameButton('hotkeysButton', tr('Hotkeys') .. ' (Ctrl+K)', '/game_hotkeys/icon.png', HotkeysManager.toggle) Keyboard.bindKeyDown('Ctrl+K', HotkeysManager.toggle) currentHotkeysList = hotkeysWindow:getChildById('currentHotkeys') @@ -201,20 +201,20 @@ function HotkeysManager.addHotkey() messageBox = createWidget('MainWindow', rootWidget) messageBox:grabKeyboard() messageBox:setId('assignWindow') - messageBox:setText('Button Assign') + messageBox:setText(tr('Button Assign')) messageBox:setWidth(420) messageBox:setHeight(140) messageBox:setDragable(false) widget = createWidget('Label', messageBox) - widget:setText('Please, press the key you wish to add onto your hotkeys manager') + widget:setText(tr('Please, press the key you wish to add onto your hotkeys manager')) widget:resizeToText() widget:addAnchor(AnchorHorizontalCenter, 'parent', AnchorHorizontalCenter) widget:addAnchor(AnchorTop, 'parent', AnchorTop) widget = createWidget('Label', messageBox) widget:setId('comboPreview') - widget:setText('Current hotkey to add: None') + widget:setText(tr('Current hotkey to add: %s', 'none')) widget.keyCombo = '' widget:resizeToText() widget:addAnchor(AnchorHorizontalCenter, 'parent', AnchorHorizontalCenter) @@ -223,7 +223,7 @@ function HotkeysManager.addHotkey() widget = createWidget('Button', messageBox) widget:setId('cancelButton') - widget:setText('Cancel') + widget:setText(tr('Cancel')) widget:setWidth(64) widget:addAnchor(AnchorBottom, 'parent', AnchorBottom) widget:addAnchor(AnchorRight, 'parent', AnchorRight) @@ -234,7 +234,7 @@ function HotkeysManager.addHotkey() widget = createWidget('Button', messageBox) widget:setId('addButton') - widget:setText('Add') + widget:setText(tr('Add')) widget:setWidth(64) widget:disable() widget:addAnchor(AnchorBottom, 'cancelButton', AnchorBottom) @@ -372,19 +372,19 @@ function HotkeysManager.changeUseType(useType, checked) useWith:enable() if useType == HOTKEY_MANAGER_USEONSELF then - hotkeyLabelSelectedOnList:setText(hotkeyLabelSelectedOnList.keyCombo .. ': (use object on yourself)') + hotkeyLabelSelectedOnList:setText(tr('%s: (use object on yourself)', hotkeyLabelSelectedOnList.keyCombo)) hotkeyLabelSelectedOnList:setColor(hotkeyColors.itemUseSelf) useOnSelf:setChecked(true) useOnTarget:setChecked(false) useWith:setChecked(false) elseif useType == HOTKEY_MANAGER_USEONTARGET then - hotkeyLabelSelectedOnList:setText(hotkeyLabelSelectedOnList.keyCombo .. ': (use object on target)') + hotkeyLabelSelectedOnList:setText(tr('%s: (use object on target)', hotkeyLabelSelectedOnList.keyCombo)) hotkeyLabelSelectedOnList:setColor(hotkeyColors.itemUseTarget) useOnSelf:setChecked(false) useOnTarget:setChecked(true) useWith:setChecked(false) elseif useType == HOTKEY_MANAGER_USEWITH then - hotkeyLabelSelectedOnList:setText(hotkeyLabelSelectedOnList.keyCombo .. ': (use object with crosshair)') + hotkeyLabelSelectedOnList:setText(tr('%s: (use object with crosshair)', hotkeyLabelSelectedOnList.keyCombo)) hotkeyLabelSelectedOnList:setColor(hotkeyColors.itemUseWith) useOnSelf:setChecked(false) @@ -396,7 +396,7 @@ function HotkeysManager.changeUseType(useType, checked) useOnTarget:disable() useWith:disable() - hotkeyLabelSelectedOnList:setText(hotkeyLabelSelectedOnList.keyCombo .. ': (use object)') + hotkeyLabelSelectedOnList:setText(tr('%s: (use object)', hotkeyLabelSelectedOnList.keyCombo)) hotkeyLabelSelectedOnList:setColor(hotkeyColors.itemUse) useOnSelf:setChecked(false) @@ -448,7 +448,7 @@ end function HotkeysManager.hotkeyCapture(widget, keyCode, keyboardModifiers) local keyCombo = determineKeyComboDesc(keyCode, keyboardModifiers) local comboPreview = rootWidget:getChildById('assignWindow'):getChildById('comboPreview') - comboPreview:setText('Current hotkey to add: '.. keyCombo) + comboPreview:setText(tr('Current hotkey to add: %s', keyCombo)) comboPreview.keyCombo = keyCombo comboPreview:resizeToText() rootWidget:getChildById('assignWindow'):getChildById('addButton'):enable() diff --git a/modules/game_hotkeys/hotkeys_manager.otui b/modules/game_hotkeys/hotkeys_manager.otui index 28f94684..599bb21b 100644 --- a/modules/game_hotkeys/hotkeys_manager.otui +++ b/modules/game_hotkeys/hotkeys_manager.otui @@ -10,7 +10,7 @@ HotkeyListLabel < UILabel MainWindow id: hotkeysWindow - text: Hotkeys + !text: tr('Hotkeys') size: 340 460 @onEnter: HotkeysManager.hide() @@ -18,11 +18,11 @@ MainWindow Label id: currentHotkeysLabel - text: Current hotkeys: + !text: tr('Current hotkeys:') anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top - + VerticalScrollBar id: currentHotkeysScrollBar height: 150 @@ -30,7 +30,7 @@ MainWindow anchors.right: parent.right step: 14 pixels-scroll: true - + TextList id: currentHotkeys vertical-scrollbar: currentHotkeysScrollBar @@ -43,7 +43,7 @@ MainWindow focusable: false Label - text: Manage hotkeys: + !text: tr('Manage hotkeys:') anchors.left: parent.left anchors.right: parent.right anchors.top: prev.bottom @@ -51,7 +51,7 @@ MainWindow Button id: addHotkey - text: Add + !text: tr('Add') width: 64 anchors.left: parent.left anchors.top: prev.bottom @@ -60,7 +60,7 @@ MainWindow Button id: removeHotkey - text: Remove + !text: tr('Remove') width: 64 enabled: false anchors.left: prev.right @@ -70,7 +70,7 @@ MainWindow Label id: hotKeyTextLabel - text: Edit hotkey text: + !text: tr('Edit hotkey text:') enable: false anchors.left: parent.left anchors.right: parent.right @@ -88,7 +88,7 @@ MainWindow CheckBox id: sendAutomatically - text: Send automatically + !text: tr('Send automatically') anchors.left: parent.left anchors.right: parent.right anchors.top: prev.bottom @@ -105,7 +105,7 @@ MainWindow Button id: selectObjectButton - text: Select object + !text: tr('Select object') width: 128 enabled: false anchors.left: prev.right @@ -115,7 +115,7 @@ MainWindow Button id: clearObjectButton - text: Clear object + !text: tr('Clear object') width: 128 enabled: false anchors.left: prev.left @@ -126,7 +126,7 @@ MainWindow ButtonBox id: useOnSelf - text: Use on yourself + !text: tr('Use on yourself') width: 128 enabled: false anchors.left: selectObjectButton.right @@ -138,7 +138,7 @@ MainWindow ButtonBox id: useOnTarget - text: Use on target + !text: tr('Use on target') width: 128 enabled: false anchors.left: prev.left @@ -150,7 +150,7 @@ MainWindow ButtonBox id: useWith - text: With crosshair + !text: tr('With crosshair') width: 128 enabled: false anchors.left: prev.left @@ -161,7 +161,7 @@ MainWindow @onCheckChange: HotkeysManager.changeUseType(HOTKEY_MANAGER_USEWITH, self:isChecked()) Button - text: Close + !text: tr('Close') width: 64 anchors.right: parent.right anchors.bottom: parent.bottom diff --git a/modules/game_inventory/inventory.lua b/modules/game_inventory/inventory.lua index c14d8e8a..91d444b1 100644 --- a/modules/game_inventory/inventory.lua +++ b/modules/game_inventory/inventory.lua @@ -17,7 +17,7 @@ function Inventory.init() inventoryWindow = displayUI('inventory.otui', GameInterface.getRightPanel()) inventoryWindow.onClose = Inventory.toggle inventoryPanel = inventoryWindow:getChildById('contentsPanel') - inventoryButton = TopMenu.addGameToggleButton('inventoryButton', 'Inventory (Ctrl+I)', 'inventory.png', Inventory.toggle) + inventoryButton = TopMenu.addGameToggleButton('inventoryButton', tr('Inventory') .. ' (Ctrl+I)', 'inventory.png', Inventory.toggle) inventoryButton:setOn(true) if g_game.isOnline() then diff --git a/modules/game_inventory/inventory.otui b/modules/game_inventory/inventory.otui index f787ed48..2a35fc37 100644 --- a/modules/game_inventory/inventory.otui +++ b/modules/game_inventory/inventory.otui @@ -1,6 +1,6 @@ MiniWindow id: inventoryMiniWindow - text: Inventory + !text: tr('Inventory') icon: inventory.png height: 180 @onClose: Inventory.toggle() diff --git a/modules/game_minimap/minimap.lua b/modules/game_minimap/minimap.lua index 320fffa5..fa7c4bdc 100644 --- a/modules/game_minimap/minimap.lua +++ b/modules/game_minimap/minimap.lua @@ -10,7 +10,7 @@ function onMinimapMouseRelease(self, mousePosition, mouseButton) if tile and mouseButton == MouseLeftButton and self:isPressed() then local dirs = g_map.findPath(g_game.getLocalPlayer():getPosition(), tile:getPosition(), 255) if #dirs == 0 then - TextMessage.displayStatus('There is no way.') + TextMessage.displayStatus(tr('There is no way.')) return true end g_game.autoWalk(dirs) @@ -33,7 +33,7 @@ function Minimap.init() connect(g_game, { onLogin = Minimap.reset }) Keyboard.bindKeyDown('Ctrl+M', Minimap.toggle) - minimapButton = TopMenu.addGameToggleButton('minimapButton', 'Minimap (Ctrl+M)', 'minimap.png', Minimap.toggle) + minimapButton = TopMenu.addGameToggleButton('minimapButton', tr('Minimap') .. ' (Ctrl+M)', 'minimap.png', Minimap.toggle) minimapButton:setOn(false) minimapWidget = loadUI('minimap.otui', GameInterface.getMapPanel()) diff --git a/modules/game_npctrade/npctrade.lua b/modules/game_npctrade/npctrade.lua index d27fc4d7..fc3da376 100644 --- a/modules/game_npctrade/npctrade.lua +++ b/modules/game_npctrade/npctrade.lua @@ -132,7 +132,7 @@ end function NPCTrade.updateSetup() if offerSelected then if radioItems.selectedWidget:isEnabled() then - if setupButton:getText() == 'Buy' then + if setupButton:getText() == tr('Buy') then local capacityMaxCount = math.floor(100*g_game.getLocalPlayer():getFreeCapacity()/offerSelected[3]) local priceMaxCount = math.floor(moneyGoods/NPCTrade.getOfferPrice(offerSelected)) quantityScroll:setMaximum(math.max(0, math.min(100, math.min(priceMaxCount, capacityMaxCount)))) @@ -148,7 +148,7 @@ function NPCTrade.updateSetup() end function NPCTrade.getOfferPrice(offer) - if setupButton:getText() == 'Buy' then + if setupButton:getText() == tr('Buy') then local price = offer[4] if buyWithBackpack then if offer[1]:isStackable() then @@ -225,14 +225,14 @@ end function NPCTrade.itemPopup(self, mousePosition, mouseButton) if mouseButton == MouseRightButton then local menu = createWidget('PopupMenu') - menu:addOption('Look', function() return g_game.inspectNpcTrade(self.offer[1]) end) + menu:addOption(tr('Look'), function() return g_game.inspectNpcTrade(self.offer[1]) end) menu:addSeparator() - if setupButton:getText() == 'Buy' then - menu:addOption((buyWithBackpack and 'Buy no backpack' or 'Buy with backpack'), NPCTrade.switchBuyWithBackpack) - menu:addOption((ignoreCapacity and 'Consider capacity' or 'Ignore capacity'), function() ignoreCapacity = not ignoreCapacity return true end) + if setupButton:getText() == tr('Buy') then + menu:addOption((buyWithBackpack and tr('Buy no backpack') or tr('Buy with backpack')), NPCTrade.switchBuyWithBackpack) + menu:addOption((ignoreCapacity and tr('Consider capacity') or tr('Ignore capacity')), function() ignoreCapacity = not ignoreCapacity return true end) else - menu:addOption((ignoreEquipped and 'Consider equipped' or 'Ignore equipped'), function() ignoreEquipped = not ignoreEquipped return true end) - menu:addOption((showOnlyHolding and 'Show all items' or 'Show only holding items'), function() showOnlyHolding = not showOnlyHolding NPCTrade.refreshFilters() return true end) + menu:addOption((ignoreEquipped and tr('Consider equipped') or tr('Ignore equipped')), function() ignoreEquipped = not ignoreEquipped return true end) + menu:addOption((showOnlyHolding and tr('Show all items') or tr('Show only holding items')), function() showOnlyHolding = not showOnlyHolding NPCTrade.refreshFilters() return true end) end menu:display(mousePosition) end @@ -274,7 +274,7 @@ function NPCTrade.createItemsOnPanel() end function NPCTrade.extraFilters(widget, showOnlyHolding) - if setupButton:getText() == 'Sell' then + if setupButton:getText() == tr('Sell') then if not showOnlyHolding or cacheGoods[widget.offer[1]:getId()] then return true else @@ -306,8 +306,8 @@ function NPCTrade.refreshFilters() end end -function NPCTrade.refreshItemsPanel() - if setupButton:getText() == 'Buy' then +function NPCTrade.refreshItemsPanel() + if setupButton:getText() == tr('Buy') then local items = itemsPanel:getChildCount() for i = 1, items do local itemWidget = itemsPanel:getChildByIndex(i) diff --git a/modules/game_npctrade/npctrade.otui b/modules/game_npctrade/npctrade.otui index 75af9828..f31a7aeb 100644 --- a/modules/game_npctrade/npctrade.otui +++ b/modules/game_npctrade/npctrade.otui @@ -7,19 +7,19 @@ NPCOfferLabel < Label NPCPanel < ScrollablePanel image-source: /core_styles/styles/images/panel_flat.png image-border: 1 - -NPCItemBox < UICheckBox + +NPCItemBox < UICheckBox border-width: 1 border-color: #000000 @onCheckChange: NPCTrade.setItem(self) - + Item id: item phantom: true anchors.top: parent.top anchors.horizontalCenter: parent.horizontalCenter margin-top: 2 - + Label id: nameLabel phantom: true @@ -27,7 +27,7 @@ NPCItemBox < UICheckBox anchors.horizontalCenter: parent.horizontalCenter text-auto-resize: true margin-top: 5 - + Label id: weightLabel phantom: true @@ -35,7 +35,7 @@ NPCItemBox < UICheckBox anchors.horizontalCenter: parent.horizontalCenter text-auto-resize: true margin-top: 5 - + Label id: priceLabel phantom: true @@ -46,21 +46,21 @@ NPCItemBox < UICheckBox $checked: border-color: #FFFFFF - + $hover !checked: border-color: #AAAAAA MainWindow id: npcWindow - text: NPC Trade + !text: tr('NPC Trade') size: 550 550 @onEscape: NPCTrade.hide() TabButton id: buyTab - tooltip: List of items that you're able to buy - text: Buy + !tooltip: tr("List of items that you're able to buy") + !text: tr('Buy') checked: true on: true anchors.left: parent.left @@ -71,23 +71,23 @@ MainWindow TabButton id: sellTab - tooltip: List of items that you're able to sell - text: Sell + !tooltip: tr("List of items that you're able to sell") + !text: tr('Sell') anchors.left: parent.horizontalCenter anchors.right: parent.right anchors.top: parent.top margin-left: 5 margin-top: 5 - + Label id: searchLabel - text: Search: + !text: tr('Search:') anchors.left: parent.left anchors.top: prev.bottom text-auto-resize: true margin-top: 7 margin-left: 2 - + TextEdit id: searchText width: 200 @@ -96,14 +96,14 @@ MainWindow margin-top: -2 margin-left: 5 @onTextChange: NPCTrade.refreshFilters() - + NPCPanel height: 250 anchors.left: parent.left anchors.right: parent.right anchors.top: prev.bottom margin-top: 5 - + VerticalScrollBar id: itemsPanelListScrollBar anchors.top: parent.top @@ -111,7 +111,7 @@ MainWindow anchors.right: parent.right step: 14 pixels-scroll: true - + NPCPanel id: itemsPanel height: 250 @@ -125,7 +125,7 @@ MainWindow cell-size: 160 90 flow: true auto-spacing: true - + FlatPanel id: setupPanel height: 150 @@ -134,10 +134,10 @@ MainWindow anchors.right: parent.right anchors.top: prev.bottom margin-top: 5 - + Label id: quantityLabel - text: Quantity: + !text: tr('Quantity:') anchors.left: parent.left anchors.top: parent.top text-auto-resize: true @@ -146,7 +146,7 @@ MainWindow NPCOfferLabel id: quantity - + HorizontalScrollBar id: quantityScroll anchors.left: parent.left @@ -161,74 +161,74 @@ MainWindow Label id: nameLabel - text: Name: + !text: tr('Name:') anchors.left: parent.left anchors.top: prev.bottom margin-top: 5 margin-left: 2 width: 64 - + NPCOfferLabel id: name Label id: priceLabel - text: Price: + !text: tr('Price:') anchors.left: parent.left anchors.top: prev.bottom margin-top: 5 margin-left: 2 width: 64 - + NPCOfferLabel id: price - + Label id: moneyLabel - text: Money: + !text: tr('Money:') anchors.left: parent.left anchors.top: prev.bottom margin-top: 5 margin-left: 2 width: 64 - + NPCOfferLabel id: money - + Label id: weightLabel - text: Weight: + !text: tr('Weight:') anchors.left: parent.left anchors.top: prev.bottom margin-top: 5 margin-left: 2 width: 64 - + NPCOfferLabel id: weight - + Label id: capacityLabel - text: Capacity: + !text: tr('Capacity:') anchors.left: parent.left anchors.top: prev.bottom margin-top: 5 margin-left: 2 width: 64 - + NPCOfferLabel id: capacity - + Button id: setupButton - text: Buy + !text: tr('Buy') width: 64 anchors.horizontalCenter: parent.horizontalCenter anchors.top: prev.bottom @onClick: NPCTrade.setupButton() - + Button - text: Close + !text: tr('Close') width: 64 anchors.right: parent.right anchors.bottom: parent.bottom diff --git a/modules/game_outfit/outfit.otui b/modules/game_outfit/outfit.otui index 6adb3441..71e50046 100644 --- a/modules/game_outfit/outfit.otui +++ b/modules/game_outfit/outfit.otui @@ -1,5 +1,5 @@ Window - text: Select Outfit + !text: tr('Select Outfit') size: 550 280 padding: 0 0 0 0 @@ -11,7 +11,7 @@ Window Label id: outfitName - text: Outfit Name + !text: tr('Outfit Name') width: 100 anchors.top: parent.top anchors.left: parent.left @@ -43,7 +43,7 @@ Window ButtonBox id: head - text: Head + !text: tr('Head') anchors.top: outfitCreatureBox.top anchors.left: outfitCreatureBox.right margin-left: 10 @@ -52,21 +52,21 @@ Window ButtonBox id: primary - text: Primary + !text: tr('Primary') anchors.top: prev.bottom anchors.left: prev.left width: 90 ButtonBox id: secondary - text: Secondary + !text: tr('Secondary') anchors.top: prev.bottom anchors.left: prev.left width: 90 ButtonBox id: detail - text: Detail + !text: tr('Detail') anchors.top: prev.bottom anchors.left: prev.left width: 90 @@ -91,7 +91,7 @@ Window CheckBox id: addon1 - text: Addon 1 + !text: tr('Addon 1') enabled: false margin-top: 6 width: 100 @@ -100,7 +100,7 @@ Window CheckBox id: addon2 - text: Addon 2 + !text: tr('Addon 2') enabled: false margin-top: 2 width: 100 @@ -109,7 +109,7 @@ Window CheckBox id: addon3 - text: Addon 3 + !text: tr('Addon 3') enabled: false margin-top: 2 width: 100 @@ -126,7 +126,7 @@ Window Button id: outfitOkButton - text: Ok + !text: tr('Ok') width: 64 anchors.right: next.left anchors.bottom: parent.bottom @@ -136,7 +136,7 @@ Window Button id: outfitCancelButton - text: Cancel + !text: tr('Cancel') width: 64 anchors.right: parent.right anchors.bottom: parent.bottom diff --git a/modules/game_skills/skills.lua b/modules/game_skills/skills.lua index 4ec6ff59..75e32aa2 100644 --- a/modules/game_skills/skills.lua +++ b/modules/game_skills/skills.lua @@ -36,7 +36,7 @@ function Skills.init() }) skillsWindow = displayUI('skills.otui', GameInterface.getLeftPanel()) - skillsButton = TopMenu.addGameToggleButton('skillsButton', 'Skills (Ctrl+S)', 'skills.png', Skills.toggle) + skillsButton = TopMenu.addGameToggleButton('skillsButton', tr('Skills') .. ' (Ctrl+S)', 'skills.png', Skills.toggle) skillsButton:setOn(true) Keyboard.bindKeyDown('Ctrl+S', Skills.toggle) end @@ -86,7 +86,7 @@ end function Skills.onLevelChange(localPlayer, value, percent) setSkillValue('level', tr(value)) - setSkillPercent('level', percent, 'You have ' .. (100 - percent) .. ' percent to go') + setSkillPercent('level', percent, tr('You have %s percent to go', 100 - percent)) end function Skills.onHealthChange(localPlayer, health, maxHealth) @@ -114,16 +114,16 @@ function Skills.onStaminaChange(localPlayer, stamina) local percent = 100 * stamina / (42 * 60) -- max is 42 hours setSkillValue('stamina', hours .. ":" .. minutes) - setSkillPercent('stamina', percent, 'You have ' .. percent .. ' percent') + setSkillPercent('stamina', percent, tr('You have %s percent', percent)) end function Skills.onMagicLevelChange(localPlayer, value, percent) setSkillValue('magiclevel', value) - setSkillPercent('magiclevel', percent, 'You have ' .. (100 - percent) .. ' percent to go') + setSkillPercent('magiclevel', percent, tr('You have %s percent to go', 100 - percent)) end function Skills.onSkillChange(localPlayer, id, level, percent) setSkillValue('skillId' .. id, level) - setSkillPercent('skillId' .. id, percent, 'You have ' .. (100 - percent) .. ' percent to go') + setSkillPercent('skillId' .. id, percent, tr('You have %s percent to go', 100 - percent)) end diff --git a/modules/game_skills/skills.otui b/modules/game_skills/skills.otui index a716d440..664d74d5 100644 --- a/modules/game_skills/skills.otui +++ b/modules/game_skills/skills.otui @@ -32,7 +32,7 @@ SkillPercentPanel < ProgressBar MiniWindow id: skillWindow - text: Skills + !text: tr('Skills') height: 350 icon: skills.png @onClose: Skills.toggle() @@ -45,13 +45,13 @@ MiniWindow id: experience height: 15 SkillNameLabel - text: Experience + !text: tr('Experience') SkillValueLabel SkillButton id: level SkillNameLabel - text: Level + !text: tr('Level') SkillValueLabel SkillPercentPanel background-color: red @@ -60,41 +60,41 @@ MiniWindow id: health height: 15 SkillNameLabel - text: Hit Points + !text: tr('Hit Points') SkillValueLabel SkillButton id: mana height: 15 SkillNameLabel - text: Mana + !text: tr('Mana') SkillValueLabel SkillButton id: soul height: 15 SkillNameLabel - text: Soul Points + !text: tr('Soul Points') SkillValueLabel SkillButton id: capacity height: 15 SkillNameLabel - text: Capacity + !text: tr('Capacity') SkillValueLabel SkillButton id: stamina SkillNameLabel - text: Stamina + !text: tr('Stamina') SkillValueLabel SkillPercentPanel SkillButton id: magiclevel SkillNameLabel - text: Magic Level + !text: tr('Magic Level') SkillValueLabel SkillPercentPanel background-color: red @@ -102,14 +102,14 @@ MiniWindow SkillButton id: skillId0 SkillNameLabel - text: Fist Fighting + !text: tr('Fist Fighting') SkillValueLabel SkillPercentPanel SkillButton id: skillId1 SkillNameLabel - text: Club Fighting + !text: tr('Club Fighting') SkillValueLabel SkillPercentPanel @@ -117,35 +117,35 @@ MiniWindow id: skillId2 SkillNameLabel - text: Sword Fighting + !text: tr('Sword Fighting') SkillValueLabel SkillPercentPanel SkillButton id: skillId3 SkillNameLabel - text: Axe Fighting + !text: tr('Axe Fighting') SkillValueLabel SkillPercentPanel SkillButton id: skillId4 SkillNameLabel - text: Distance Fighting + !text: tr('Distance Fighting') SkillValueLabel SkillPercentPanel SkillButton id: skillId5 SkillNameLabel - text: Shielding + !text: tr('Shielding') SkillValueLabel SkillPercentPanel SkillButton id: skillId6 SkillNameLabel - text: Fishing + !text: tr('Fishing') SkillValueLabel SkillPercentPanel diff --git a/modules/game_textmessage/textmessage.lua b/modules/game_textmessage/textmessage.lua index 8bf99c1c..6b7e41f5 100644 --- a/modules/game_textmessage/textmessage.lua +++ b/modules/game_textmessage/textmessage.lua @@ -5,14 +5,14 @@ importStyle 'textmessage.otui' -- private variables local MessageTypes = { - consoleRed = { color = '#F55E5E', consoleTab = 'Default' }, - consoleOrange = { color = '#FE6500', consoleTab = 'Default' }, - consoleBlue = { color = '#9F9DFD', consoleTab = 'Default' }, - warning = { color = '#F55E5E', consoleTab = 'Server Log', labelId = 'centerWarning', wrap = true }, - infoDescription = { color = '#00EB00', consoleTab = 'Server Log', labelId = 'centerInfo', consoleOption = 'showInfoMessagesInConsole', wrap = true }, - eventAdvance = { color = '#FFFFFF', consoleTab = 'Server Log', labelId = 'centerAdvance', consoleOption = 'showEventMessagesInConsole', wrap = true }, - eventDefault = { color = '#FFFFFF', consoleTab = 'Server Log', labelId = 'bottomStatus', consoleOption = 'showEventMessagesInConsole' }, - statusDefault = { color = '#FFFFFF', consoleTab = 'Server Log', labelId = 'bottomStatus', consoleOption = 'showStatusMessagesInConsole' }, + consoleRed = { color = '#F55E5E', consoleTab = tr('Default') }, + consoleOrange = { color = '#FE6500', consoleTab = tr('Default') }, + consoleBlue = { color = '#9F9DFD', consoleTab = tr('Default') }, + warning = { color = '#F55E5E', consoleTab = tr('Server Log'), labelId = 'centerWarning', wrap = true }, + infoDescription = { color = '#00EB00', consoleTab = tr('Server Log'), labelId = 'centerInfo', consoleOption = 'showInfoMessagesInConsole', wrap = true }, + eventAdvance = { color = '#FFFFFF', consoleTab = tr('Server Log'), labelId = 'centerAdvance', consoleOption = 'showEventMessagesInConsole', wrap = true }, + eventDefault = { color = '#FFFFFF', consoleTab = tr('Server Log'), labelId = 'bottomStatus', consoleOption = 'showEventMessagesInConsole' }, + statusDefault = { color = '#FFFFFF', consoleTab = tr('Server Log'), labelId = 'bottomStatus', consoleOption = 'showStatusMessagesInConsole' }, statusSmall = { color = '#FFFFFF', labelId = 'bottomStatus' }, } diff --git a/modules/game_tibiafiles/tibiafiles.otmod b/modules/game_tibiafiles/tibiafiles.otmod index 7a62763c..ebfc3ff3 100644 --- a/modules/game_tibiafiles/tibiafiles.otmod +++ b/modules/game_tibiafiles/tibiafiles.otmod @@ -5,8 +5,8 @@ Module @onLoad: | if not g_thingsType.load('/game_tibiafiles/Tibia.dat') then - fatal("Unable to load dat file, please place a valid Tibia dat in modules/game_tibiafiles/Tibia.dat") + fatal(tr("Unable to load dat file, please place a valid Tibia dat in modules/game_tibiafiles/Tibia.dat")) end if not g_sprites.load('/game_tibiafiles/Tibia.spr') then - fatal("Unable to load spr file, please place a valid Tibia spr in modules/game_tibiafiles/Tibia.spr") + fatal(tr("Unable to load spr file, please place a valid Tibia spr in modules/game_tibiafiles/Tibia.spr")) end diff --git a/modules/game_viplist/addvip.otui b/modules/game_viplist/addvip.otui index 4b0c1712..bb14c776 100644 --- a/modules/game_viplist/addvip.otui +++ b/modules/game_viplist/addvip.otui @@ -1,11 +1,11 @@ MainWindow size: 256 128 - text: Add to VIP list + !text: tr('Add to VIP list') @onEnter: VipList.addVip() @onEscape: VipList.destroyAddWindow() Label - text: Please enter a character name: + !text: tr('Please enter a character name:') anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -24,7 +24,7 @@ MainWindow margin-bottom: 10 Button - text: Ok + !text: tr('Ok') width: 64 anchors.right: next.left anchors.bottom: parent.bottom @@ -32,7 +32,7 @@ MainWindow @onClick: VipList.addVip() Button - text: Cancel + !text: tr('Cancel') width: 64 anchors.right: parent.right anchors.bottom: parent.bottom diff --git a/modules/game_viplist/viplist.lua b/modules/game_viplist/viplist.lua index ac46f857..e3907cb9 100644 --- a/modules/game_viplist/viplist.lua +++ b/modules/game_viplist/viplist.lua @@ -13,7 +13,7 @@ function VipList.init() vipWindow = displayUI('viplist.otui', GameInterface.getLeftPanel()) - vipButton = TopMenu.addGameToggleButton('vipListButton', 'VIP list', 'viplist.png', VipList.toggle) + vipButton = TopMenu.addGameToggleButton('vipListButton', tr('VIP list'), 'viplist.png', VipList.toggle) vipButton:setOn(true) end @@ -127,10 +127,10 @@ function VipList.onVipListLabelMousePress(widget, mousePos, mouseButton) local vipList = vipWindow:getChildById('contentsPanel') local menu = createWidget('PopupMenu') - menu:addOption('Add new VIP', function() VipList.createAddWindow() end) - menu:addOption('Remove ' .. widget:getText(), function() if widget then g_game.removeVip(widget:getId():sub(4)) vipList:removeChild(widget) end end) + menu:addOption(tr('Add new VIP'), function() VipList.createAddWindow() end) + menu:addOption(tr('Remove %s', widget:getText()), function() if widget then g_game.removeVip(widget:getId():sub(4)) vipList:removeChild(widget) end end) menu:addSeparator() - menu:addOption('Copy Name', function() g_window.setClipboardText(widget:getText()) end) + menu:addOption(tr('Copy Name'), function() g_window.setClipboardText(widget:getText()) end) menu:display(mousePos) return true diff --git a/modules/game_viplist/viplist.otui b/modules/game_viplist/viplist.otui index b675a93c..61da55ae 100644 --- a/modules/game_viplist/viplist.otui +++ b/modules/game_viplist/viplist.otui @@ -5,7 +5,7 @@ VipListLabel < GameLabel MiniWindow id: vipWindow - text: VIP List + !text: tr('VIP List') height: 100 icon: viplist.png @onClose: VipList.toggle() diff --git a/src/otclient/core/mapview.cpp b/src/otclient/core/mapview.cpp index 00c71272..42134cd0 100644 --- a/src/otclient/core/mapview.cpp +++ b/src/otclient/core/mapview.cpp @@ -89,16 +89,17 @@ void MapView::draw(const Rect& rect) for(int z=m_cachedLastVisibleFloor;z>=m_cachedFirstVisibleFloor;--z) { while(it != end) { const TilePtr& tile = *it; - if(tile->getPosition().z != z) + Position tilePos = tile->getPosition(); + if(tilePos.z != z) break; else ++it; if(!m_drawMinimapColors) - tile->draw(transformPositionTo2D(tile->getPosition()), scaleFactor, drawFlags); + tile->draw(transformPositionTo2D(tilePos), scaleFactor, drawFlags); else { g_painter->setColor(tile->getMinimapColor()); - g_painter->drawFilledRect(Rect(transformPositionTo2D(tile->getPosition()), tileSize)); + g_painter->drawFilledRect(Rect(transformPositionTo2D(tilePos), tileSize)); } }