PHP code example of phyzikz / php_translation

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

    

phyzikz / php_translation example snippets



use \phyzikz\TransHandler\TransHandler as TH;
$t = new TH();

$t->parseYaml('hu'); 
echo $t->getTrans('Greetings')."<br>";

$t->parseYaml('hu');
$tArray = $t->getTransArray();          // puts translations into an array
foreach($tArray as $k => $v)            // dumping all translation
    echo $k.": ".$v."<br>";

$t->parseYaml('hu');
$tArray = $t->getTransArray();          // puts translations into an array
$tArray['cucumber'] = 'uborka';
$t->setTransArray($tArray);             // fills class variable
$t->createYaml();                       // writing out
echo "<pre>";
var_dump($trans->getTransArray());      // dumps current class var
echo "</pre>";