示例#1
0
 /**
  * Get message from specific locale, add it into fallback locale cache (to be later exported) if
  * enabled (see TranslatorConfig) and no translations found.
  *
  * @param string $domain
  * @param string $string
  * @param string $locale
  * @return string
  */
 protected function get($domain, $string, $locale)
 {
     if ($this->getCatalogue($locale)->has($domain, $string)) {
         return $this->getCatalogue($locale)->get($domain, $string);
     } elseif ($this->fallbackCatalogue->has($domain, $string)) {
         return $this->fallbackCatalogue->get($domain, $string);
     }
     if ($this->config->autoRegistration()) {
         /*
          * Automatic message registration.
          */
         $this->fallbackCatalogue->set($domain, $string, $string);
         //Into memory
         $this->fallbackCatalogue->saveDomains();
     }
     //Unable to find translation
     return $string;
 }