boctulus / simplerest-i18n
Gettext-style translation catalogs and language detection for SimpleRest
Requires
- php: >=8.1,<8.5
- boctulus/simplerest: ^2.0 || ^3.0
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
boctulus/simplerest-i18n contains the gettext-style translation support used
by SimpleRest applications: .po parsing, translation-domain handling, and
language detection. Locale catalogs remain application data under the host
application's app/Locale/ directory.
The package keeps the existing class names:
Boctulus\Simplerest\Core\Libs\i18n\TranslateBoctulus\Simplerest\Core\Libs\i18n\POParserBoctulus\Simplerest\Core\Libs\LangDetector
It also autoloads the existing global setLang() and trans() helpers.
use Boctulus\Simplerest\Core\Libs\i18n\Translate; Translate::bind('messages'); echo trans('Welcome');
Translate uses SimpleRest core services for filesystem access, logging, and
application configuration. AlternativeGetTextTranslator also requires the
host application to provide the PHPTAL_TranslationService interface before
that class is loaded.