Locale

Configure locale behavior and override the default locale that Airship uses.

Airship uses the LocaleThe combination of a language and country. A user’s locale is determined by their device settings. for various SDK operations. By default, the SDK automatically uses the device’s locale settings, but you can configure it to use the user’s preferred language or override it programmatically.

Overriding the locale

You can override the locale programmatically at runtime, which takes precedence over the device’s locale settings.

Overriding the locale

Airship.localeManager.setLocaleOverride(Locale.GERMANY)
Airship.getLocaleManager().setLocaleOverride(new Locale("de"));

Clearing the locale override

To remove a locale override and return to using the device’s locale settings:

Clearing the locale override

Airship.localeManager.setLocaleOverride(null)
Airship.getLocaleManager().setLocaleOverride(null);

Getting the current locale

To retrieve the locale that Airship is currently using:

Getting the current locale

val airshipLocale = Airship.localeManager.locale
Locale airshipLocale = Airship.getLocaleManager().getLocale();