A JavaScript string formatting library inspired by Java's MessageFormat class, supporting placeholder substitution ({0}, {1}), date/time formatting with patterns, and localization for 7 locales (English, French, German, Chinese, Russian, Arabic, Japanese). Current stable version is 1.0.4, last updated in 2018 with no recent releases. It offers a simple API similar to Java's MessageFormat but is limited to basic numeric placeholders and predefined locale patterns. Alternatives like Intl.MessageFormat or format-message provide more modern i18n capabilities with ICU syntax and better browser support.
npm install msg-formatNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic placeholder substitution, date formatting, and localized format with French locale.
If using TypeScript, declare module 'msg-format' with interface or use // @ts-ignore.
Check if your target locale is in MessageLocale before using. If not, consider an alternative like Intl.DateTimeFormat.
Evaluate migration to actively maintained alternatives like intl-messageformat or format-message.
Use MessageFormat.formatWithLocale(text, locale, ...args) instead of passing locale to format().
Use const { MessageFormat } = require('msg-format');Add const { MessageFormat } = require('msg-format'); at the top of the file.Use only the predefined styles: short, medium, long, full, or EEEE for day-of-week. Refer to documentation for supported patterns.
No dependency data recorded yet.