Change language with $translatePartialLoader
See original GitHub issueHello,
i have a problem with loading the translations. I am using the $translatePartialLoader.
My versions: angular-translate - v2.15.2 - 2017-06-22 AngularJS v1.6.4 Google Chrome v59.0.3071.115
My problem: I am on state “profile” and have the active language “DE” now i am switching to language “EN”. Then i switch the state to “settings” and switch my language back to “DE”. Now i don’t see the my translations i only see my keys for the translations.
State change event
$rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState) {
$scope.unloadModule(event, fromState.name);
$scope.loadModule(event, toState.name);
$translate.refresh();
});
Functions for load/unload the modules
$scope.loadModule = function ($event, module) {
$event.preventDefault();
$translatePartialLoader.addPart(module);
};
$scope.unloadModule = function ($event, module) {
$event.preventDefault();
$translatePartialLoader.deletePart(module);
};
Thanks for watching for a solution.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
PartialLoader: $translate.use() and $translate.refresh() in race ...
Set up a project using the partialLoader having at least two languages (f.e. English and German). Set English as fallback language; Call $ ......
Read more >AngularJS : Setting languages in angular-translate from ...
First inject $translate into your controller. app.controller('MainCtrl', function($scope, $state, $translate) {});.
Read more >Adding translation using angular-translate to an angularjs app
Go to common/translation/translation.js , and change the default language to fr-FR. You should get a translated teams page.
Read more >Plato - service/loader-partial.js - Angular Translate
changed somehow. It could mean either some part is added or some part is deleted. Anyway when. 317. * you get this event...
Read more >Angular Language Translations (i18n) using ngx ... - YouTube
Your browser can't play this video. Learn more. Switch camera.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I think this should work
I’m not sure, looks like this is a specific issue with partial loading and language changes at all. Alternatively, don’t remove already loaded parts (depends on the number of translations).
@knalli Your workaround did the trick but still FOUC, should really resolve inside the library before it renders out any content IMO.
Not sure if I should open a new issue.