contao-community-alliance/translator
Multipurpose translation manager and interface
Maintainers
Package info
github.com/contao-community-alliance/translator
Type:contao-bundle
pkg:composer/contao-community-alliance/translator
Requires
- php: ^8.4
- contao-community-alliance/events-contao-bindings: ^5.7
- contao/core-bundle: ^5.7
- symfony/config: ^6.3 || ^7.4
- symfony/dependency-injection: ^6.3 || ^7.4
- symfony/event-dispatcher: ^6.3 || ^7.4
- symfony/event-dispatcher-contracts: ^2.0 || ^3.0
- symfony/http-kernel: ^6.3 || ^7.4
- symfony/translation: ^6.3 || ^7.4
- symfony/translation-contracts: ^2.3 || ^3.0
Requires (Dev)
- contao/manager-bundle: ^5.7
- phpcq/runner-bootstrap: ^1.0@dev
Suggests
None
Provides
None
Conflicts
None
Replaces
None
LGPL-3.0-or-later f47c8c0466b31e00292b7c0e554dff3f22745692
- Christian Schiffler <c.schiffler.woop@cyberspectrum.de>
- Stefan Heimes <stefan_heimes.woop@hotmail.com>
This package is auto-updated.
Last update: 2026-06-29 08:35:06 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.
