Constructor
new LocaleOverride()
Properties:
Name | Type | Description |
---|---|---|
country |
string
|
overrides the locale country |
language |
string
|
overrides the locale language |
Example
UA.then(function(sdk) {
// set language to "fr"
sdk.localeOverride.setLanguage('fr')
})
UA.then(function(sdk) {
// reset the override
sdk.localeOverride.setLanguage(null)
})
Methods
clear() → {Promise.<void>}
clears the locale override
Returns:
- Type:
-
Promise.<void>
Example
UA.then(function(sdk) {
sdk.localeOverride.clear()
})
set(locale) → {Promise.<void>}
Override the whole locale
Parameters:
Name | Type | Description |
---|---|---|
locale |
object
|
key(s) to set/update |
Returns:
- Type:
-
Promise.<void>
Example
UA.then(function(sdk) {
// override both country and language
sdk.localeOverride.set({country :'FR', language :'fr'})
// override country and reset language
sdk.localeOverride.set({country :'FR', language: null})
})
setCountry() → {Promise.<void>}
Overrides the locale country. If null
is passed, the override is reset.
Returns:
- Type:
-
Promise.<void>
The call is successful if the promise resolves
Example
UA.then(function(sdk) {
// set country to FR
sdk.localeOverride.setCountry('FR')
})
UA.then(function(sdk) {
// reset the country override
sdk.localeOverride.setCountry(null)
})
setLanguage() → {Promise.<void>}
Overrides the locale language. If null
is passed, the override is reset.
Returns:
- Type:
-
Promise.<void>
Example
UA.then(function(sdk) {
sdk.localeOverride.setLanguage('fr')
})
UA.then(function(sdk) {
// reset the language override
sdk.localeOverride.setLanguage(null)
})