我正在使用角度翻译插件:https ://github.com/angular-translate
我想使用cookiestorage。使用存储首选项时
$translateProvider.useCookieStorage();
我看到创建了一个新 cookie 并命名为:ng_translate_lang_key。
我可以更改 cookie 名称吗?我怎样才能做到这一点?
我正在使用角度翻译插件:https ://github.com/angular-translate
我想使用cookiestorage。使用存储首选项时
$translateProvider.useCookieStorage();
我看到创建了一个新 cookie 并命名为:ng_translate_lang_key。
我可以更改 cookie 名称吗?我怎样才能做到这一点?
有一种方法$translateProvider.storagePrefix()
可以用于此。
这应该在最新版本中工作,
storagePrefix :为 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');