Symfony, CodeIgniter and Yii
The three packages are built the same way: the translation memory in your database through Doctrine DBAL, the translator in the container, a command that creates the tables and one that translates the language files with sync. What a person changed in a written file is kept; only what is missing is translated. Laravel has its own package, on Eloquent.
| Symfony | CodeIgniter 4 | Yii 3 | |
|---|---|---|---|
| Package | symfony-icu-i18n-translator | codeigniter-icu-i18n-translator | yii-icu-i18n-translator |
| Registered by | the bundle, in config/bundles.php | CodeIgniter's module discovery | yiisoft/config |
| Database | a DBAL connection of DoctrineBundle | a group of app/Config/Database.php, or a DBAL URL | a DBAL URL, else SQLite in @runtime |
| Files | translations/*+intl-icu.{locale}.yaml and .xlf | app/Language/{locale}/*.php | messages/{locale}/*.php |
| Languages | icu_i18n.locales | App::$supportedLocales | locales of the params |
| Providers | services tagged icu_i18n.provider | IcuI18n::providers() | providers of the params |
| Tables | bin/console icu-i18n:install | php spark icu-i18n:install | ./yii icu-i18n:install |
| Translate the files | bin/console icu-i18n:sync | php spark icu-i18n:sync | ./yii icu-i18n:sync |
Each command takes --source, --locale, --dry-run (which files would be written) and --show-machine (which keys a provider translated, to review them); install --dump-sql prints the statements for a migration of yours.
The files of each framework hold ICU messages already — Symfony's +intl-icu catalogs, CodeIgniter's lang(), Yii's IntlMessageFormatter — so the framework reads the written files as they are.