noroman/trans

This package is abandoned and no longer maintained. No replacement package was suggested.

simple translations

v0.1.0 2017-07-05 06:32 UTC

This package is auto-updated.

Last update: 2020-01-28 20:25:36 UTC


README

<?php
require_once __DIR__ . '/vendor/autoload.php'

$locale = 'ru';
// throw exceptions [optional] default: false
$strict = true;
$trans = new Trans([path-to-dir-dictionaries], $locale, $strict);

print_r($trans->get('Hello, World!'));

/**
 * Exception: not found dictionary
 * $trans->setLocale('de');
 * $trans->get('Hello, World!')
 */

// silent mode
$locale = 'de';
$trans = new Trans([path-to-dir-dictionaries], $locale);
// output: Hello, World!
print_r($trans->get('Hello, World!'));