contao-community-alliance / translator
Multipurpose translation manager and interface
Installs: 115 062
Dependents: 6
Suggesters: 0
Security: 0
Stars: 2
Watchers: 8
Forks: 2
Open Issues: 1
Type:contao-bundle
Requires
- php: ^7.4 || ^8.0
- contao-community-alliance/events-contao-bindings: ^4.13
- contao/core-bundle: ^4.13
- symfony/config: ^5.4
- symfony/dependency-injection: ^5.4
- symfony/event-dispatcher: ^5.4
- symfony/event-dispatcher-contracts: ^1.1 || ^2.0
- symfony/http-kernel: ^5.4
- symfony/translation: ^5.4
Requires (Dev)
- contao-community-alliance/dependency-container: ^2.1
- contao/manager-bundle: ^4.13
- phpcq/runner-bootstrap: ^1.0@dev
Conflicts
- contao-community-alliance/dependency-container: <2.1,>=3.0
This package is auto-updated.
Last update: 2023-05-14 12:35:40 UTC
README
The Contao Community Alliance translation library allows easy use of various translation string sources.
It ships with a collection of various translation string providers:
- Static values that get populated during runtime by code (StaticTranslator).
- Adapter for Contao CMS language string arrays (LangArrayTranslator).
In addition it also provides a translator chain using which various translators can be stacked.
Usage:
It integrates into the Contao CMS providing a translator service. To use it, just get the service from the dependency container:
<?php
/** @var ContaoCommunityAlliance\Translator\TranslatorInterface */
$translator = $GLOBALS['container']['translator'];
// Get the translation of yes from the MSC domain.
$translated = $translator->translate('yes', 'MSC');
// Sub arrays known in Contao can be accessed usng the dot as separator.
$translated = $translator->translate('title.0', 'tl_content');
Known limitations:
- We have no manual so far. Bummer! :/
- We have not tested it all yet, so please give it a try yourself.