Example #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);
 }
Example #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;
 }