I’m working on localizing my game into several different languages, among them Simplified Chinese and Traditional Chinese.
Using sys.get_sys_info()
I can get the language, device language and territory. Regardless of whether my device is in simplified or traditional Chinese both sys.get_sys_info().language
and sys.get_sys_info().device_language
return simply "zh"
.
I can choose between them based on the current territory:
local info = sys.get_sys_info()
// ... other languages
elseif info.device_language == "zh" then
if info.territory == "TW" or info.territory == "HK" then
// Traditional Chinese
else
// Simplified Chinese
end
end
But then if I’m outside of Taiwan or Hong Kong, even if my device is set to Traditional Chinese the app will default to Simplified Chinese; conversely if I’m in Taiwan or Hong Kong and my device is set to Simplified Chinese it will default to Traditional Chinese.
Is there no way to differentiate between the two? I was expecting to be able to get a language code such as “zh-CN”, “zh-TW” or “zh-HK” based solely on the device’s settings, not it’s location.