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 29 forks source link

Compiler throws error after Angular 6 migration #32

Closed sinedied closed 6 years ago

sinedied commented 6 years ago

I've migrated from Angular@5, @ngx-translate@9, ngx-translate-messageformat-compiler@3 and messageformat@1 to Angular@6, @ngx-translate@10, ngx-translate-messageformat-compiler@4 and messageformat@2, and translations strings that were working fine before now throws an error:

TypeError: Cannot read property 'toString' of undefined
    at _stringify (runtime.js:97)
    at _stringify (runtime.js:103)
    at Runtime.toString (runtime.js:118)
    at MessageFormat.compile (messageformat.js:343)
    at TranslateMessageFormatCompiler.compileTranslations (ngx-translate-messageformat-compiler.js:25)

This is an example string: "Send {count} bid change recommendation{count, plural, =1{} other{s}}"

I've check the messageformat docs and seems there's nothing wrong here, I've even ran their migration tool on it to be sure.

Note that if I remove the {count, plural, =1{} other{s}} part, the compiler works fine.

Might be related to https://github.com/lephyrus/ngx-translate-messageformat-compiler/issues/27

Note that reverting back to messageformat@1 make it work, so it might be something that changed in their API that's not properly supported in this compiler?

sinedied commented 6 years ago

Just saw https://github.com/lephyrus/ngx-translate-messageformat-compiler/issues/26. Any idea when https://github.com/lephyrus/ngx-translate-messageformat-compiler/pull/29 can be merged and released?