public static function setLocale($locale)
{
// Use RFC 5646 for filenames.
$resource = __DIR__ . '/Lang/' . str_replace('_', '-', $locale) . '.php';
if (!file_exists($resource)) {
static::setLocale(static::getFallbackLocale());
return;
}
// Symfony locale format.
$locale = str_replace('-', '_', $locale);
// Set locale and load translations.
static::getTranslator()->setLocale($locale);
static::getTranslator()->addResource('array', require $resource, $locale);
}