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

Not working with messageformat ^2.0.0 #22

Closed elekdavid closed 6 years ago

elekdavid commented 6 years ago

I tried the following setup

messageformat: 2.0.1
ngx-translate-messageformat-compiler: 3.0.0

Got following error at bootstrap time

ERROR TypeError: (intermediate value).setBiDiSupport(...).setIntlSupport is not a function
    at new TranslateMessageFormatCompiler (translate-message-format-compiler.js:33)
    at _createClass (core.js:10891)
    at _createProviderInstance$1 (core.js:10865)
    at resolveNgModuleDep (core.js:10850)
    at _createClass (core.js:10899)
    at _createProviderInstance$1 (core.js:10865)
    at resolveNgModuleDep (core.js:10850)
    at NgModuleRef_.get (core.js:12087)
    at resolveDep (core.js:12577)

Possible solution #setIntlSupport() function has been removed from messageformat at v2.0.0 (see release notes), but in TranslateMessageFormatCompiler this function is called in ln20

rafa-suagu commented 6 years ago

Same here!

legvalmont commented 6 years ago

I've solved this issue on v3.0.1 by installing messageformat 1.x.x as a dependency of my own project. The following command is the one I issued:

$ npm install messageformat@1 --save

@lephyrus can I suggest you include a dependency change for messageformat (forcing 1.x.x) in a future 3.0.2? Because in the end I believe that ngx-translate-messageformat-compiler 3.0.1 pulls the latest messageformat. And that breaks us angular 5- users.

lephyrus commented 6 years ago

@legvalmont This library does not pull in any version of messageformat. It is specified as a "peer dependency", which means you have to install a compatible version yourself. For v3 of this library, you have to install v1 of messageformat, so you've done the right thing. NPM should have showed you a warning when you combined ngx-translate-messageformat-compiler v3 with messageformat v1.