Translates the provided message to singular or plural according to the number

@param string  $singular
@param string  $plural
@param integer $number

@return string
428456
public function translatePlural($singular, $plural, $number)
    {
        $this->checkTranslator();
        return $this->translator->translatePlural($singular, $plural, $number);
    }
332210
public function setString($context, $text, $plural = '')
    {
        $this->context = (string) $context;
        $this->text = (string) $text;
        $this->plural = (string) $plural;
        $this->hash = md5($this->plural ? $this->context . "\004" . $this->text . "\005" . $this->plural : $this->context . "\004" . $this->text);
    }
1083002
def get_plural_tag_index(number, locale):
    
    locale = Locale.parse(locale)
    plural_rule = locale.plural_form
    used_tags = plural_rule.tags | set([_fallback_tag])
    tag, index = plural_rule(number), 0
    for _tag in _plural_tags:
        if _tag == tag:
            return index
        if _tag in used_tags:
            index += 1
4066
private String transformToPluralForm(String singular) {
        String lowercaseSingular = singular.toLowerCase();
        if (IRREGULAR_NOUNS.containsKey(lowercaseSingular)) {
            // e.g. "Woman" -> "Women", "Ox" -> "Oxen" …
            String plural = IRREGULAR_NOUNS.get(lowercaseSingular);
            if (Character.isUpperCase(singular.charAt(0)) && plural.length() >= 2) {
                plural = String.valueOf(plural.charAt(0)).toUpperCase() + plural.substring(1);
            }
            return plural;
        }

        StringBuilder plural = new StringBuilder();

        // start with singular form
        plural.append(singular);

        if (singular.endsWith(String.valueOf(LAST_CHAR_Y))) {
            // e.g. "City" -> "Cities"

            // replace last char with suffix form
            int length = plural.length();
            plural.replace(length - 1, length, PLURAL_SUFFIX_IES);

        } else if (singular.endsWith(String.valueOf(LAST_CHAR_S))
            || singular.endsWith(String.valueOf(LAST_CHAR_X))
            || singular.endsWith(String.valueOf(LAST_CHAR_Z))
            || singular.endsWith(LAST_CHARS_CH)
            || singular.endsWith(LAST_CHARS_SH)) {
            // e.g. "Bus" -> "Buses"
            // e.g. "Box" -> "Boxes"
            // e.g. "Buzz" -> "Buzzes"
            // e.g. "Wish" -> "Wishes"
            // e.g. "Pitch" -> "Pitches"

            plural.append(PLURAL_SUFFIX_ES);

        } else {
            // e.g. "Boat" -> "Boats"

            // default
            plural.append(PLURAL_SUFFIX_S);
        }

        return plural.toString();
    }
881854
private function getDefaultParams($singular, $plural, $params)
    {
        $labels = [
            'name'              => _x($plural, LARAPRESS_TEXTDOMAIN),
            'singular_name'     => _x($singular, LARAPRESS_TEXTDOMAIN),
            'search_items'      => __('Search ' . $plural, LARAPRESS_TEXTDOMAIN),
            'all_items'         => __('All ' . $plural, LARAPRESS_TEXTDOMAIN),
            'parent_item'       => __('Parent ' . $singular, LARAPRESS_TEXTDOMAIN),
            'parent_item_colon' => __('Parent ' . $singular . ': ', LARAPRESS_TEXTDOMAIN),
            'edit_item'         => __('Edit ' . $singular, LARAPRESS_TEXTDOMAIN),
            'update_item'       => __('Update ' . $singular, LARAPRESS_TEXTDOMAIN),
            'add_new_item'      => __('Add New ' . $singular, LARAPRESS_TEXTDOMAIN),
            'new_item_name'     => __('New ' . $singular . ' Name', LARAPRESS_TEXTDOMAIN),
            'menu_name'         => __($plural, LARAPRESS_TEXTDOMAIN),
        ];

        return array_merge([
            'label'             => __($plural, LARAPRESS_TEXTDOMAIN),
            'labels'            => $labels,
            'public'            => true,
            'query_var'         => true,
            'hierarchical'      => true,
            'show_ui'           => true,
            'show_admin_column' => true,
            'show_in_nav_menus' => true,
            'show_tagcloud'     => true,
            'rewrite'           => true,
        ], $params);
    }
