noroman / trans
simple translations
Installs: 993
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/noroman/trans
Requires
- symfony/yaml: ^3.3
Requires (Dev)
- phpunit/phpunit: ^6.2
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!'));