Angular Translate not working on device


#1

Hi!
I try to use Angular translate for ionic app. And I have some strange situation.

I have .config with $translateProvider where I use async loader:
.config([’$translateProvider’, function($translateProvider) {
var current_lang;

if (navigator.language === "pt-PT" || navigator.language === "pt-BR") {
  current_lang = "pt";
}
else {
  current_lang = "en";
};

$translateProvider.preferredLanguage(current_lang);
$translateProvider.useLoader('asyncLoader');
$translateProvider.useSanitizeValueStrategy('escaped');

}])

And .factory below. Where I use web service to get json whith languge:

.factory(‘asyncLoader’, [’$q’, ‘$timeout’, ‘WebServices’, ‘$rootScope’, ‘$state’, function($q, $timeout, WebServices, $rootScope, $state) {
return function(options) {

var current_lang = options.key,
	language_file_obj,
	deferred = $q.defer();

WebServices.get_language_file(current_lang).then(function(language_file){
             alert("test");
	deferred.resolve(language_file);
});


return deferred.promise;

};
}])

And its works on device with ionic serve or ionic upload or phonegap serve. BUT when I try to build APK and try to run it on android it’s not working. I don’t have entering in web service. Alert don’t shows.

Thanks!


#2

Sorry, already decided.
The problem was in the config file settings.
Everything works.
Thanks