0

My angular translate module having difficulties in finding the right folder structure. Following are my folder structure:

public
 -assets
    -js
    -cs
    -il8n
     -en.json
 -controllers
 -directives
 -app.js

My translate provider app config as follow:

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

    // prefix and suffix information  is required to specify a pattern
    // You can simply use the static-files loader with this pattern:
    $translateProvider.useStaticFilesLoader({
        prefix: 'assets/i18n/',
        suffix: '.json'
    });

    // Since you've now registered more then one translation table, angular-translate has to know which one to use.
    // This is where preferredLanguage(langKey) comes in.
    $translateProvider.preferredLanguage('en');

    // Store the language in the local storage
    $translateProvider.useLocalStorage();

}]);

The error I receiving:

GET http://localhost:8080/assets/i18n/en.json 404 (Not Found)

Thanks!

d3bug3r
  • 2,492
  • 3
  • 34
  • 74

1 Answers1

2

I guess everything you config about $translateProvider is correct.

By seeing your error can say that path to get that JSON file is not correct.

I guess your JSON file is located in il8n. Here the letter before 8 is l not 1(one).

By renaming your folder from il8n to i18n will resolve your problem.

Yogeshree Koyani
  • 1,649
  • 10
  • 19