Localization

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

See Localization for more details.

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. The SDK can override the locale so that Airship uses a different locale than the browser’s current locale.

In the Web SDK, a locale can be set before or after creating a channel. If set, it overrides the browser’s locale information. See the Web SDK reference for the full Locale Override Object.

Setting the locale language:
UA.then(function(sdk) {
   sdk.localeOverride.setLanguage('fr')
})
Setting the locale country:
UA.then(function(sdk) {
   sdk.localeOverride.setCountry('FR')
})
Clear the locale override:
UA.then(function(sdk) {
   sdk.localeOverride.clear()
})
Setting/replacing locale:
UA.then(function(sdk) {
   sdk.localeOverride.set({language :'fr'})
   sdk.localeOverride.set({country :'FR'})
   sdk.localeOverride.set({country :'fr', language :'fr'})
})

Overrides can be reset by passing null to set(). To reset only one parameter, pass null to setCountry() or setLanguage() separatly.

Resetting locale:
UA.then(function(sdk) {
   sdk.localeOverride.setLanguage(null)
   sdk.localeOverride.setCountry(null)
   sdk.localeOverride.set({country: null, language: 'fr'})
})