$translatePartialLoader.addPart causing multiple loads of each part
See original GitHub issueI have a load of child modules within the app, each of which has its own translation bundle. when the module is loaded, it loads its translation bundle.
The problem i has is that when i load more than one module at a time, each module calls add part, the $translate.refresh call, loads the bundles more than once.
Example code (somewhat simplified!):
$rootScope.$on('$translatePartialLoaderStructureChanged',function () {
$translate.refresh();
});
to add the parts:
function loadModule(module){
$ocLazyLoad.load(module).then(function(){
$translatePartialLoader.addPart(module);
});
}
var modules = ['m1','m2','m3'];
angular.forEach(modules, function(module){
loadModule(module);
});
The pattern of loads is:
m1,m1,m2,m1,m2,m3
It looks like the subsequent refreshes, aren’t aware that the module file has already been requested, so requests it again.
Issue Analytics
- State:
- Created 8 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
angular-translate-loader-partial not loading {parts} outside of ...
If I try to use $translatePartialLoader.addPart(resource) on the initial load in a resource service, the "part" being loaded won't translate ...
Read more >jhipster/generator-jhipster - Gitter
When I remove this line: $translatePartialLoader.addPart(''); Everything works well. This would be expected behavior or is it a bug?
Read more >Internationalize Your AngularJS App - Toptal
angular-translate is an AngularJS module that provides filters and directives, along with the ability to load i18n data asynchronously.
Read more >Angularjs – How to best organize translation strings in angular ...
I am breaking the project into multiple modules to make it more manageable, ... Using angular-translate, is there a way to load strings...
Read more >Plato - service/loader-partial.js - Angular Translate
All parts you add by using this provider would be loaded by ... $log.warn('The partial loader has detected a multiple structure change (with ......
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
pour résoudre ce problème il faut lors de la config du module d’ajouter cette ligne $translateProvider.useLoaderCache(true);
@dmitry-dedukhin I would imagine
$http
was not part of AngularJS at this time, but this is speculating. Also I’m not sure how it will deal with refreshing content.So: Yes, you would build it with other existing tooling nowadays probably. But this is old cold base…