Вопрос

I'm using angular translate plugin: https://github.com/angular-translate

I'd like to use cookiestorage. When store the preference using

$translateProvider.useCookieStorage();

I see that a new cookie is created and is named: ng_translate_lang_key.

Can I change the cookie name? How can I do this?

Это было полезно?

Решение

there's a method $translateProvider.storagePrefix() which you can use for that.

Другие советы

This should work in latest version,

storagePrefix : Adds prefix to the storageKey

// This is the module constant.
angular.module('pascalprecht.translate').constant('$STORAGE_KEY', 'NG_TRANSLATE_LANG_KEY');

// and this is how you can change this constants in your app.config assuming that you they cookie key will be name 'locale'
$translateProvider.storageKey('locale');
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top