$translateProvider.preferredLanguage and cordova globalisation


I need to load a static file based on the system language to achieve that I do use angular-translate and Cordova globalization but as it’s known navigator.globalization.getPreferredLanguage must be called inside ionic.Platform.ready which imply that the language doesn’t imply :dizzy_face: (normal I think !).

Code :

.config(['$translateProvider', function ($translateProvider) {

    // configures staticFilesLoader
      prefix: 'translations/locale-',
      suffix: '.json'

    ionic.Platform.ready(function () {
        function (language) {

          preferredlanguage = language.value;
          // load 'en' table on startup
        function ($translateProvider) {
          preferredlanguage = 'fr-FR';
          // load 'en' table on startup