PHP-I18n is a simple I18N and L10n library.
PHP-I18n uses Composer as dependency management tool.
$ composer install
Create a folder called config/locales
at your app/module, and put your locale YAML files there.
(an example of valid YAML file can found in the source). Then call I18n::t
, in one of the ways below.
$translated = I18n::t('example_message');
$translated = I18n::t('example_message', [], 'pt_BR');
$translated = I18n::t('hello_message', ['user' => 'Bob']); // 'Hello Bob'
Note about formatting currently the library does not apply formatting to arguments.
Create a section 'l10n' on your locale file and follow the source standards.
$value = I18n::l(true); // 'verdadeiro'
$value = I18n::l(123.45); // '123,45'
$ ./bin/phpunit
Fork, write tests, code, submit pull request. Coverage must remains at 100%.
PHP the right way Fixing PHP errors automatically PHP SPL Exceptions What exception subclasses are buit in