Files
DCS_TrainingMap_Caucasus/Scripts/Localizations.lua
T
XiaoChen 26019fe3c1 -Add mist for assist.
-Add 'Buta's_Airboss.lua' for custom Airboss functions.
-Add 'Localizations.lua' for dictionaries of other langs.
-Update MIZ file with 3 AR tankers.
2024-12-14 20:30:38 +08:00

46 lines
1.1 KiB
Lua

Localizations = {
defaultLang = 'en',
--英文
["en"] = {
["ERROR: Carrier unit %s is not found in mission."] = "ERROR: Carrier unit %s is not found in mission.",
["world"] = "World",
["welcome"] = "Welcome"
},
--中文
["zh"] = {
["ERROR: Carrier unit %s is not found in mission."] = "错误: 在任务中没有找到航母单位 %s .",
["world"] = "世界",
["welcome"] = "欢迎"
}
}
do
function Localizations:translate(text, langCode)
if not text then return end
if not langCode or type(langCode) ~= 'string' then langCode = self.defaultLang end
langCode = string.lower(langCode)
local langTable = Localizations[langCode]
local result = text
if not langTable then
local defaultLangTable = Localizations[self.defaultLang]
if defaultLangTable then
local result = defaultLangTable[text] or text
end
end
if langTable then
result = langTable[text] or text
end
return result
end
end