Esempio n. 1
0
 /**
  * Returns the translated string by the given plural and quantity.
  *
  * @param string $domain Translation domain
  * @param string $singular String in singular form
  * @param string $plural String in plural form
  * @param integer $number Quantity to chose the correct plural form for languages with plural forms
  * @return string Returns the translated singular or plural form of the string depending on the given number.
  */
 public function dn($domain, $singular, $plural, $number)
 {
     $index = $this->_getPluralIndex($number, $this->getLocale());
     if (isset($this->_translations[$domain][$singular][$index])) {
         return $this->_translations[$domain][$singular][$index];
     }
     return parent::dn($domain, $singular, $plural, $number);
 }
Esempio n. 2
0
 /**
  * Returns the translated string by the given plural and quantity.
  *
  * @param string $domain Translation domain
  * @param string $singular String in singular form
  * @param string $plural String in plural form
  * @param integer $number Quantity to chose the correct plural form for languages with plural forms
  * @return string Returns the translated singular or plural form of the string depending on the given number.
  */
 public function dn($domain, $singular, $plural, $number)
 {
     $locale = $this->getLocale();
     $index = $this->_getPluralIndex($number, $locale);
     $key = $this->_prefix . $domain . '|' . $locale . '|' . $singular . '|' . $index;
     // regular cache
     $success = false;
     $value = apc_fetch($key, $success);
     if ($success === true) {
         return $value;
     }
     // not cached
     $value = parent::dn($domain, $singular, $plural, $number);
     apc_store($key, $value);
     return $value;
 }