1281029
public static function pluralise($iValue, $sSingular, $sSpecified = null)
    {
        $sSingular = trim($sSingular);

        if ($iValue == 1) {
            return $sSingular;
        } else {
            return $sSpecified ?: plural($sSingular);
        }
    }
376312
public function name($plural = false)
    {
        if (Lang::has('panel::entities.'.$this->name)) {
            return trans_choice('panel::entities.'.$this->name, $plural ? 2 : 1);
        } else {
            return $plural ? str_plural(ucwords($this->name)) : ucwords($this->name);
        }
    }
424868
public function ngettext($singular, $plural, $count) {
		if ($this->reader === null) {
			return $count > 1 ? $plural : $singular;
		}
		return $this->reader->ngettext((string)$singular, (string)$plural, $count);
	}
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)
		]);
	}
81233
public function translate($key, array $tokensValues = [])
    {
        if (isset($tokensValues['_count'])) {
            $message = $this->getMessage(static::PLURAL_PREFIX . $key);
            if (!$message) {
                $message = $this->getMessage($key);
            }
        } else {
            $message = $this->getMessage($key);
            if (!$message) {
                $message = $this->getMessage(static::PLURAL_PREFIX . $key);
            }
        }

        if (!$message) {
            // Fallback to the message key
            $message = $key;
        }

        // Check for missing/invalid context
        if (isset($message['_context'])) {
            $message = $this->resolveContext($key, $message, $tokensValues);
            unset($tokensValues['_context']);
        }

        if (!$tokensValues) {
            // Fallback for plurals that were using the singular key
            if (is_array($message)) {
                return array_values($message + [''])[0];
            }

            return $message;
        }

        // Singular message, but plural call
        if (is_string($message) && isset($tokensValues['_singular'])) {
            $message = [$tokensValues['_singular'], $message];
        }

        // Resolve plural form.
        if (is_array($message)) {
            $count = isset($tokensValues['_count']) ? $tokensValues['_count'] : 0;
            $form = PluralRules::calculate($this->locale, $count);
            $message = isset($message[$form]) ? $message[$form] : (string)end($message);
        }

        if (strlen($message) === 0) {
            $message = $key;
        }

        return $this->formatter->format($this->locale, $message, $tokensValues);
    }
220909
public function setPluralName($pluralName)
    {
        if (!empty($pluralName) && ctype_print($pluralName)) {
            $this->pluralName = trim($pluralName);
        }

        return $this;
    }
172787
public static function pluralize($word) {
        foreach(self::$_exceptions as $exception) {
			if($exception['singular'] == $word){
				return $exception['plural'];
			}
        }

        return parent::pluralize($word);
	}
863140
public static function pluralStudly($value, $count = 2)
    {
        $parts = preg_split('/(.)(?=[A-Z])/u', $value, -1, PREG_SPLIT_DELIM_CAPTURE);

        $lastWord = array_pop($parts);

        return implode('', $parts).self::plural($lastWord, $count);
    }
1363110
public function plural($key, $count, array $vars = [])
    {
        if ($count === 1) {
            return $this->singular($key, $vars);
        }

        return $this->singular($key . '_plural', ['count' => $count] + $vars);
    }
57498
private function isEqualOrPluralOf($name, $singular)
    {
        return 0 === strnatcmp($name, $singular) || 0 === strnatcmp($name, $this->pluralize($singular));
    }
414488
public function getPluralTitle()
    {
        if (!isset($this->pluralTitle) || !$this->pluralTitle) {
            return Str::plural($this->getTitle());
        }

        return $this->pluralTitle;
    }
707724
private function setCache($singular, $plural = null)
    {
        $singular = Utf8String::strtolower($singular);

        if ($plural === null) {
            $plural = $singular;
        } else {
            $plural = Utf8String::strtolower($plural);
        }

        $this->cache[$singular] = $plural;
    }