ICU Message Format Basics

Learn the fundamentals of ICU MessageFormat syntax including simple arguments, type formatting, and the role of ICU in internationalization. Essential reference for getting started.

Fundamentals

Detailed Explanation

What Is ICU MessageFormat?

ICU MessageFormat is a syntax standard defined by the International Components for Unicode (ICU) project for creating translatable, locale-aware strings in software applications. It is the most widely adopted message formatting standard in the i18n ecosystem, supported by libraries across every major programming language and framework.

Core Syntax

The simplest ICU message is plain text with variable placeholders enclosed in curly braces:

Hello, {name}! You have {count} new messages.

Variables can optionally specify a type and a style:

{variable}                    -> simple replacement
{variable, type}              -> typed formatting
{variable, type, style}       -> typed formatting with style

Supported Types

Type Purpose Example
number Locale-aware number formatting {price, number, currency}
date Date formatting {today, date, long}
time Time formatting {now, time, short}
plural Plural category selection {count, plural, one {# item} other {# items}}
select Arbitrary category selection {gender, select, male {He} other {They}}
selectordinal Ordinal number selection {pos, selectordinal, one {#st} other {#th}}

Why ICU Over String Concatenation?

String concatenation ("You have " + count + " items") breaks in languages with different word orders (e.g., Japanese puts the verb at the end). ICU MessageFormat keeps the entire sentence as a single translatable unit, letting translators rearrange the sentence structure while keeping variable placeholders intact.

Adoption

ICU MessageFormat is used in production by React (react-intl / FormatJS), Angular (built-in i18n), Vue (vue-i18n), Java (java.text.MessageFormat), PHP (intl extension), and many other platforms. Learning this syntax is a transferable skill across the entire i18n landscape.

Use Case

Developers starting with internationalization who need to understand the fundamental syntax before writing their first translatable messages in any framework.

Try It — ICU Message Format Tester

Open full tool