phellow/gettext

Gettext translator for intl and some other useful gettext stuff

1.0.1 2014-12-31 15:24 UTC

This package is auto-updated.

Last update: 2024-10-08 22:12:47 UTC


README

Add the following dependency to your project's composer.json file:

{
    "require": {
        "phellow/gettext": "1.*"
    }
}

Usage

To translate texts via gettext, you have to set the translator first:

$translator = new \Phellow\Gettext\GettextTranslator('path/to/locales', 'gettextDomain');

$intl = new \Phellow\Intl\IntlService('en_US');
$intl->setTranslator($translator);

$text = $intl->_('translate this');
$text = $intl->_n('one', 'more', 2);

License

The MIT license.