PHP code example of designs2 / translator
1. Go to this page and download the library: Download designs2/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/ */
designs2 / 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');