2021-05-13 1116次浏览

First release of translator package was published. This package allows translating messages into several languages. It can work with both Yii-based applications and standalone PHP applications.

Translations in the code looks like the following:

// single translation
$messageIdentificator = 'submit';
echo $translator->translate($messageIdentificator);
// output: `Submit message`

// translation with plural
$messageIdentificator = 'multiHumans';
echo $translator->translate($messageIdentificator, ['n' => 3]);
// output: `3 humans

Mutliple messages sources and formatters were released as well:

Additional packages that are pretty stable but not released yet are database message source and console command for extracting message IDs from the source code.