phellow / gettext
Gettext translator for intl and some other useful gettext stuff
Installs: 31
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/phellow/gettext
Requires
- phellow/intl: 1.*
This package is auto-updated.
Last update: 2025-10-09 00:31: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.