polyglot / translator
PHP Polyglot translator
Fund package maintenance!
Other
v1.0.0
2023-09-08 20:07 UTC
Requires
- php: ^7.4 || ^8.0
- ext-mbstring: *
- polyglot/contract-template-provider: ^1.0
- polyglot/contract-template-resolver: ^1.0
- polyglot/contract-translator: ^1.0
Requires (Dev)
- phpunit/phpunit: ^6.5 || ^7.5 || 8.5 || 9.5
- polyglot/template-provider-memory: ^1.0
- polyglot/template-resolver-simple: ^1.0
- squizlabs/php_codesniffer: ^3.7
This package is not auto-updated.
Last update: 2024-11-17 00:24:22 UTC
README
A polyglot translator.
Install
composer require polyglot/translator:^1.0
Using
<?php /** * @var \Polyglot\Contract\TemplateProvider\TemplateProvider $templateProvider * @var \Polyglot\Contract\TemplateResolver\TemplateResolver $templateResolver */ $polyglot = new \Polyglot\Translator\Polyglot('en_US', $templateProvider, $templateResolver); $french = $polyglot->trans('translation_id', [], 'domain', 'fr_FR'); $default = $polyglot->trans('translation_id', [], 'domain');