Translate a plural message into another language.
Works the same as ngettext().

@param string $message1 English text for singular
@param string $message2 English text for plural
@param int    $number   Number of entities

@return string Translated text
184059
public function translatePlural($message1, $message2, $number)
    {
        $key = $message1 . chr(0) . $message2;
        if (isset($this->translations[$key])) {
            $plurals = explode(chr(0), $this->translations[$key]);
            if (count($plurals) === $this->plural_rule->plurals()) {
                return $plurals[$this->plural_rule->plural($number)];
            }
        }

        return $number === 1 ? $message1 : $message2;
    }
150272
private function translationToString(Translation $translation)
    {
        $values = $translation->values;
        if ($translation instanceof Translation\Plural) {
            if (current($values) === 1) {
                return $translation->singular;
            } else {
                return $translation->plural;
            }
        } else {
            return $translation->message;
        }
    }
858498
protected function translateMessages(array $messages)
    {
        $results = array();
        foreach( $messages as $message ) {
            $results[] = Translate::message($message);
        }

        return $results;
    }
859722
public function translate($message, $parameters = array())
    {
        if (count($parameters) === 0) {
            return $this->translations[$message];
        } else {
            return vsprintf($this->translations[$message], $parameters);
        }
    }
831724
public static function pluralFormat($n, $format = NULL, $one, $two = NULL, $five = NULL)
	{
		if (NULL === $format) $format = ':number :plural';

		return strtr($format, [
			':number' => $n,
			':plural' => self::plural($n, $one, $two, $five)
		]);
	}
854012
public static function t($message, $args = [], $domain = 'core', $locale = 'en_EN')
    {
        return self::getInstance()->translator->trans($message, $args, $domain, $locale);
    }
28598
public function prepareTranslatedMessage(array $message = [])
    {
        $translatedMessage = \App\Registry::$translate->_($message['message']);
        array_unshift($message['vars'], $translatedMessage);
        return call_user_func_array('sprintf', $message['vars']);
    }
738690
protected function translate($message, $parameters = array())
    {
        return $this->translator->trans($message, $parameters, $this->translationDomain);
    }
1299154
public static function plural($number,$after){
		$cases = array (2, 0, 1, 1, 1, 2);
		return $after[ ($number%100>4 && $number%100<20)? 2: $cases[min($number%10, 5)] ];
		}
24545
public function inflectNounByNumber($number, $singular, $plural, $genitivePlural)
    {
        $units = $number % 10;
        $tens = ((int) ($number / 10)) % 10;

        if ($number === 1) {
            return $singular;
        }

        if ($tens === 1 && $units > 1) {
            return $genitivePlural;
        }

        if ($units >= 2 && $units <= 4) {
            return $plural;
        }

        return $genitivePlural;
    }
211790
public function transMultiple($messages, $parameters = [], $domain = null, $locale = null)
    {
        foreach ($messages as $message) {
            yield  $this->translator->trans($message, $parameters, $domain, $locale);
        }
    }
1127188
def ngettext(self, singular, plural, num, domain=None, **variables):
        
        variables.setdefault('num', num)
        t = self.get_translations(domain)
        return t.ungettext(singular, plural, num) % variables
713440
public function translate($message)
    {
        if (isset($this->translations[$message])) {
            return $this->translations[$message];
        } else {
            return $message;
        }
    }
409355
public function translateMessage(string $locale, string $namespace, string $message, array $args = []): string
    {
        $translation = $this->getStorage()->get($locale, $namespace, $message);
        if ($translation !== null) {
            $message = $translation[BundleStorageInterface::INDEX_PAIR_VALUE];
            $locale  = $translation[BundleStorageInterface::INDEX_PAIR_LOCALE];
        }

        return static::formatMessage($locale, $message, $args);
    }
21312
private function trans(string $message, array $params, string $domain = 'FormTheme'): ?string
    {
        if (isset($params['transChoice'])) {
            $transChoice = intval($params['transChoice']);
            unset($params['transChoice']);
            $x = $this->translator->transChoice($message, $transChoice, $params, $domain);
            return $x;
        }
        return $this->translator->trans($message, $params, $domain);
    }
123919
public static function message($name, $message = null)
    {
        if (func_num_args() === 2) {
            return static::$_messages[$name] = $message;
        }
        return isset(static::$_messages[$name]) ? static::$_messages[$name] : static::$_messages['_default_'];
    }
1253485
public function setText($message) {
        if (empty($message)) {
            throw new \InvalidArgumentException('Message cannot be empty');
        }

        $this->message->setText($message);
        return $this;
    }