ngx-translate / core

The internationalization (i18n) library for Angular
MIT License
4.53k stars 579 forks source link

ngx-translate .instant returns key instead of value on Edge Browser #1081

Open harshjain17 opened 5 years ago

harshjain17 commented 5 years ago

Hi Team,

I am facing this problem only on edge browser.

I tried both method - instant() and get() but getting the same result in edge. For chrome and firefox, it is working as expected.

Intermittently (rarely), I can see the translated string but 90% of the time i am getting key instead of value.

cristianmartinez commented 5 years ago

Hey @harshjain17, can you please share some code to understand the way you are using the lib api?

harshjain17 commented 5 years ago

@cristianmartinez soory for delayed reply,

Actually I am using ngx-translate module to translate the given string to particular language.

In app-module.ts

TranslateModule.forRoot({ loader: { provide: TranslateLoader, useFactory: HttpLoaderFactory, deps: [Http] } }), I have import and load the translate services.

I am using below code to translate the string in the ts (typescript) files this.translate.instant('buildTransfer.select')

I have defined the same key value in en.json. Which is perfectly working in Chrome and Firefox.

But for Microsoft Edge latest version i am facing this issue.

Regards, Harsh Jain

jesussanzdev commented 4 years ago

@harshjain17 Any updates on this issue? I have the same problem :(

kevin192291 commented 3 years ago

This issue occurs on Firefox as well. Instant works just fine in Chrome. I haven't tested any others. Update 1: Putting a breakpoint in ngx-translate-core.js located inside of Node Modules on line 994 and stepping through the code results in getting the correct value. Removing the breakpoint or closing dev tools results in the error occurring again. Update 2: It seems to be an issue with how I am loading the translations from a file. this.translations isn't being populated until slightly after the lookup happens. I am going to just use: await this.translate.stream('fields.delete').pipe(first()).toPromise(); as I don't have time to look into it anymore. If anyone could fix this, that would be awesome, I really hate my fix.

BharathMKulkarni commented 4 months ago

This issue still persists on Microsoft Edge. Any updates on this? :((