Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

angular-translate, issue with static loader (file loader)

Tags:

angularjs

I'm working with angular-tranlate.

I got it working with the $translateProvider.translations('en', en_translations); where en_translations is the json with the mapping.

Now I'm having a problem when trying to use static files:

    $translateProvider.preferredLanguage('en');

$translateProvider.useStaticFilesLoader({
    prefix: 'locale-',
    suffix: '.json'
});

I'm receiving this error:

    Error: Unknown provider: $translateStaticFilesLoaderProvider <- $translateStaticFilesLoader

throw Error("Unknown provider: " + path.join(' <- '));

I have my locale-en.json file in the same location as the scrips file. and it looks like this:

{
            "WELCOME": "Welcome",
            "LANG": {
                    "LABEL": "Language",
                    "EN": "English",
                    "ES": "Spanish"
                },
            "LOGOFF": "Log Off",
            "PROFILE": "Profile"
}

Any ideas?? thanks!!

like image 648
pepepapa82 Avatar asked Dec 12 '13 19:12

pepepapa82


1 Answers

you need to add the static files loader js to your index file. you can find it here

just put this in index.html

<script src="js/libs/angular/angular-translate-loader-static-files.min.js"></script>
like image 145
Edd Avatar answered Oct 06 '22 08:10

Edd