contao-community-alliance / translator
Multipurpose translation manager and interface
Package info
github.com/contao-community-alliance/translator
Type:contao-bundle
pkg:composer/contao-community-alliance/translator
2.5.1
2025-02-25 06:51 UTC
Requires
- php: ^8.2
- contao-community-alliance/events-contao-bindings: ^5.0
- contao/core-bundle: ^5.3
- symfony/config: ^6.3
- symfony/dependency-injection: ^6.3
- symfony/event-dispatcher: ^6.3
- symfony/event-dispatcher-contracts: ^2.0 || ^3.0
- symfony/http-kernel: ^6.3
- symfony/translation: ^6.3
- symfony/translation-contracts: ^2.3 || ^3.0
Requires (Dev)
- contao/manager-bundle: ^5.3
- phpcq/runner-bootstrap: ^1.0@dev
- dev-master
- dev-release/2.6.0 / 2.6.x-dev
- dev-release/2.5.0 / 2.5.x-dev
- 2.5.1
- 2.5.0
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.0
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.0.1
- 1.0
- dev-hotfix/change_versions
- dev-feature/symonfy-7
- dev-support/2.4.x
- dev-support/2.2.x
- dev-support/2.1.x
- dev-support/2.0.x
This package is auto-updated.
Last update: 2026-03-09 17:31:45 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.