Skip to content

Developing a standard for localizable message strings

License

Notifications You must be signed in to change notification settings

ryzokuken/message-format-wg

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MessageFormat Working Group

Welcome to the home page for the MessageFormat Working Group, a subgroup of the Unicode CLDR-TC.

Charter

The Message Format Working Group (MFWG) is tasked with developing an industry standard for the representation of localizable message strings to be a successor to ICU MessageFormat. MFWG will recommend how to remove redundancies, make the syntax more usable, and support more complex features, such as gender, inflections, and speech. MFWG will also consider the integration of the new standard with programming environments, including, but not limited to, ICU, DOM, and ECMAScript, and with localization platform interchange. The output of MFWG will be a specification for the new syntax.

MessageFormat 2 Draft Syntax

The current draft syntax for defining messages can be found in spec/syntax.md. The syntax is formally described in ABNF.

Messages can be simple strings:

{Hello, world!}

Messages can interpolate arguments formatted using formatting functions:

{Today is {$date :datetime weekday=long}.}

Messages can define variants which correspond to the grammatical (or other) requirements of the language:

match {$count :number}
when 1 {You have one notification.}
when * {You have {$count} notifications.}

The message syntax is also capable of expressing more complex translation, for example:

let $hostName = {$host :person firstName=long}
let $guestName = {$guest :person firstName=long}
let $guestsOther = {$guestCount :number offset=1}

match {$host :gender} {$guestOther :number}

when female 0 {{$hostName} does not give a party.}
when female 1 {{$hostName} invites {$guestName} to her party.}
when female 2 {{$hostName} invites {$guestName} and one other person to her party.}
when female * {{$hostName} invites {$guestName} and {$guestsOther} other people to her party.}

when male 0 {{$hostName} does not give a party.}
when male 1 {{$hostName} invites {$guestName} to his party.}
when male 2 {{$hostName} invites {$guestName} and one other person to his party.}
when male * {{$hostName} invites {$guestName} and {$guestsOther} other people to his party.}

when * 0 {{$hostName} does not give a party.}
when * 1 {{$hostName} invites {$guestName} to their party.}
when * 2 {{$hostName} invites {$guestName} and one other person to their party.}
when * * {{$hostName} invites {$guestName} and {$guestsOther} other people to their party.}

See more examples and the formal definition of the grammar in spec/syntax.md.

Implementations

  • Java: com.ibm.icu.message2, part of ICU 72 released in October 2022, is a tech preview implementation of the MessageFormat 2 syntax, together with a formatting API. See the ICU User Guide for examples and a quickstart guide.
  • JavaScript: messageformat 4.0 implements the MessageFormat 2 syntax, together with a polyfill of the runtime API proposed for ECMA-402.

Sharing Feedback

We invite feedback about the current syntax draft, as well as the real-life use-cases, requirements, tooling, runtime APIs, localization workflows, and other topics.

Participation

To join in:

  1. Review CONTRIBUTING.md
  2. Apply to join our mailing list
  3. Watch this repository (use the "Watch" button in the upper right corner)

Copyright & Licenses

Copyright © 2019-2023 Unicode, Inc. Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the United States and other countries.

The project is released under LICENSE.

A CLA is required to contribute to this project - please refer to the CONTRIBUTING.md file (or start a Pull Request) for more information.

About

Developing a standard for localizable message strings

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published