Menu
Sites
Language
What is the change language listener (localization)?

When a user changes languages on their phone the language on the Gear S3 is changed as well. What is the change language listener (localization)? 
Gear S3, Tizen 2.3.2

Edited on 04 05, 2019

Responses

1 Replies
Armaan-Ul- Islam

You can use Web SystemInfo API to achieve your desired functionality. Add a property Value change listener for the systeInfo property "LOCALE". Please check the API references for details implementation.

https://developer.tizen.org/development/api-references/web-application?redirect=https://developer.tizen.org/dev-guide/3.0.0/org.tizen.web.apireference/html/device_api/mobile/tizen/systeminfo.html#SystemInfoLocale

https://developer.tizen.org/development/api-references/web-application?redirect=https://developer.tizen.org/dev-guide/3.0.0/org.tizen.web.apireference/html/device_api/mobile/tizen/systeminfo.html#SystemInfo::addPropertyValueChangeListener

 

The code should be something similar like this:

function onSuccessCallback(locale)
{
   console.log("Current language: " + locale.language);
   console.log("Current country: " + locale.country);
}

tizen.systeminfo.addPropertyValueChangeListener("LOCALE", onSuccessCallback);