I was trying to get a user locale as:
info = sys.get_sys_info() locale = info.language or info.device_language
On html5 this worked correctly and was returning 2-symbols locale by operating system language: “en”, “ru”, etc.
But on iOS (tested on iPhone7 and iPhoneXR) it always returns “en”, even when I’ve changed device language to Italian and removed all mentions of EN language in settings.
So, info.language returns something strange.
Going deeper, I figured out, that info.device_language returns string in such format - “it-RU” or “en-PL” (when language is it/en and region is RU/PL), so I can get the correct locale from it, BUT it looks different from what described in the docs: https://www.defold.com/ref/sys/#sys.get_sys_info
string Two character ISO-639 format (i.e. “sr”) and, if applicable, followed by a dash (-) and an ISO 15924 script code (i.e. “sr-Cyrl” or “sr-Latn”). Reflects the device preferred language.
But here we see two-characters formatted region which does not look like “ISO 15924”
- for Chinese, Simplified device_language = zh-Hans-RU,
- for Chinese, Traditional device_language = zh-Hant-RU
- for Chinese, Traditional (Hong Kong) device_language = zh-Hant-HK
- for Portuguese (Brasil) device_language = pt-BR
Where territory was set to Russia in all cases