public function Translator::addResource in Plug 7
Adds a Resource.
@api
Parameters
string $format The name of the loader (@see addLoader()):
mixed $resource The resource name:
string $locale The locale:
string $domain The domain:
Throws
\InvalidArgumentException If the locale contains invalid characters
File
- lib/
Symfony/ translation/ Translator.php, line 129
Class
- Translator
- Translator.
Namespace
Symfony\Component\TranslationCode
public function addResource($format, $resource, $locale, $domain = null) {
if (null === $domain) {
$domain = 'messages';
}
$this
->assertValidLocale($locale);
$this->resources[$locale][] = array(
$format,
$resource,
$domain,
);
if (in_array($locale, $this->fallbackLocales)) {
$this->catalogues = array();
}
else {
unset($this->catalogues[$locale]);
}
}