Navigator.globalization is undefined - ngCordova


I’m trying to use cordova globalization plugin via ngCordova. I’ve already followed all steps in about installing and seting up the ngCordova even followed the common issues guide to double check.

Testing to see if it works I made a call to $cordovaGlobalization.getLocaleName() method and even wrapping it up in a $ionicPlatform.ready(function() the console prompts navigator.globalization is undefined and a plethora of errors.

$ionicPlatform.ready(function() {
            function (result) {
              $scope.locale = result.value;
            function (error) {
              $scope.locale = err.message;

I’m pretty stuck here and haven’t found a solution to this, hope you guys can help me.


Reading cordova globalization docs I’ve noticed somehow the plugin installation is not working properly because they say:

This plugin defines global navigator.globalization object.

Which is the error I’m getting, any clue?


I have the same problem. I amb writting an application and I want to know what Language is being used by the mobile user to offer internationalization translations. Any idea about it ?


Does plugin list in console shows the globalization plugin listed?


xavier$ cordova plugin list 0.3.5 "Camera"
org.apache.cordova.globalization 0.3.4 “Globalization”

if I write in the code, console.log(typeof navigator.globalization) I get


Insteado f $ionicPlatform.ready, can you try ondeviceready event of cordova?


Hi @Purusothaman

It’s been a long time since I found this issue and because there was no help by the time, the project continued without globalization.

However, this is a spec we need. I’ll be setting again the plugin and update you as soon as I got the error or try what you suggest.

Until then,


I have the code inside $ionicPlatform.ready. This is my peace of code where I have the problem (typeof navigator.globalization=undefined):

.run(function($ionicPlatform, $cordovaStatusbar,$cordovaGlobalization) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    console.log('abans de cordovaGlobalization');
    console.log($cordovaGlobalization+' '+typeof navigator.globalization);

    if(window.cordova && window.cordova.plugins.Keyboard) {
    if(typeof navigator.globalization !== "undefined") {
      alert ('hola titu');

                $cordovaGlobalization.getPreferredLanguage(function(language) {
                    $translate.use((language.value).split("-")[0]).then(function(data) {
                        console.log("SUCCESS -> " + data);
                    }, function(error) {
                        console.log("ERROR -> " + error);
                }, null);
    if(window.StatusBar) {



Maybe having your code inside inside $ionicPlatform.ready does not make sure that Cordova is ready,
just that IONIC UI is.
Try putting your code inside :

document.addEventListener(“deviceready”, function () {
$cordovaPlugin.someFunction().then(success, error);
}, false);

Also, you can see what is happening by using Chrome DevTools. You will be able to see if navigator is still null (what I suspect)
Hope this helps.


EDIT: Sorry, just saw that your problem is the undefined plugin.

If I’m seeing correct you are using a callback function.

In the documentation they are using a promise instead of a callback function. Did you try to change this?

Good luck with your app. I am using the plugin myself (within crosswalk) but use it directly without ngCordova.


Same here. Completely unable to use globalization plugin.


I struggled a bit with this plugin,until I tried to inspect the app with Chrome (app is android), and it actually worked.

For what I now understand, it seems the plugin only does its work on the actual device, so I’ll need to monitor the device itself. ngCordovas plugins It will always fail while developing, as they are targeting the device’s capabilities, not the browser’s.

Besides making sense, this warning is also at the page. Hope it helps.