PHP code example of coldume / translated-exception
1. Go to this page and download the library: Download coldume/translated-exception 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/ */
coldume / translated-exception example snippets
use TranslatedException\TranslatedException;
$options = [
'locale' => 'fr',
'cache_dir' => __DIR__.'/foo',
'debug' => true,
];
TranslatedException::init($options);
TranslatedException::addResourceDir(__DIR__.'/bar');
try {
throw new TranslatedException('foo', 'hello.%name%', ['%name%' => 'foo']);
} catch (TranslatedException $e) {
echo $e->getMessage();
}