Overview
The ICU i18n translator is a PHP library for applications written in one language and translated by machine — by language models, translation services, or both — with people checking and correcting where it matters.
How it works
A message is ICU MessageFormat:
{count, plural, one {# item} other {# items}}- The message is split into variants. The translator parses it and takes every plain sentence it can show:
{count} item,{count} items. Selectors (plural,select,selectordinal) are never sent to a provider. - Each language gets its own forms. Russian has
one,few,manyandother; Japanese onlyother. The translator lays the message out for the target language, so every form gets its own text. - Providers translate, the translator checks. Arguments go to providers as numbered placeholders that must come back, once each. A provider of whole messages (a language model) may translate the message at once instead; its answer is stored only if it has the same arguments, selectors and the plural forms of the language. Whatever a provider gets wrong goes to the next one.
- Everything is stored. A text is translated once per language and reused by every message and file that has it. Who made each translation is kept: a provider's translation is a machine one until a person approves it.
- The message is assembled back in its shortest form and formatted — or written into a file.
The pieces
| You need | Package |
|---|---|
| The translator itself | icu-i18n-translator |
| Storage | Doctrine DBAL, Laravel, or your own repositories (seven small interfaces) |
| Providers | language models, Claude, DeepL, Google Cloud, Azure, Amazon, LibreTranslate, or your own TranslatorInterface — see Translation providers |
| A framework | Laravel, Symfony, CodeIgniter, Yii, WordPress |
| Translation files kept in step | sync: any layout, any format |
| File formats | JSON, PHP arrays, YAML, PO, XLIFF, String Catalogs, Android — see Choosing a format |
| Another message syntax | Laravel :name and a|b |
Every package has its own repository, version and readme; the package pages of this site are those readmes.