Download the PHP package phpnomad/symfony-translation-integration without Composer
On this page you can find all versions of the php package phpnomad/symfony-translation-integration. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpnomad/symfony-translation-integration
More information about phpnomad/symfony-translation-integration
Files in phpnomad/symfony-translation-integration
Package symfony-translation-integration
Short Description PHPNomad Symfony translation strategy implementation
License MIT
Homepage https://github.com/phpnomad/symfony-translation-integration
Informations about the package symfony-translation-integration
phpnomad/symfony-translation-integration
Integrates the Symfony Translation component with PHPNomad's phpnomad/translate abstraction. It supplies a single TranslationStrategy implementation backed by Symfony's TranslatorInterface, so applications that call the PHPNomad translation API can resolve strings through a configured Symfony translator without changing any call sites.
Installation
What This Provides
PHPNomad\Symfony\Translation\Strategies\TranslationStrategy, a concrete implementation ofPHPNomad\Translations\Interfaces\TranslationStrategythat delegatestranslate()andtranslatePlural()calls to Symfony'sTranslatorInterface::trans().- Disambiguation context is encoded using gettext's
msgctxtconvention (the\x04EOT separator), so catalogues loaded from gettext.po/.mofiles resolve contextual strings correctly. - Pluralization uses Symfony's
%count%parameter convention, which lines up with Symfony's ICU and legacy plural format loaders.
Requirements
phpnomad/translate^2.0, which defines theTranslationStrategyinterface along with theHasTextDomainandHasLanguageproviderssymfony/translation-contracts^2.5 or ^3.0, which definesTranslatorInterface- A configured Symfony translator with your catalogues loaded (the full
symfony/translationpackage or any implementation ofTranslatorInterface)
Usage
Bind the concrete strategy to the interface inside your PHPNomad bootstrapper. The strategy takes three constructor dependencies: the Symfony translator, a HasTextDomain provider that returns the active text domain, and a HasLanguage provider that returns the target locale (or null to fall back to the translator's default).
Once bound, any code that resolves TranslationStrategy from the container will route through Symfony.
Documentation
- PHPNomad docs: phpnomad.com
- Symfony Translation component: symfony.com/doc/current/translation.html
License
MIT. See LICENSE.