{"action":"created","issue":{"url":"https://api.github.com/repos/angular-translate/angular-translate/issues/1074","labels_url":"https://api.github.com/repos/angular-translate/angular-translate/issues/1074/labels{/name}","comments_url":"https://api.github.com/repos/angular-translate/angular-translate/issues/1074/comments","events_url":"https://api.github.com/repos/angular-translate/angular-translate/issues/1074/events","html_url":"https://github.com/angular-translate/angular-translate/issues/1074","id":86919665,"number":1074,"title":"Is there any to update locale without executing translate","user":{"login":"ChrisFan","id":897640,"avatar_url":"https://avatars.githubusercontent.com/u/897640?v=3","gravatar_id":"","url":"https://api.github.com/users/ChrisFan","html_url":"https://github.com/ChrisFan","followers_url":"https://api.github.com/users/ChrisFan/followers","following_url":"https://api.github.com/users/ChrisFan/following{/other_user}","gists_url":"https://api.github.com/users/ChrisFan/gists{/gist_id}","starred_url":"https://api.github.com/users/ChrisFan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChrisFan/subscriptions","organizations_url":"https://api.github.com/users/ChrisFan/orgs","repos_url":"https://api.github.com/users/ChrisFan/repos","events_url":"https://api.github.com/users/ChrisFan/events{/privacy}","received_events_url":"https://api.github.com/users/ChrisFan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular-translate/angular-translate/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-10T10:30:22Z","updated_at":"2015-06-15T14:57:05Z","closed_at":null,"body":"1. I have a language select directive on the page\r\n2. I'd like select a language and refresh the page\r\n\r\nHere is my code:\r\n```javascript\r\n  // app.config\r\n  $translateProvider.useMissingTranslationHandlerLog();\r\n  $translateProvider.useStaticFilesLoader({\r\n      prefix: 'resources/locale-',                      // path to translations files\r\n      suffix: '.json'                                   // suffix, currently- extension of the translations\r\n  });\r\n\r\n  $translateProvider.registerAvailableLanguageKeys(\r\n      ['zh_CN', 'en_US'],\r\n      {\r\n          'en*': 'en_US',\r\n          'zh*': 'zh_CN',\r\n          '*'  : 'en_US'\r\n      }\r\n  );\r\n  $translateProvider.fallbackLanguage('en_US');\r\n  $translateProvider.determinePreferredLanguage();\r\n  $translateProvider.useLocalStorage();\r\n\r\n  tmhDynamicLocaleProvider.localeLocationPattern('bower_components/angular-i18n/angular-locale_{{locale}}.js');\r\n```\r\n\r\n```javascript\r\n// on language selected\r\nthis.changeLanguage = function(locale) {\r\n  ...\r\n  $translate.use(locale).then(function() {\r\n    // refresh current state(ui-router)\r\n    $state.transitionTo($state.current, $stateParams, { reload: true });\r\n  })\r\n}\r\n```\r\n\r\n* What happens is all the text get translated first and then the page get refreshed. This is not good for user experience.\r\n* Since `$state.transitionTo` doesn't reboot the angular app, I can't just update the 'storage' and do the transition\r\n\r\n> btw, I'd like to reload the page because I have to fetch all the data from backend by language\r\n\r\nAny ideas for this?\r\n\r\nThanks a lot."},"comment":{"url":"https://api.github.com/repos/angular-translate/angular-translate/issues/comments/112097116","html_url":"https://github.com/angular-translate/angular-translate/issues/1074#issuecomment-112097116","issue_url":"https://api.github.com/repos/angular-translate/angular-translate/issues/1074","id":112097116,"user":{"login":"ChrisFan","id":897640,"avatar_url":"https://avatars.githubusercontent.com/u/897640?v=3","gravatar_id":"","url":"https://api.github.com/users/ChrisFan","html_url":"https://github.com/ChrisFan","followers_url":"https://api.github.com/users/ChrisFan/followers","following_url":"https://api.github.com/users/ChrisFan/following{/other_user}","gists_url":"https://api.github.com/users/ChrisFan/gists{/gist_id}","starred_url":"https://api.github.com/users/ChrisFan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChrisFan/subscriptions","organizations_url":"https://api.github.com/users/ChrisFan/orgs","repos_url":"https://api.github.com/users/ChrisFan/repos","events_url":"https://api.github.com/users/ChrisFan/events{/privacy}","received_events_url":"https://api.github.com/users/ChrisFan/received_events","type":"User","site_admin":false},"created_at":"2015-06-15T14:57:05Z","updated_at":"2015-06-15T14:57:05Z","body":"Well, as you mentioned, yes, in my code I first change the locale texts and then go for a transition...\r\nThat's just because I didn't find a better solution.\r\n\r\nI'm wondering if there's something like this.\r\n```\r\nthis.changeLanguage = function(locale) {\r\n  ...\r\n  $translate.set(locale); // something like this, only set locale, and it would take effect after the transition\r\n  $state.transitionTo($state.current, $stateParams, { reload: true });\r\n}\r\n```\r\n\r\nI'd tried to update the localStorge, but it only work after I refresh the page."}}