I'm trying to use AngularJS translations. The problem I encountered is that I'm getting Unknown provider: $$cookieReaderProvider <- $$cookieReader <- $cookies <- $cookieStore <- $translateCookieStorage <- $translate <- $cookies
error when trying to use $translateProvider.useCookieStorage();
I've injected ngCookies
as a dependency in my app:
var nfqApp = angular.module('myApp', ['postServices', 'angularFileUpload', 'ngSanitize', 'ui.date',
'bootstrapLightbox', 'profileServices', 'ngRoute', 'angularMoment', 'pascalprecht.translate', 'ngCookies']);
I've also included following files related to translations and cookies in the following order:
My app config (where I try to use cookieStorage:
myApp.config(['$translateProvider', function ($translateProvider) {
$translateProvider.translations('lt', {
"OTHER_LIKES" : "{peopleCount, plural, one {# kolega tai mėgsta} few {# kolegos tai mėgsta} other {# kolegų tai mėgsta}}",
"YOU_AND_OTHERS_LIKES" : "{peopleCount, plural, one {Tu ir # kolega tai mėgsta} few {Tu ir # kolegos tai mėgsta} other {Tu ir # kolegų tai mėgsta}}",
"YOU_LIKE" : "Tu mėgsti tai"
});
$translateProvider.translations('en', {
"OTHER_LIKES" : "{peopleCount, plural, one {# colleague likes this} few {# colleagues likes this} other {# colleagues likes this}}",
"YOU_AND_OTHERS_LIKES" : "{peopleCount, plural, one {You and # colleague likes this} few {You and # colleagues likes this} other {You and # colleagues likes this}}",
"YOU_LIKE" : "You like this"
});
$translateProvider.preferredLanguage('lt');
$translateProvider.fallbackLanguage('en');
$translateProvider.addInterpolation('$translateMessageFormatInterpolation');
$translateProvider.useCookieStorage();
}]);
I found out that I was using angular-cookies.js designed for different version of angular. updating them both to the same version solved the problem. AngularJS v1.4.1 was used.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments