1

我正在使用角度翻译插件:https ://github.com/angular-translate

我想使用cookiestorage。使用存储首选项时

$translateProvider.useCookieStorage();

我看到创建了一个新 cookie 并命名为:ng_translate_lang_key。

我可以更改 cookie 名称吗?我怎样才能做到这一点?

4

2 回答 2

3

有一种方法$translateProvider.storagePrefix()可以用于此。

于 2014-03-12T11:23:04.660 回答
3

这应该在最新版本中工作,

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');
于 2015-06-27T20:53:53.907 回答