Pluralizations
Our translation system supports pluralized messages using a simplified, ICU-compatible syntax. We use #
to represent the numeric value, and automatically convert plural rules when exporting to other formats.
Each language has different plural categories, we automatically detect the plural rules based on the language selected for the translation. For example, English has one
and other
, while Russian has one
, few
, many
, and other
. This is crucial for languages that have complex pluralization rules.
✏️ Variable syntax
Example syntax how our system expects plurals to be defined:
- One
You have one new message.
- Other
You have # new messages.
#
is the placeholder replaced with the actual number.
Note: you can also use {{count}}
or any other syntax, but we recommend using #
for consistency across formats.
📤 Export Formats
Plural forms are automatically mapped to the appropriate syntax for each file format:
Format | Example Mapping |
---|---|
ICU | Keeps the # as variable. Returns the format{count, plural, one {...} other {...}} . |
Gettext (.po) | Will convert # to %d . Uses msgstr with array indicators like msgstr[0] etc. to indicate plural forms. |
JSON (object) | Will convert the # to {count} . Also returns as object, like "my_key":{"one":"One message","other":"{count} messages"} . |
JSON (i18n) | Will convert the # to {{count}} . Also key suffixes like _one , _other . |
YAML | Will convert the # to {{count}} |
Apple strings | Will convert the # to %d |
Apple xcstrings | Will convert the # to {count} |
PHP Laravel | Will convert the # to :count |
Java Properties | Will convert the # to {0} or {1} etc. if there are multiple variables present |
🧠 Best Practices
- Always include an
other
form. - Test plural logic in your app for each supported language.
- Use the
#
placeholder for consistency and let it be converted automatically when exporting.