How to speed up the translate service in ionic 2


#1

this is my code

import {TranslateService} from '@ngx-translate/core';

export class MyApp {

public translate: any;

 constructor(translate: TranslateService)
{
this.translate = translate;
      translate.addLangs(["en", "ar"]);
      LogDetails.language = translate.getBrowserLang();
      console.log("setting language", LogDetails.language);
      translate.setDefaultLang(LogDetails.language);
}

My language translate is working only after the 30 seconds of app start,
How to resolve this issue ?


How to avoid timeout in Translate service
#2

How does it take 30 seconds? Do you see the English version first, then the correct language? Or what is happening?


#3
translate.use(LogDetails.language);

is missing


#4

No. it takes exactly 30sec to apply the language in HTML page


#5

my default language is depend on the device,
when i change the language it takes 30secs to apply the changes in page


#6

Did you remote debug the problem on the device already?
Follow these instructions here to debug the problem in Safari dev tools:
https://ionic.zone/debug/remote-debug-your-app#ios
Follow these instructions here to debug the problem in Chrome dev tools:
https://ionic.zone/debug/remote-debug-your-app#android
Look at the console and network tabs for errors and what is happening during these 30 seconds.