[Globalization Plugin] .... navigator.globalization === "undefined") = False!

[Globalization Plugin] .... navigator.globalization === "undefined") = False!

  
Forge Component
(3)
Published on 2017-09-04 by André Vieira
3 votes
Published on 2017-09-04 by André Vieira

Hi,


I am trying to use the Globalization plugin in a mobile application running on a Samsung Galaxy S7.

Unfortunately the check in 

CheckGlobalizationPlugin

IsPluginAvailableJS (javascipt)

if(typeof(navigator.globalization) === "undefined")

    $parameters.IsAvailable = false;
else
    $parameters.IsAvailable = true;


always returns False 

Do I have to do something to enable it in a web.config file? Or do I have to do something in Chrome?

Cordova is loaded and other plugins are working fine.

Thanks

Keith

Hi Keith,

Just checked the original cordova plugin that originated this component. I'm using version 1.0.7 and 2 new versions have been released since then. Although I see nothing that would indicate that there was a problem with Galaxy S7 or that moving the plugin to 1.0.9 you would fix that issue, the matter of fact is that the plugin has been deprecated in 1.0.9. The main reason for this is due to the better support of mobile browser for ECMA Internationalization API which makes the use of the plugin unnecessary. You can read about this in their release notes https://github.com/apache/cordova-plugin-globalization/blob/master/RELEASENOTES.md

There's also a guide to migration from the globalization plugin to the Internationalization API here https://cordova.apache.org/news/2017/11/20/migrate-from-cordova-globalization-plugin.html.

I'll probably update this plugin or create a new one to use that API but It might take some time :(

If you wish to use the plugin I would see no reason for it not to work. Just remember that being a cordova plugin you need to test it in a native build running on a mobile device.

UPDATE: According to https://caniuse.com/#feat=internationalization this API for Apple devices is only available from iOS 11 onwards. Therefore I think it still makes sense to use the plugin to cover a wider range of devices.

Cheers


Hi Andre,

I am testing it in a native build on on two different sumsung mobile devices (S7 and Alpha), and unfortunately it is not working for me on either device as CheckGlobalizationPlugin always returns false from the js IsPluginAvailableJS (javascipt) . On both devices other Cordova functions are working as expected and the check for Cordova loaded returns True.

That's why I was wondering if there was some kind of phone setting enabling Globalization, otherwise why check it?

Its a mystery?

Anyway thanks.


Keith