question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Translations not loaded on first start

See original GitHub issue

Current 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

  1. Build the Ionic app with initialization of ngx-translate as in the docs
  2. Deploy app to a device (Android or iOS)
  3. 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.

Maybe its related to #1162 or #1175

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

2reactions
blumkcommented, Aug 30, 2020

@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.

0reactions
ajlifcommented, May 12, 2022

Any updates here ?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found