Multi-language Support¶
The Mobile SDK provides multi-language support from version 8.4.0 onwards.
Multi-language support is limited to the static content/texts displayed on the map widget. All the dynamic content like site, building and level titles, POIs, Geofences, etc. are not yet supported.
Current supported languages:
- Arabic (available with IOS & Android SDK v8.11+)
- Chinese (Simplified)
- Chinese (Traditional)
- English (US)
- English (UK)
- French
- German
- Greek
- Hindi
- Portuguese
- Spanish
- Turkish
English (US) | Chinese (Simplified) |
---|---|
SDK automatic language selection¶
The SDK automatically uses the language set on the phone. If the phone’s language is not supported, it uses English (US)
by default. Therefore, there is no coding required to activate this feature.
How to manually override the language on the SDK¶
As explained in the previous section, the SDK automatically chooses language based on device’s settings. However, we also allow developers to override this behavior. The language can manually be set in 2 different ways:
- When starting the SDK
- After the SDK is running
Set the language when starting the SDK (iOS only)¶
let params = PTRParams()
params.environment = .QA
params.preferredLanguage = "en_GB"
Pointr.shared.start(with: params) { (state) in }
Set the language after the SDK is running¶
Pointr.shared.userManager?.preferredLanguage = "de"
Pointr.getPointr()?.userManager?.setPreferredLanguage(languageCode, true)
It is required to reinitialize a new PTRMapWidget(ViewController/Fragment) instance, for changes to take effect.
Language Code¶
Language codes can be formed by three components:
- language code (mandatory)
- script code (optional)
- country code (optional)
Example for Chinese (Traditional):
CODE = zh-Hant_CN
- language: zh (Chinese)
- script: Hant (Traditional)
- country: CN (China Mainland)
Do I need to pass the entire code?¶
Script and country codes are optional, which means you can set only zh
as preferreed language and it will use Chinese (Simplified).
You can also set language + script
or language + country
, like zh-Hant
or zh_CN
.
Our SDK looks for all possible combinations in case the set language is not fully supported. Example:
- Language is set to
zh-Hant_CN
- SDK does not support the exact match
- SDK looks for
language + script (zh-Hans)
- SDK looks for
language + country (zh_CN)
- SDK looks for
language (zh)
The SDK will use the first supported combination. If there is no supported language found, the SDK switches back to default which is English (US)
.
Codes for supported languages¶
- Arabic:
ar
- Chinese (Simplified):
zh-Hans
- Chinese (Traditional):
zh-Hant
- English (US):
en_US
- English (UK):
en_GB
- French:
fr
- German:
de
- Greek:
el
- Hindi:
hi
- Spanish:
es
- Portuguese:
pt
- Turkish:
tr
For more information about language codes you can consult https://www.iso.org/iso-639-language-codes.html