PHP code example of contao-community-alliance / translator
1. Go to this page and download the library: Download contao-community-alliance/translator library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
contao-community-alliance / translator example snippets
/** @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');