Skip to content

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}}
  1. 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.
  2. Each language gets its own forms. Russian has one, few, many and other; Japanese only other. The translator lays the message out for the target language, so every form gets its own text.
  3. 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.
  4. 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.
  5. The message is assembled back in its shortest form and formatted — or written into a file.

The pieces ​

You needPackage
The translator itselficu-i18n-translator
StorageDoctrine DBAL, Laravel, or your own repositories (seven small interfaces)
Providerslanguage models, Claude, DeepL, Google Cloud, Azure, Amazon, LibreTranslate, or your own TranslatorInterface — see Translation providers
A frameworkLaravel, Symfony, CodeIgniter, Yii, WordPress
Translation files kept in stepsync: any layout, any format
File formatsJSON, PHP arrays, YAML, PO, XLIFF, String Catalogs, Android — see Choosing a format
Another message syntaxLaravel :name and a|b

Every package has its own repository, version and readme; the package pages of this site are those readmes.