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

Is it possible to pass a custom default currency to the compiler? #33

Closed PhilippCh closed 2 years ago

PhilippCh commented 6 years ago

Hi there!

we'd like to specify a different default language when using this library. According to https://messageformat.github.io/messageformat/page-guide this is possible using mf.currency = 'EUR' before the first call to compile().

Since a new MessageFormat instance is created as a private member in TranslateMessageFormatCompiler, there is currently no way to specify this, right?

If there's no quick fix for it; I'd be willing to create a PR.

Cheers Philipp

lephyrus commented 6 years ago

Strange, this seems to be missing from the API documentation. Anyway, this should be fairly straight-forward to add in the same way you can already pass formatters, locales and more via MESSAGE_FORMAT_CONFIG. I'll be happy to look at your PR if you have a go!