Localization

You can override the user’s default locale to utilize localization for a specific language.

The Airship SDK is localized in 48 different languages for all strings included within the SDK. The strings within the app will automatically use the device’s or app’s configured LocaleThe combination of a language and country. A user’s locale is determined by their device settings..

Airship uses the user’s locale for various locale-sensitive tasks, including selecting the language for messages and reporting for analytics. Apps can override the locale so that Airship uses a different locale than the device’s current locale for messaging.

Overriding the locale

UAirship.shared().setLocaleOverride(Locale.GERMANY)
UAirship.shared().setLocaleOverride(new Locale("de"));
Airship.localeManager.currentLocale = Locale(identifier:"de")
UAirship.localeManager.currentLocale = 
    [NSLocale localeWithLocaleIdentifier:@"de"];
Airship.locale.setLocaleOverride("de");
Airship.locale.setLocaleOverride("de");
Airship.locale.setLocaleOverride("de")
// Not supported
// Not supported
Airship.locale.currentLocale = "de"
// Not supported

Clearing the locale override

UAirship.shared().setLocaleOverride(null)
UAirship.shared().setLocaleOverride(null);
Airship.localeManager.clearLocale()
[UAirship.localeManager clearLocale];
Airship.locale.clearLocaleOverride();
Airship.locale.clearLocaleOverride();
Airship.locale.clearLocaleOverride();
// Not supported
// Not supported
Airship.locale.reset()
// Not supported

Getting the locale currently used by Airship

val airshipLocale = UAirship.shared().locale
Locale airshipLocale = UAirship.shared().getLocale();
let airshipLocale = Airship.localeManager.currentLocale
NSLocale *airshipLocale = UAirship.localeManager.currentLocale;
Airship.locale.getCurrentLocale().then((locale) => {
    console.log('Current locale: ', locale);
});
var locale = await Airship.locale.locale;
debugPrint("Locale: $locale");
Airship.locale.getCurrentLocale((locale) => {
    console.log('Current locale: ', locale);
});
// Not supported
// Not supported
var locale = Airship.locale
// Not supported