You are here

public function Translator::addResource in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/translation/Translator.php \Symfony\Component\Translation\Translator::addResource()

Adds a Resource.

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

vendor/symfony/translation/Translator.php, line 121

Class

Translator
Translator.

Namespace

Symfony\Component\Translation

Code

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]);
  }
}