I am following this tutorial in ng-newsletter to apply i18n to my application using Angular-Translate. The application works fine when I include translations in the app.js file, but it's hard for me to get StaticFilesLoader to work. This is my app.js file with commented working code -
angular.module('myApp',
[
'ngCookies',
'ngRoute',
'ngResource',
'pascalprecht.translate',
'myApp.services',
'myApp.directives',
'myApp.controllers',
]);
angular.module('myApp.services', ['ngResource']);
angular.module('myApp.directives', []);
angular.module('myApp.controllers', []);
angular.module('myApp')
.config(['$httpProvider', '$translateProvider', function($httpProvider, $translateProvider) {
$httpProvider.defaults.useXDomain = true;
$httpProvider.defaults.withCredentials = true;
delete $httpProvider.defaults.headers.common['X-Requested-With'];
console.log($httpProvider.defaults);
/*$translateProvider.translations('en', {
HEADLINE: 'This is my home page',
HOME: 'Home',
SETTINGS: 'Settings',
LOGOUT: 'Log Out',
EDIT: 'Edit' ,
DELETE: 'Delete' ,
PASSWORD: 'Password' ,
CONFIRM_PASSWORD: 'Confirm Password' ,
BUTTON_TEXT_EN: 'english',
BUTTON_TEXT_DE: 'german'
})
.translations('de', {
HEADLINE: 'Dies ist der Homepage',
HOME: 'Zuhause',
SETTINGS: 'Einstellungen',
LOGOUT: 'Ausloggen',
EDIT: 'Bearbeiten' ,
DELETE: 'Löschen' ,
PASSWORD: 'Passwort' ,
CONFIRM_PASSWORD: 'Passwort Bestätigen' ,
BUTTON_TEXT_EN: 'englisch',
BUTTON_TEXT_DE: 'deutsch'
}); */
$translateProvider.preferredLanguage('en');
$translateProvider.useStaticFilesLoader({
prefix: '/languages/',
suffix: '.json'
});
}]);
I added two files to my application, en.json and de.json and a folder called / languages. When I try to start the application, I get an error message:
Uncaught Error: [$injector:unpr] Unknown provider: $translateStaticFilesLoaderProvider <- $translateStaticFilesLoader
How to declare it as a dependency? I thought this was part of pascalprecht.translate.