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"];
await Airship.locale.setLocaleOverride("de");
Airship.locale.setLocaleOverride("de");
Airship.locale.setLocaleOverride("de")
await 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];
await Airship.locale.clearLocaleOverride();
Airship.locale.clearLocaleOverride();
Airship.locale.clearLocaleOverride();
await 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;
const locale = await Airship.locale.getCurrentLocale();
var locale = await Airship.locale.locale;
debugPrint("Locale: $locale");
Airship.locale.getCurrentLocale((locale) => {
    console.log('Current locale: ', locale);
});
const locale = await Airship.locale.getLocale()
// Not supported
// Not supported
var locale = Airship.locale
// Not supported