Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation system update project #1084

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/locales/de.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

-- Author: Samuel
locale = {
name = "de",
charset = "cp1252",
Expand Down
635 changes: 633 additions & 2 deletions data/locales/en.lua

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions data/styles/30-minimap.otui
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ MinimapZoomOutButton < Button
//icon-source: /images/game/minimap/zoom_out

MinimapResetButton < Button
!text: tr('Center')
!text: localize('MinimapButtonCenter')
size: 44 20
anchors.left: parent.left
anchors.top: parent.top
Expand Down Expand Up @@ -112,11 +112,11 @@ MinimapFlagCheckBox < CheckBox
image-clip: 52 0 26 26

MinimapFlagWindow < MainWindow
!text: tr('Create Map Mark')
!text: localize('MinimapWindowTitleSetMark')
size: 196 185

Label
!text: tr('Position') .. ':'
!text: localize('FormFieldPosition') .. ':'
text-auto-resize: true
anchors.top: parent.top
anchors.left: parent.left
Expand All @@ -130,7 +130,7 @@ MinimapFlagWindow < MainWindow
margin-top: 2

Label
!text: tr('Description') .. ':'
!text: localize('FormFieldDescription') .. ':'
anchors.left: parent.left
anchors.top: prev.bottom
margin-top: 7
Expand Down Expand Up @@ -232,15 +232,15 @@ MinimapFlagWindow < MainWindow

Button
id: okButton
!text: tr('Ok')
!text: localize('UIButtonOk')
width: 64
anchors.right: next.left
anchors.bottom: parent.bottom
margin-right: 10

Button
id: cancelButton
!text: tr('Cancel')
!text: localize('UIButtonCancel')
width: 64
anchors.right: parent.right
anchors.bottom: parent.bottom
6 changes: 3 additions & 3 deletions mods/client_textedit/textedit.otui
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ TextEditButtons < Panel

Button
id: ok
!text: tr('Ok')
!text: localize('UIButtonOk')
anchors.bottom: parent.bottom
anchors.right: next.left
margin-right: 10
width: 60

Button
id: cancel
!text: tr('Cancel')
!text: localize('UIButtonCancel')
anchors.bottom: parent.bottom
anchors.right: parent.right
width: 60

TextEditWindow < MainWindow
id: textedit
!text: tr("Edit text")
!text: localize('WindowTitleTextEdit')
layout:
type: verticalBox
fit-children: true
Expand Down
18 changes: 9 additions & 9 deletions mods/game_bot/bot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function init()

initCallbacks()

botButton = modules.game_mainpanel.addToggleButton('botButton', tr('Bot'), '/images/options/bot', toggle, false, 99999)
botButton = modules.game_mainpanel.addToggleButton('botButton', localize('BotMainPanelToggleButton'), '/images/options/bot', toggle, false, 99999)
botButton:setOn(false)
botButton:hide()

Expand Down Expand Up @@ -336,37 +336,37 @@ function uploadConfig()
local config = editWindow.manager.upload.config:getCurrentOption().text
local archive = compressConfig(config)
if not archive then
return displayErrorBox(tr("Config upload failed"), tr("Config %s is invalid (can't be compressed)", config))
return displayErrorBox(localize('BotConfigUploadFailTitle'), localize('BotConfigUploadFailCompression', config))
end
if archive:len() > 1024 * 1024 then
return displayErrorBox(tr("Config upload failed"), tr("Config %s is too big, maximum size is 1024KB. Now it has %s KB.", config, math.floor(archive:len() / 1024)))
return displayErrorBox(localize('BotConfigUploadFailTitle'), localize('BotConfigUploadFailSize', config, math.floor(archive:len() / 1024)))
end

local infoBox = displayInfoBox(tr("Uploading config"), tr("Uploading config %s. Please wait.", config))
local infoBox = displayInfoBox(localize('BotConfigUploadPendingTitle'), localize('BotConfigUploadPendingText', config))

HTTP.postJSON(configManagerUrl .. "?config=" .. config:gsub("%s+", "_"), archive, function(data, err)
if infoBox then
infoBox:destroy()
end
if err or data["error"] then
return displayErrorBox(tr("Config upload failed"), tr("Error while upload config %s:\n%s", config, err or data["error"]))
return displayErrorBox(localize('BotConfigUploadFailTitle'), localize('BotConfigUploadFailText', config, err or data["error"]))
end
displayInfoBox(tr("Succesful config upload"), tr("Config %s has been uploaded.\n%s", config, data["message"]))
displayInfoBox(localize('BotConfigUploadSuccessTitle'), localize('BotConfigUploadSuccessText', config, data["message"]))
end)
end

function downloadConfig()
local hash = editWindow.manager.download.config:getText()
if hash:len() == 0 then
return displayErrorBox(tr("Config download error"), tr("Enter correct config hash"))
return displayErrorBox(localize('BotConfigDownloadErrorTitle'), localize('BotConfigDownloadErrorHash'))
end
local infoBox = displayInfoBox(tr("Downloading config"), tr("Downloading config with hash %s. Please wait.", hash))
local infoBox = displayInfoBox(localize('BotConfigDownloadTitle'), localize('BotConfigDownloadText', hash))
HTTP.download(configManagerUrl .. "?hash=" .. hash, hash .. ".zip", function(path, checksum, err)
if infoBox then
infoBox:destroy()
end
if err then
return displayErrorBox(tr("Config download error"), tr("Config with hash %s cannot be downloaded", hash))
return displayErrorBox(localize('BotConfigDownloadErrorTitle'), localize('BotConfigDownloadErrorFailed', hash))
end
modules.client_textedit.show("", {
title="Enter name for downloaded config",
Expand Down
6 changes: 3 additions & 3 deletions mods/game_bot/bot.otui
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ BotTabBarButton < TabBarButton

MiniWindow
id: botWindow
!text: tr('Bot')
!text: localize('BotMiniWindowTitle')
height: 600
icon: /images/topbuttons/bot
@onClose: modules.game_bot.onMiniWindowClose()
Expand All @@ -49,7 +49,7 @@ MiniWindow
anchors.top: prev.top
anchors.left: prev.right
anchors.right: parent.right
!text: tr('Edit')
!text: localize('UIButtonEdit')
@onClick: modules.game_bot.edit()
margin-left: 3
margin-right: 37
Expand Down Expand Up @@ -78,7 +78,7 @@ MiniWindow
text-wrap: true
text-auto-resize: true
text-align: center
!text: tr('Status: waiting')
!text: localize('BotStatusWaiting')
margin-left: 3
margin-right: 3

Expand Down
17 changes: 9 additions & 8 deletions mods/game_bot/default_configs/cavebot_1.3/cavebot/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ CaveBot.Config.setup = function()
local ui = CaveBot.Config.ui
local add = CaveBot.Config.add

add("ping", "Server ping", 100)
add("walkDelay", "Walk delay", 10)
add("mapClick", "Use map click", false)
add("mapClickDelay", "Map click delay", 100)
add("ignoreFields", "Ignore fields", false)
add("skipBlocked", "Skip blocked path", false)
add("useDelay", "Delay after use", 400)
-- panel id, panel title (see locales), default value
add("ping", "BotCavePing", 100)
add("walkDelay", "BotCaveWalkDelay", 10)
add("mapClick", "BotCaveMapClick", false)
add("mapClickDelay", "BotCaveMapClickDelay", 100)
add("ignoreFields", "BotCaveIgnoreFields", false)
add("skipBlocked", "BotCaveSkipBlocked", false)
add("useDelay", "BotCaveUseDelay", 400)
end

CaveBot.Config.show = function()
Expand Down Expand Up @@ -79,7 +80,7 @@ CaveBot.Config.add = function(id, title, defaultValue)
return error("Invalid default value of config for key " .. id .. ", should be number or boolean")
end

panel.title:setText(tr(title) .. ":")
panel.title:setText(localize(title) .. ":")

CaveBot.Config.value_setters[id] = setter
CaveBot.Config.values[id] = defaultValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ TargetBotCreatureEditorWindow < MainWindow
anchors.right: parent.right
anchors.top: parent.top
text-align: center
!text: tr('You can use * (any characters) and ? (any character) in target name')
!text: localize('BotCreatureEditorHint_1')

Label
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
text-align: center
!text: tr('You can also enter multiple targets, separate them by ,')
!text: localize('BotCreatureEditorHint_2')

TextEdit
id: name
Expand Down Expand Up @@ -141,23 +141,23 @@ TargetBotCreatureEditorWindow < MainWindow

Button
id: help
!text: tr('Help & Tutorials')
!text: localize('BotHelpTutorials')
anchors.bottom: parent.bottom
anchors.left: parent.left
width: 150
@onClick: g_platform.openUrl("http://bot.otclient.ovh/")

Button
id: ok
!text: tr('Ok')
!text: localize('UIButtonOk')
anchors.bottom: parent.bottom
anchors.right: next.left
margin-right: 10
width: 60

Button
id: cancel
!text: tr('Cancel')
!text: localize('UIButtonCancel')
anchors.bottom: parent.bottom
anchors.right: parent.right
width: 60
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ TargetBotLootingPanel < Panel

BotSwitch
id: everyItem
!text: tr("Loot every item")
!text: localize('BotLootingConfigLootAll')
margin-top: 2

Label
Expand Down Expand Up @@ -72,7 +72,7 @@ TargetBotLootingPanel < Panel
margin-top: 3
margin-left: 20
margin-right: 20
!text: tr("Drag item or click on any of empty slot")
!text: localize('BotLootingAddItem')
text-align: center
text-wrap: true
text-auto-resize: true
Expand Down
2 changes: 1 addition & 1 deletion mods/game_bot/default_configs/vBot_4.8/cavebot/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ CaveBot.Config.add = function(id, title, defaultValue)
return warn("Invalid default value of config for key " .. id .. ", should be number or boolean")
end

panel.title:setText(tr(title) .. ":")
panel.title:setText(localize(title) .. ":")

CaveBot.Config.value_setters[id] = setter
CaveBot.Config.values[id] = defaultValue
Expand Down
4 changes: 2 additions & 2 deletions mods/game_bot/default_configs/vBot_4.8/cavebot/minimap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ minimap.onMouseRelease = function(widget,pos,button)
local menu = g_ui.createWidget('PopupMenu')
menu:setId("minimapMenu")
menu:setGameMenu(true)
menu:addOption(tr('Create mark'), function() minimap:createFlagWindow(mapPos) end)
menu:addOption(tr('Add CaveBot GoTo'), function() CaveBot.addAction("goto", mapPos.x .. "," .. mapPos.y .. "," .. mapPos.z, true) CaveBot.save() end)
menu:addOption(localize('BotMinimapOptionCreateMark'), function() minimap:createFlagWindow(mapPos) end)
menu:addOption(localize('BotMinimapOptionAddGoTo'), function() CaveBot.addAction("goto", mapPos.x .. "," .. mapPos.y .. "," .. mapPos.z, true) CaveBot.save() end)
menu:display(pos)
return true
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ TargetBotCreatureEditorWindow < MainWindow
anchors.right: parent.right
anchors.top: parent.top
text-align: center
!text: tr('You can use * (any characters) and ? (any character) in target name')
!text: localize('BotCreatureEditorHint_1')

Label
anchors.left: parent.left
anchors.right: parent.right
anchors.top: prev.bottom
text-align: center
!text: tr('You can also enter multiple targets, separate them by ,')
!text: localize('BotCreatureEditorHint_2')

TextEdit
id: name
Expand Down Expand Up @@ -142,23 +142,23 @@ TargetBotCreatureEditorWindow < MainWindow

Button
id: help
!text: tr('Help & Tutorials')
!text: localize('BotHelpTutorials')
anchors.bottom: parent.bottom
anchors.left: parent.left
width: 150
@onClick: g_platform.openUrl("http://bot.otclient.ovh/")

Button
id: ok
!text: tr('Ok')
!text: localize('UIButtonOk')
anchors.bottom: parent.bottom
anchors.right: next.left
margin-right: 10
width: 60

Button
id: cancel
!text: tr('Cancel')
!text: localize('UIButtonCancel')
anchors.bottom: parent.bottom
anchors.right: parent.right
width: 60
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ TargetBotLootingPanel < Panel

BotSwitch
id: everyItem
!text: tr("Loot every item, except these")
!text: localize('BotLootingBlacklist')
margin-top: 2
font: small-9px

Expand Down
6 changes: 3 additions & 3 deletions mods/game_bot/default_configs/vBot_4.8/vBot/AttackBot.otui
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ AttackEntry < UIWidget

Button
id: remove
!text: tr('x')
!text: 'x'
anchors.right: parent.right
margin-right: 15
width: 15
Expand All @@ -51,7 +51,7 @@ AttackBotBotPanel < Panel
anchors.left: parent.left
text-align: center
width: 130
!text: tr('AttackBot')
!text: localize('BotAttackingButton')

Button
id: settings
Expand Down Expand Up @@ -562,7 +562,7 @@ AttackBotWindow < MainWindow
anchors.top: parent.top
margin-top: 10
margin-left: 2
!text: tr('More important methods come first (Example: Exori gran above Exori)')
!text: localize('BotInfoMethodOrder')
text-align: left
font: verdana-11px-rounded
color: #aeaeae
Expand Down
2 changes: 1 addition & 1 deletion mods/game_bot/default_configs/vBot_4.8/vBot/BotServer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Panel
anchors.right: parent.right
text-align: center
height: 18
!text: tr('BotServer')
!text: localize('BotServerButton')
]])
ui:setId(panelName)

Expand Down
6 changes: 3 additions & 3 deletions mods/game_bot/default_configs/vBot_4.8/vBot/BotServer.otui
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ BotServerData < Panel
anchors.left: parent.left
anchors.right: parent.right
text-align: center
!text: tr("BotServer Data")
!text: localize('BotServerWindowLabelData')

Label
id: label
Expand Down Expand Up @@ -155,7 +155,7 @@ FeaturePanel < Panel
text: Broadcast

BotServerWindow < MainWindow
!text: tr('BotServer')
!text: localize('BotServerWindowTitle')
size: 370 310
@onEscape: self:hide()

Expand All @@ -179,7 +179,7 @@ BotServerWindow < MainWindow

Button
id: closeButton
!text: tr('Close')
!text: localize('UIButtonClose')
font: cipsoftFont
anchors.right: parent.right
anchors.bottom: parent.bottom
Expand Down
Loading
Loading