包详细信息

messageformat-parser

messageformat1.4mMIT4.1.3

A PEG.js parser for ICU MessageFormat strings

icu, messageformat, parser

自述文件

Build Status

messageformat

The experience and subtlety of your program's text can be important. Messageformat is a mechanism for handling both pluralization and gender in your applications. It can also lead to much better translations, as it's designed to support all the languages included in the Unicode CLDR.

This monorepo consists of the following packages that make up our JS implementation of ICU MessageFormat:

Getting Started

npm install --save-dev messageformat@next
npm install --save messageformat-runtime

This includes the MessageFormat compiler and a runtime accessor class that provides a slightly nicer API for working with larger numbers of messages. Our Format Guide will help with the ICU MessageFormat Syntax, and the Usage Guide provides some options for integrating messageformat to be a part of your workflow around UI texts and translations.


Messageformat is an OpenJS Foundation project, and we follow its Code of Conduct.

OpenJS Foundation

更新日志

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

4.1.3 (2020-04-12)

Note: Version bump only for package messageformat-parser

4.1.2 (2019-07-17)

Bug Fixes

4.1.1 (2019-05-02)

Bug Fixes

  • Update dependencies (11fd29b)
  • parser: Allow non-lowercase custom formatter names, as long as they do not mask plural/select/selectordinal (a38b181), closes #230

4.1.0 (2019-03-03)

Bug Fixes

  • parser: Use a stack of values for inPlural (Fixes #226) (71b8400)

Features

  • Harmonise code style with Prettier & add linting with ESLint (#220) (18bc474)
  • parser: Annotate rules for better errors (cc010ac), closes #215

4.0.0 (2018-12-05)

The changes included in this release are documented in PR #8:

  • Allow MessageFormat content in function parameters
  • Replace strictNumberSign option with broader strict

3.0.0 (2018-04-04)

  • To conform with the ICU MessageFormat standard, escaping with a \ is no longer supported (so e.g. the strings \{ and \u0123 are now passed through without changes). Instead, use 'quotes' to escape, e.g. '{braces}'. To help deal with this change, we provide a codemod to handle the change for you.
  • The optional parameter passed to a function is now a string, rather than an array of strings. So with e.g. {var, func, your param}, the parameter passed to func would be ' your param', including the leading space. As a consequence, we've also dropped the strictFunctionParams option.

2.0.0 (2017-11-18)

  • Closer conformance with the ICU MessageFormat spec with respect to quoting and escaping text (#3) and whitespace (#6), thanks to @nkovacs.

1.1.0 (2017-07-18)

  • Add support for strictFunctionParams, thanks to @nkovacs.

1.0.0 (2016-09-02)