Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null)
 {
     $possibleIds = $this->getPossibleIds($id);
     foreach ($possibleIds as $possibleId) {
         $translation = $this->translator->transChoice($possibleId, $number, $parameters, $domain, $locale);
         if ($translation !== $possibleId) {
             return $translation;
         }
     }
     return $id;
 }
 /**
  * @param string $id
  * @param int    $number
  * @param array  $parameters
  * @param null   $domain
  * @param null   $locale
  * @return string
  */
 public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null)
 {
     $ret = $this->translator->transChoice($id, $number, $parameters, $domain, $locale);
     if ($this->remember) {
         $this->rememberCache[$id] = array('parameters' => $parameters, 'domain' => $domain, 'locale' => $locale, 'result' => $ret, 'number' => $number);
     }
     return $ret;
 }
 /**
  * {@inheritdoc}
  */
 public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null)
 {
     $id = (string) $id;
     if (!$domain) {
         $domain = 'messages';
     }
     $catalogue = $this->getCatalogue($locale);
     if ($catalogue->defines($id, $domain)) {
         return $this->symfonyTranslator->transChoice($id, $number, $parameters, $domain, $locale);
     }
     $locale = $catalogue->getLocale();
     if ($locale === $this->defaultLocale) {
         // we cant do anything...
         return $id;
     }
     $orgString = $this->symfonyTranslator->transChoice($id, $number, $parameters, $domain, $this->defaultLocale);
     return $this->translateWithSubstitutedParameters($orgString, $locale, $parameters);
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null)
 {
     $trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale);
     $this->log($id, $domain, $locale);
     return $trans;
 }
Ejemplo n.º 5
0
 /**
  * {@inheritdoc}
  */
 public function transChoice($id, $number, array $parameters = [], $domain = null, $locale = null)
 {
     return $this->translator->transChoice($id, $number, $parameters, $domain, $this->transformLocale($locale));
 }