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.shared.localeManager.currentLocale = Locale(identifier:"de")
UAirship.shared.localeManager.currentLocale = 
    [NSLocale localeWithLocaleIdentifier:@"de"];
UrbanAirship.setCurrentLocale("de")
// Not supported
UAirship.setCurrentLocale("de")
// Not supported
Airship.locale.currentLocale = "de"
// Not supported

Clearing the locale override

UAirship.shared().setLocaleOverride(null)
UAirship.shared().setLocaleOverride(null);
Airship.shared.localeManager.clearLocale()
[UAirship.shared.localeManager clearLocale];
UrbanAirship.clearLocale()
// Not supported
UAirship.clearLocale()
// 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.shared.localeManager.currentLocale
NSLocale *airshipLocale = UAirship.shared.localeManager.currentLocale;
UrbanAirship.getCurrentLocale().then((locale) => {
    console.log('Current locale: ', locale)
})
// Not supported
UAirship.getCurrentLocale(function(locale) {
    console.log('Current locale: ', locale)
})
// Not supported
var locale = Airship.locale
// Not supported