mirror of
https://github.com/edubart/otclient.git
synced 2025-10-18 13:33:27 +02:00
implement all needed tr() for localization
* implement some pt-BR translations * remove legacy about module
This commit is contained in:
@@ -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
|
||||
end
|
||||
|
@@ -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<64><75>es devem vir sempre em ordem alfab<61>tica.
|
||||
translation = {
|
||||
['Account name'] = 'Nome da conta',
|
||||
['Account Status:\nFree Account'] = 'Estado da Conta:\nGr<EFBFBD>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<72>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<EFBFBD><EFBFBD>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<64><75>es devem vir sempre em ordem alfab<61>tica.
|
||||
translation = {
|
||||
["Account name"] = "Nome da conta",
|
||||
["Account Status:\nFree Account"] = "Estado da conta:\nGrat<EFBFBD>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<6F>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<63>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<63><61>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<EFBFBD><EFBFBD>o",
|
||||
["Detail"] = "Detalhe",
|
||||
["Disable Shared Experience"] = "Desativar experi<72>ncia compartilhada",
|
||||
["Distance Fighting"] = "Flecha",
|
||||
["Edit hotkey text:"] = "Editar texto do atalho",
|
||||
["Edit Text"] = "Editar Texto",
|
||||
["Enable Shared Experience"] = "Ativar experi<72>ncia compartilhada",
|
||||
["Enable vertical synchronization"] = "Ativar sincroniza<7A><61>o vertical",
|
||||
["Enter Game"] = "Entrar no jogo",
|
||||
["Error"] = "Erro",
|
||||
["Exclude from private chat"] = "Excluir do canal privado",
|
||||
["Experience"] = "Experi<EFBFBD>ncia",
|
||||
["Fishing"] = "Pesca",
|
||||
["Fist Fighting"] = "Porrada",
|
||||
["Follow"] = "Seguir",
|
||||
["Frame rate limit"] = "Limite de FPS",
|
||||
["Fullscreen"] = "Tela cheia",
|
||||
["Head"] = "Cabe<EFBFBD>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<EFBFBD>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<EFBFBD>vel",
|
||||
["Limits FPS to 60"] = "Limita o FPS para 60",
|
||||
["List of items that you're able to buy"] = "Listar itens que voc<6F> n<>o pode comprar",
|
||||
["List of items that you're able to sell"] = "Listar itens que voc<6F> pode comprar",
|
||||
["Load"] = "Carregar",
|
||||
["Loggin out..."] = "Saindo...",
|
||||
["Login"] = "Entrar",
|
||||
["Login Error"] = "Erro de Autentica<63><61>o",
|
||||
["Look"] = "Olhar",
|
||||
["Magic Level"] = "N<EFBFBD>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<6E>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<6F>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<6D><61>es de n<>meros. 1.000 100,00 1.000,00 etc.
|
||||
-- Adicionar informa<6D><61>es de n<>meros. 1.000 100,00 1.000,00 etc.
|
||||
}
|
||||
|
||||
Locales.installLocale(locale)
|
Reference in New Issue
Block a user