MessageFormat 2

A full featured localization system, from Unicode.

MessageFormat 2 is a Unicode standard for localizable dynamic message strings, designed to make it simple to create natural sounding localized messages.

Free form interpolation

MessageFormat 2 messages can contain variables, which are replaced with values at runtime.

Variables can be moved around in the message freely, allowing translations even to languages where sentence structure doesn't match the source.

a replacement variable
Your name is {$name}.
let name = "Alice"
Hello Alice

Safe markup

Markup tags can be included in messages, allowing safe rich text formatting in translations.

MessageFormat 2 doesn't assign meaning to markup, giving full control over it's meaning and rendering to the developer.

inline markup
This is {#bold}important{/bold}.
This is important.

Number and date formatting

MessageFormat 2 makes it simple to format numbers, dates, and times in a locale-appropriate way within messages.

time formatting function
It is  {$timestamp :time}.
It is 10:41:03.

Pluralization

MessageFormat 2 supports pluralization, allowing messages to adapt to the number of items, even in languages with complex plural rules.

Pluralization rules from ECMA-402's Intl.PluralRules are used to match the correct plural form.

.input {$count :number}
.match $count
0   {{ No items. }}
one {{ 1 item. }}
*   {{ {$count} items. }}
let count = 3
3 items.

...and that is just the beginning!

Custom formatters and selectors

MessageFormat 2 allows developers to define custom functions to handle complex formatting and matcher needs.

An industry standard

MessageFormat 2 is developed at Unicode, and is built directly into ICU4C, ICU4J, and soon, ECMA-402 (JavaScript's internationalization library).

Intuitive for translators

MessageFormat 2 messages are designed to be easy to translate, with clear markers for variables and formatting, requiring minimal training.

what are you waiting for?