{"action":"created","issue":{"url":"https://api.github.com/repos/angular-translate/angular-translate/issues/1415","repository_url":"https://api.github.com/repos/angular-translate/angular-translate","labels_url":"https://api.github.com/repos/angular-translate/angular-translate/issues/1415/labels{/name}","comments_url":"https://api.github.com/repos/angular-translate/angular-translate/issues/1415/comments","events_url":"https://api.github.com/repos/angular-translate/angular-translate/issues/1415/events","html_url":"https://github.com/angular-translate/angular-translate/issues/1415","id":136119054,"number":1415,"title":"fallbackLanguage broken after upgrade to 2.9","user":{"login":"sebek64","id":2472821,"avatar_url":"https://avatars.githubusercontent.com/u/2472821?v=3","gravatar_id":"","url":"https://api.github.com/users/sebek64","html_url":"https://github.com/sebek64","followers_url":"https://api.github.com/users/sebek64/followers","following_url":"https://api.github.com/users/sebek64/following{/other_user}","gists_url":"https://api.github.com/users/sebek64/gists{/gist_id}","starred_url":"https://api.github.com/users/sebek64/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebek64/subscriptions","organizations_url":"https://api.github.com/users/sebek64/orgs","repos_url":"https://api.github.com/users/sebek64/repos","events_url":"https://api.github.com/users/sebek64/events{/privacy}","received_events_url":"https://api.github.com/users/sebek64/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular-translate/angular-translate/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/angular-translate/angular-translate/labels/Contribution%20Welcome","name":"Contribution Welcome","color":"c7def8"},{"url":"https://api.github.com/repos/angular-translate/angular-translate/labels/Needs%20analysis","name":"Needs analysis","color":"eb6420"},{"url":"https://api.github.com/repos/angular-translate/angular-translate/labels/needs-tests","name":"needs-tests","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"knalli","id":65389,"avatar_url":"https://avatars.githubusercontent.com/u/65389?v=3","gravatar_id":"","url":"https://api.github.com/users/knalli","html_url":"https://github.com/knalli","followers_url":"https://api.github.com/users/knalli/followers","following_url":"https://api.github.com/users/knalli/following{/other_user}","gists_url":"https://api.github.com/users/knalli/gists{/gist_id}","starred_url":"https://api.github.com/users/knalli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knalli/subscriptions","organizations_url":"https://api.github.com/users/knalli/orgs","repos_url":"https://api.github.com/users/knalli/repos","events_url":"https://api.github.com/users/knalli/events{/privacy}","received_events_url":"https://api.github.com/users/knalli/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/angular-translate/angular-translate/milestones/27","html_url":"https://github.com/angular-translate/angular-translate/milestones/2.9.3","labels_url":"https://api.github.com/repos/angular-translate/angular-translate/milestones/27/labels","id":1539477,"number":27,"title":"2.9.3","description":"","creator":{"login":"knalli","id":65389,"avatar_url":"https://avatars.githubusercontent.com/u/65389?v=3","gravatar_id":"","url":"https://api.github.com/users/knalli","html_url":"https://github.com/knalli","followers_url":"https://api.github.com/users/knalli/followers","following_url":"https://api.github.com/users/knalli/following{/other_user}","gists_url":"https://api.github.com/users/knalli/gists{/gist_id}","starred_url":"https://api.github.com/users/knalli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knalli/subscriptions","organizations_url":"https://api.github.com/users/knalli/orgs","repos_url":"https://api.github.com/users/knalli/repos","events_url":"https://api.github.com/users/knalli/events{/privacy}","received_events_url":"https://api.github.com/users/knalli/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":0,"state":"open","created_at":"2016-01-24T18:30:51Z","updated_at":"2016-02-24T18:27:25Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2016-02-24T16:50:50Z","updated_at":"2016-02-25T08:20:51Z","closed_at":null,"body":"### Subject of the issue\r\nAfter upgrading from angular 1.4 to 1.5 and angular-translate from 2.8 to 2.9, language switching to \"fallbackLanguage\" stopped working.\r\n\r\n### Your environment\r\n* version of angular-translate: 2.9.2\r\n* version of angular: 1.5.0\r\n* which browser and its version: Firefox, Chrome\r\n\r\n### Steps to reproduce\r\n\r\nIn our application, language switching stopped working in a strange way. Switching among all languages works, but we cannot switch to 'en'. After some investigation, we found that dropping\r\n\r\n$translateProvider.fallbackLanguage('en');\r\n\r\nfixes the switching problems. Here is a part of our code:\r\n\r\n    .config(function ($translateProvider) {\r\n      $translateProvider.useLocalStorage();\r\n      $translateProvider.useSanitizeValueStrategy('sanitizeParameters');\r\n      $translateProvider.useMessageFormatInterpolation();\r\n      $translateProvider.preferredLanguage('en');\r\n      $translateProvider.fallbackLanguage('en');\r\n      $translateProvider.uniformLanguageTag('bcp47');\r\n      $translateProvider.determinePreferredLanguage();\r\n      $translateProvider.registerAvailableLanguageKeys(['en', 'cs', 'pl'], {\r\n        // en\r\n        'en-AU': 'en', 'en-BZ': 'en', 'en-CA': 'en', 'en-CB': 'en', 'en-GB': 'en', 'en-IE': 'en', 'en-JM': 'en',\r\n        'en-NZ': 'en', 'en-PH': 'en', 'en-TT': 'en', 'en-US': 'en', 'en-ZA': 'en', 'en-ZW': 'en',\r\n        // cs\r\n        'cs-CZ': 'cs',\r\n        //pl\r\n        'pl-PL': 'pl'\r\n      });\r\n\r\n      $translateProvider.useLoader('$translatePartialLoader', {\r\n        urlTemplate: 'modules/{part}/{lang}.json',\r\n        loadFailureHandler: 'SITranslationErrorHandler'\r\n      });\r\n      $translateProvider.useLoaderCache(true);\r\n    })\r\n\r\n    .run(function ($rootScope, $stateParams, $translate, $translatePartialLoader){\r\n      $rootScope.$on('$stateChangeSuccess', function () {\r\n        if ($stateParams.lang !== undefined){\r\n          $rootScope.activeLang = $stateParams.lang;\r\n          $translate.use($stateParams.lang);\r\n          $translatePartialLoader.addPart('translation');\r\n          $translate.refresh();\r\n        }\r\n      });\r\n    });\r\n\r\nAnother way how to fix switching (but without dropping fallback language) is to move fallback language to .run() block:\r\n\r\n$translate.fallbackLanguage('en');\r\n\r\nand change useLocalStorage to useCookieStorage. Just one of these changes was not sufficient.\r\n\r\n### Expected behaviour\r\nLanguage switching should be working - language should be switched.\r\n\r\n### Actual behaviour\r\nLanguage switching is working except that switch to \"fallbackLanguage\" is ignored.\r\n"},"comment":{"url":"https://api.github.com/repos/angular-translate/angular-translate/issues/comments/188666309","html_url":"https://github.com/angular-translate/angular-translate/issues/1415#issuecomment-188666309","issue_url":"https://api.github.com/repos/angular-translate/angular-translate/issues/1415","id":188666309,"user":{"login":"tspaeth","id":5180973,"avatar_url":"https://avatars.githubusercontent.com/u/5180973?v=3","gravatar_id":"","url":"https://api.github.com/users/tspaeth","html_url":"https://github.com/tspaeth","followers_url":"https://api.github.com/users/tspaeth/followers","following_url":"https://api.github.com/users/tspaeth/following{/other_user}","gists_url":"https://api.github.com/users/tspaeth/gists{/gist_id}","starred_url":"https://api.github.com/users/tspaeth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tspaeth/subscriptions","organizations_url":"https://api.github.com/users/tspaeth/orgs","repos_url":"https://api.github.com/users/tspaeth/repos","events_url":"https://api.github.com/users/tspaeth/events{/privacy}","received_events_url":"https://api.github.com/users/tspaeth/received_events","type":"User","site_admin":false},"created_at":"2016-02-25T08:20:51Z","updated_at":"2016-02-25T08:20:51Z","body":"I'd try to have a look, but won't manage it before the weekend."}}