I want to implement some mechanism to automatically selecting UI language for my Cordova application. The application is also served from the web (i.e. browser).
From what I see, I can either use the Cordova globalization API plugin (here) or, it seems that both Android and iOS support navigator.language which give the device language.
Is there any reason I should opt to use the Cordova plugin over the built in browser/Web View property?
Thanks!
After a series of searches and tests on real devices I can say that the two methods to retrieve the language of the device are more or less the same except for two small differences:
italianbut as regionUSA. In this situation, the plugin will return the stringit-USdifferently by thenavigator.languageproperty which will return the stringit-IT(tested on iOS 11). If you have to know just the language this isn’t a big problem.navigator.languageis not immediately updated. The new setting is available only after the application is killed. The plugin does not suffer os this bug. A workaround could be to use thenavigator.languagesproperty which is correctly updated (tested on Android 5.0.2).If you have to know just the language you can use the information provided by
navigatorobject without any problem.