- TODO: change function BAirboss:setATC() to fit the usage of RadioManager.RegisterChannel(to request channel, handover the call sign and delete/update/release old channel.)
56 lines
1.4 KiB
Lua
56 lines
1.4 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",
|
|
['Raion Info: '] = 'Raion Info: ',
|
|
['GCI'] = 'GCI',
|
|
['Tanker'] = 'Refuling tanker',
|
|
['JTAC'] = 'JTAC',
|
|
['Carrier'] = 'Carrier',
|
|
},
|
|
|
|
--中文
|
|
["cn"] = {
|
|
["ERROR: Carrier unit %s is not found in mission."] = "错误: 在任务中没有找到航母单位 %s .",
|
|
["world"] = "世界",
|
|
["welcome"] = "欢迎",
|
|
['Raion Info: '] = "无线电信息: ",
|
|
['GCI'] = 'GCI',
|
|
['Tanker'] = '空中加油机',
|
|
['JTAC'] = 'JTAC',
|
|
['Carrier'] = '航母',
|
|
}
|
|
}
|
|
|
|
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 |