Localization

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

The Airship SDK provides localization for interactive notification buttons and the Message Center for the following languages: English, Chinese (Traditional), Chinese (Simplified), German, Hungarian, Slovak, Russian, Portuguese (Portugal), Portuguese (Brazil), French, Danish, Turkish, Norwegian, Romanian, Polish, Finnish, Dutch, Hindi, Spanish (Latin American), Spanish (Spain), Hebrew, Czech, Italian, Vietnamese, Thai, Japanese, Arabic, Korean, Malay, Indonesian, and Swedish.

To add translations for another language, copy the english strings.xml to the appropriate language resource folder. Translate it to the new language and the new language resource will be merged automatically. For more information, please see the Android documentation on resource merging and localization.

Overriding locale

Airship uses the user’s LocaleThe combination of a language and country. A user’s locale is determined by their device settings. 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. Note: Airship UI localization uses the device’s current locale, so it is not affected by the override.

Overriding the locale
UAirship.shared().setLocaleOverride(new Locale("de"));
UAirship.shared().setLocaleOverride(Locale("de"));
Clearing the locale override
UAirship.shared().setLocaleOverride(null);
UAirship.shared().setLocaleOverride(null);
Getting the locale currently used by Airship
Locale airshipLocale = UAirship.shared().getLocale();
val airshipLocale = UAirship.shared().locale;