PHP code example of unicate / translation

1. Go to this page and download the library: Download unicate/translation 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/ */

    

unicate / translation example snippets




= [
    'en' => [
        'test.token1' => 'Token Text EN 1',
        'test.token2' => 'Token Text EN 2',
    ],
    'de' => [
        'test.token1' => 'Token Text DE 1',
        'test.token2' => 'Token Text DE 2',
    ],
];

$translation = new \Unicate\Logger\Translation($data);
$translation->setLang('en');
$text = $translation->translate('test.token1');
echo $text; // 'Token Text EN 1'

$translation = new \Unicate\Logger\Translation($data, 'de');
$text = $translation->translate('test.token1');
echo $text; // 'Token Text DE 1'

$data = ation = new \Unicate\Logger\Translation($data);
$translation->setLang('en');
$text = $translation->translate('test.token1');
echo $text; // 'Token Text EN 1'