lephyrus / ngx-translate-messageformat-compiler

Advanced pluralization (and more) for ngx-translate, using standard ICU syntax which is compiled with the help of messageformat.js.
MIT License
93 stars 30 forks source link

Since v6 not translating anymore #92

Closed danielehrhardt closed 9 months ago

danielehrhardt commented 2 years ago

image

lephyrus commented 2 years ago

Hey! Since it seems that v6 is generally working (see Example App for instance), you will need to supply much more information for anyone to be able to help you. Are you getting any errors when your app is building or at runtime? What version of the relevant libraries are you using? How did you upgrade, did you change anything else?

If you've figured it out in the meantime, feel free to close this issue.

egalley commented 2 years ago

Hey everybody,

Same problem here, in StackBliz example just add a date field, like this

"people": "{gender, select, male{He is} female{She is} other{They are}} {how} {birthday, date, long}."

and you will get an error in console.

This error is not thrown in production when using ngx-translate-core

getTranslation(lang) { this.pending = true; const loadingTranslations = this.currentLoader.getTranslation(lang).pipe(shareReplay(1), take(1)); this.loadingTranslations = loadingTranslations.pipe(map((res) => this.compiler.compileTranslations(res, lang)), shareReplay(1), take(1)); this.loadingTranslations .subscribe({ next: (res) => { this.translations[lang] = this.extend && this.translations[lang] ? { ...res, ...this.translations[lang] } : res; this.updateLangs(); this.pending = false; }, error: (err) => { this.pending = false; // THIS DOES NOT DISPLAY ERROR OF COMPILER } }); return loadingTranslations; }

lephyrus commented 2 years ago

@egalley Your problem will be solved once #96 is merged (and released). In the meantime, the workaround is to pass formatters: {} as part of the config (see README). Here is your example working in StackBlitz: https://stackblitz.com/edit/ngx-translate-messageformat-compiler-example-sen5zx