You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the i18n-node with MessageFormat, you're unable to add custom formatters to MessageFormat by using the static MessageFormat object. The example below illustrates adding a custom formatter to the static MessageFormat object.
MessageFormat.formatters.moment = function () {
return function (value, locale, arg) {
return moment(value).format(arg);
};
};
The issue is caused by i18n-node packaging its own version of MessageFormat, which results in i18n-node having a different static MessageFormat object than all the other NPM modules. This because all the other NPM modules that depend on MessageFormat are looking at the top-level MessageFormat installation.
The MessageFormat lib that i18n-node requires:
APP_ROOT/node_modules/i18n/node_modules/messageformat
The MessageFormat lib that all the other modules require:
APP_ROOT/node_modules/messageformat
I tested deleting APP_ROOT/node_modules/i18n/node_modules/messageformat
and that works great -- now you can add custom formatters to the static MessageFormat object.
Should i18n-node stop packaging its own version of MessageFormat?
The text was updated successfully, but these errors were encountered:
When using the i18n-node with MessageFormat, you're unable to add custom formatters to MessageFormat by using the static MessageFormat object. The example below illustrates adding a custom formatter to the static MessageFormat object.
The issue is caused by i18n-node packaging its own version of MessageFormat, which results in i18n-node having a different static MessageFormat object than all the other NPM modules. This because all the other NPM modules that depend on MessageFormat are looking at the top-level MessageFormat installation.
The MessageFormat lib that i18n-node requires:
APP_ROOT/node_modules/i18n/node_modules/messageformat
The MessageFormat lib that all the other modules require:
APP_ROOT/node_modules/messageformat
I tested deleting APP_ROOT/node_modules/i18n/node_modules/messageformat
and that works great -- now you can add custom formatters to the static MessageFormat object.
Should i18n-node stop packaging its own version of MessageFormat?
The text was updated successfully, but these errors were encountered: