Translations not loaded on first start
See original GitHub issueCurrent behavior
I use ngx-translate in an Ionic 4 app. When I deploy the app to a device on the first start the translations are not loaded. If I exit the app and restart it, everthing works fine.
Expected behavior
Translations are loaded on first start of the app.
Minimal reproduction of the problem with instructions
- Build the Ionic app with initialization of ngx-translate as in the docs
- Deploy app to a device (Android or iOS)
- Start the app
Environment
ngx-translate version: 12.1.1
Angular version: 8.2.14
In my app.component.ts I initialize ngx-translate as described in the docs:
constructor(public translate: TranslateService) {
this.translate.setDefaultLang('de');
this.translate.use('de').subscribe(
next => { console.log('Initialized translations') }
);
}
It seems that the use() method does not work correctly on the first start. The output inside the subscribe does not appear on the first start, but one the second.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
Angular ngx-translate, does not translate first time
Angular ngx-translate, does not translate first time · Clean all browser cache at "all time" · Use the Edge browser · Uninstall and...
Read more >How to load translations when the application starts
Learn how to make sure ngx-translate translation files are loaded when the application starts.
Read more >Configuring ngx-translate to load at startup in Angular
The problem is that ngx-translate lazyloads translations. It doesn't matter when you need to translate a message or a component, but when you ......
Read more >Work with translation files
To change the name of the source language file generated by the extraction tool, use the --out-file command option. extract-i18n --out-file examplelink.
Read more >Making Your App Ready for Translations
If a translation is not available in the user's language, ... First, follow the instructions in the “Adding additional routes” tutorial to add...
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
@fortunella I can reproduce this issue in a non-Ionic environment. Using
@angular/core
and@ngx-translate/core 13.0.0
.Occurs mostly on initial page load. Translations load after reloading window, I guess because *.js bundles are already in cache.
Any updates here ?