Search code examples
meteorangular-translate

Angular translate, Using staticFilesLoader not working


I'm trying to localize my app with angular translate.

here are my modules :

angular.module('myapp', [
'angular-meteor',
'ui.router',
'ngMaterial',
'ngMessages',
'ngAnimate',
'ngCookies',
    'pascalprecht.translate'
]);

Then my config :

angular.module('myapp').config(['$translateProvider', function ($translateProvider) {

  $translateProvider.useStaticFilesLoader({
        prefix: 'client/lib/translation/',
        suffix: '.json'
    });

        $translateProvider.preferredLanguage('en-US');
    }]);

my en-US.json file content :

{
  "TITLE" : "hello"
}

And I'm testing it with this html :

    <h1> {{"TITLE" | translate}}</h1>

I tested it with a table in a variable and it works well, the issue seems to be that my .json is not found or ignore, because it display

TITLE

instead of

hello


Solution

  • Actually I found the issue, I had to put my locales files in the public folder. So this is fixed.