Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top