user2717997
user2717997

Reputation: 47

Unknown provider: $translateStaticFilesLoaderProvider <- $translateStaticFilesLoader

I have been trying to use angular-translate with a static JSON file, usign StaticFilesLoader. However, I recieve the error: Unknown provider: $translateStaticFilesLoaderProvider <- $translateStaticFilesLoader

In the index.html file, i have included the .js files:

    <script src="js/i18n/angular-translate.js"></script>
    <script src="js/i18n/angular-translate-loader-static-files.js"></script>
    <script src="js/i18n/angular-translate-loader-static-files.min.js"></script>
    <script src="js/i18n/angular-translate.min.js"></script>

I have included the directive 'pascalprecht.translate'

And I have also included the config in the app.js file:

    Application.instance
        .config(['$translateProvider', function ($translateProvider) {
            $translateProvider.useStaticFilesLoader({
                prefix: 'i18n/',
                suffix: '.json'
            });

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

If I include the translations directly in the config, the angular-translate works fine, but it seems that the staticFilesLoader is the issue. I have replaced the angular-translate-loader-static-files.js files from github and this does not resolve the issue.

Thanks for any help.

Upvotes: 3

Views: 5321

Answers (1)

maurycy
maurycy

Reputation: 8465

You are adding angular-translate twice, minified and unminified (judging by names)

But the error you get is mostlikely caused by not injecting the module to your module

var Application = angular.module('myApplication', ['pascalprecht.translate'])

Upvotes: 4

Related Questions