mirror of
https://github.com/edubart/otclient.git
synced 2025-10-15 12:04:55 +02:00
Added locale number formatting to locale files
This commit is contained in:
@@ -4,6 +4,10 @@ locale = {
|
|||||||
charset = "cp1252",
|
charset = "cp1252",
|
||||||
languageName = "Deutsch",
|
languageName = "Deutsch",
|
||||||
|
|
||||||
|
formatNumbers = true,
|
||||||
|
decimalSeperator = ',',
|
||||||
|
thousandsSeperator = ' ',
|
||||||
|
|
||||||
translation = {
|
translation = {
|
||||||
["1a) Offensive Name"] = false,
|
["1a) Offensive Name"] = false,
|
||||||
["1b) Invalid Name Format"] = false,
|
["1b) Invalid Name Format"] = false,
|
||||||
|
@@ -3,6 +3,10 @@ locale = {
|
|||||||
charset = "cp1252",
|
charset = "cp1252",
|
||||||
languageName = "English",
|
languageName = "English",
|
||||||
|
|
||||||
|
formatNumbers = true,
|
||||||
|
decimalSeperator = '.',
|
||||||
|
thousandsSeperator = ',',
|
||||||
|
|
||||||
-- translations are not needed because everything is already in english
|
-- translations are not needed because everything is already in english
|
||||||
translation = {}
|
translation = {}
|
||||||
}
|
}
|
||||||
|
@@ -7,6 +7,10 @@ locale = {
|
|||||||
charset = "cp1252",
|
charset = "cp1252",
|
||||||
languageName = "Espa<EFBFBD>ol",
|
languageName = "Espa<EFBFBD>ol",
|
||||||
|
|
||||||
|
formatNumbers = true,
|
||||||
|
decimalSeperator = ',',
|
||||||
|
thousandsSeperator = '.',
|
||||||
|
|
||||||
translation = {
|
translation = {
|
||||||
["1a) Offensive Name"] = "1a) Nombre ofensivo",
|
["1a) Offensive Name"] = "1a) Nombre ofensivo",
|
||||||
["1b) Invalid Name Format"] = "1b) Formato invalido para nombre",
|
["1b) Invalid Name Format"] = "1b) Formato invalido para nombre",
|
||||||
|
@@ -2,6 +2,10 @@ locale = {
|
|||||||
name = "pl",
|
name = "pl",
|
||||||
languageName = "Polski",
|
languageName = "Polski",
|
||||||
|
|
||||||
|
formatNumbers = true,
|
||||||
|
decimalSeperator = '.',
|
||||||
|
thousandsSeperator = ' ',
|
||||||
|
|
||||||
translation = {
|
translation = {
|
||||||
["1a) Offensive Name"] = "1a) Obrazliwe Imie",
|
["1a) Offensive Name"] = "1a) Obrazliwe Imie",
|
||||||
["1b) Invalid Name Format"] = "1b) Niepoprawny Format Imienia",
|
["1b) Invalid Name Format"] = "1b) Niepoprawny Format Imienia",
|
||||||
|
@@ -3,6 +3,10 @@ locale = {
|
|||||||
charset = "cp1252",
|
charset = "cp1252",
|
||||||
languageName = "Portugu<EFBFBD>s",
|
languageName = "Portugu<EFBFBD>s",
|
||||||
|
|
||||||
|
formatNumbers = true,
|
||||||
|
decimalSeperator = ',',
|
||||||
|
thousandsSeperator = '.',
|
||||||
|
|
||||||
-- As tradu<64><75>es devem vir sempre em ordem alfab<61>tica.
|
-- As tradu<64><75>es devem vir sempre em ordem alfab<61>tica.
|
||||||
translation = {
|
translation = {
|
||||||
["%d of experience per hour"] = "%d de experi<72>ncia por hora",
|
["%d of experience per hour"] = "%d de experi<72>ncia por hora",
|
||||||
|
@@ -5,6 +5,10 @@ locale = {
|
|||||||
charset = "cp1252",
|
charset = "cp1252",
|
||||||
languageName = "Svenska",
|
languageName = "Svenska",
|
||||||
|
|
||||||
|
formatNumbers = true,
|
||||||
|
decimalSeperator = ',',
|
||||||
|
thousandsSeperator = ' ',
|
||||||
|
|
||||||
translation = {
|
translation = {
|
||||||
["1a) Offensive Name"] = "1a) Offensivt Namn",
|
["1a) Offensive Name"] = "1a) Offensivt Namn",
|
||||||
["1b) Invalid Name Format"] = "1b) Ogiltigt Namnformat",
|
["1b) Invalid Name Format"] = "1b) Ogiltigt Namnformat",
|
||||||
|
@@ -166,16 +166,20 @@ end
|
|||||||
-- global function used to translate texts
|
-- global function used to translate texts
|
||||||
function _G.tr(text, ...)
|
function _G.tr(text, ...)
|
||||||
if currentLocale then
|
if currentLocale then
|
||||||
if tonumber(text) then
|
if tonumber(text) and currentLocale.formatNumbers then
|
||||||
-- todo: use locale information to calculate this. also detect floating numbers
|
local number = tostring(text):split('.')
|
||||||
local out = ''
|
local out = ''
|
||||||
local number = tostring(text):reverse()
|
local reverseNumber = number[1]:reverse()
|
||||||
for i=1,#number do
|
for i=1,#reverseNumber do
|
||||||
out = out .. number:sub(i, i)
|
out = out .. reverseNumber:sub(i, i)
|
||||||
if i % 3 == 0 and i ~= #number then
|
if i % 3 == 0 and i ~= #number then
|
||||||
out = out .. ','
|
out = out .. currentLocale.thousandsSeperator
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if number[2] then
|
||||||
|
out = number[2] .. currentLocale.decimalSeperator .. out
|
||||||
|
end
|
||||||
return out:reverse()
|
return out:reverse()
|
||||||
elseif tostring(text) then
|
elseif tostring(text) then
|
||||||
local translation = currentLocale.translation[text]
|
local translation = currentLocale.translation[text]
|
||||||
|
Reference in New Issue
Block a user