When trying to format a valid ICU message
'Your open ticket count is {n, number}'
jquery/globalize throw an exception: fmt is not defined(…)
The message is compiled without an error with globalize-compiler but fail at runtime.
Using jquery/globalize 1.0.0 & 1.1.1
Issue similar to : github.com/jquery/globalize/issues/563
Changing the jquery/globalize ... globalize/message.js source file (adding the word customFormatters) removes the error... but changing a third party source file is not acceptable in the project.
Globalize.messageFormatter =
Globalize.prototype.messageFormatter = function( path, customFormatters ) {
...
formatter = new MessageFormat( cldr.locale, pluralGenerator, customFormatters ).compile( message )
The below npm package also handles the message formatting as expected.
https://www.npmjs.com/package/format-message
(I have PM'ed Rafael of jquery/globalize and he requested I post the question here)
The questions:
Has anyone else come across this and what was your workaround?
Is anyone using jquery/globalize for the base number/date/unit/etc formatters and another library like 'format-message' for message formatting?
The projects it will be used for are nodejs and browser based (spa). Would switching to Intl and a polyfill be a valid alternative. (Safari support is required http://caniuse.com/#search=intl )
Is there a test to evaluate the performance cost of adding 'customFormatters' to the source via a PR.