Attempt to pluralize a string.

@param string $singular

@return string
3774
private function pluralize($singular)
    {
        if (null === $this->pluralizer) {
            return $singular;
        }

        return call_user_func($this->pluralizer, $singular);
    }
1298613
public static function isSingular($string)
    {
        // Check cache assuming the string is plural.
        $singular = isset(self::$_cache['singularized'][$string]) ? self::$_cache['singularized'][$string] : null;
        $plural = $singular && isset(self::$_cache['pluralized'][$singular]) ? self::$_cache['pluralized'][$singular] : null;
        
        if ($singular && $plural) {
            return $plural != $string;
        }
        
        // If string is not in the cache, try to pluralize and singularize it.
        return self::singularize(self::pluralize($string)) == $string;
    }
596356
public function slugify($name, $pluralize = true)
    {
        if (class_exists($name)) {
            $name = $this->shortName($name);
        }

        $inflector = Inflector::get();

        if ($pluralize === true) {
            $name = $inflector->pluralize($name);
        }

        return $inflector->dasherize(
            $inflector->underscore($name)
        );
    }
468828
private function getCachedPlural($singular)
	{
		$singular = String::strtolower($singular);

		// Check if the word is in cache.
		if (isset($this->cache[$singular]))
		{
			return $this->cache[$singular];
		}

		return false;
	}
906491
public static function singular(string $string) : string
    {
        if (substr($string, -3) == 'ies') {
            return substr($string, 0, -3).'y';
        }
        return substr($string, 0, -1);
    }
1131180
public function translatePlural($singular, $plural, $number)
    {
        return Translator::getInstance()
            ->translatePlural($singular, $plural, $number);
    }
1065720
public function npgettext($context, $singular, $plural, $count) {
		if ($this->reader === null) {
			return $count > 1 ? $plural : $singular;
		}
		return $this->reader->npgettext((string)$context, (string)$singular, (string)$plural, $count);
	}
491648
public static function pluralize( $word ) {
		if ( isset( self::$cache['pluralize'][ $word ] ) ) {
			return self::$cache['pluralize'][ $word ];
		}

		if ( ! isset( self::$plural['merged']['irregular'] ) ) {
			self::$plural['merged']['irregular'] = self::$plural['irregular'];
		}

		if ( ! isset( self::$plural['merged']['uninflected'] ) ) {
			self::$plural['merged']['uninflected'] = array_merge( self::$plural['uninflected'], self::$uninflected );
		}

		if ( ! isset( self::$plural['cacheUninflected'] ) || ! isset( self::$plural['cacheIrregular'] ) ) {
			self::$plural['cacheUninflected'] = '(?:' . implode( '|', self::$plural['merged']['uninflected'] ) . ')';
			self::$plural['cacheIrregular']   = '(?:' . implode( '|', array_keys( self::$plural['merged']['irregular'] ) ) . ')';
		}

		if ( preg_match( '/(.*)\\b(' . self::$plural['cacheIrregular'] . ')$/i', $word, $regs ) ) {
			self::$cache['pluralize'][ $word ] = $regs[1] . substr( $word, 0, 1 ) . substr( self::$plural['merged']['irregular'][ strtolower( $regs[2] ) ], 1 );

			return self::$cache['pluralize'][ $word ];
		}

		if ( preg_match( '/^(' . self::$plural['cacheUninflected'] . ')$/i', $word, $regs ) ) {
			self::$cache['pluralize'][ $word ] = $word;

			return $word;
		}

		foreach ( self::$plural['rules'] as $rule => $replacement ) {
			if ( preg_match( $rule, $word ) ) {
				self::$cache['pluralize'][ $word ] = preg_replace( $rule, $replacement, $word );

				return self::$cache['pluralize'][ $word ];
			}
		}
	}
1331220
public static function pluralize($word)
    {
        $lowerCasedWord = strtolower($word);
        foreach (static::$uncountables as $uncountable) {
            if (substr($lowerCasedWord, (-1 * strlen($uncountable))) == $uncountable) {
                return $word;
            }
        }
        foreach (static::$irregulars as $plural => $singular) {
            if (preg_match('/(' . $plural . ')$/i', $word, $arr)) {
                return preg_replace(
                    '/(' . $plural . ')$/i',
                    substr($arr[0], 0, 1) . substr($singular, 1),
                    $word
                );
            }
        }
        foreach (static::$plurals as $rule => $replacement) {
            if (preg_match($rule, $word)) {
                return preg_replace($rule, $replacement, $word);
            }
        }

        return false;
    }
74821
public function defaultLabels($plural, $singular, $hierarchical = true)
    {
        $labels = [
            'name' => $plural,
            'singular_name' => $singular,
            'menu_name' => $plural,
            'all_items' => $plural,

            'search_items' => Translate::t('term.labels.search_items'),
            'edit_item' => Translate::t('term.labels.edit_item'),
            'update_item' => Translate::t('term.labels.update_item'),
            'add_new_item' => Translate::t('term.labels.add_new_item'),
            'new_item_name' => Translate::t('term.labels.new_item_name'),
        ];

        if ($hierarchical) {
            $labels = array_merge($labels, [
                'parent_item' => Translate::t('term.labels.parent_item'),
                'parent_item_colon' => Translate::t('term.labels.parent_item_colon'),
            ]);
        } else {
            $labels = array_merge($labels, [
                'parent_item' => null,
                'parent_item_colon' => null,

                'popular_items' => Translate::t('term.labels.popular_items'),
                'separate_items_with_commas' => Translate::t('term.labels.separate_items_with_commas'),
                'choose_from_most_used' => Translate::t('term.labels.choose_from_most_used'),

                'add_or_remove_items' => Translate::t('term.labels.add_or_remove_items'),
                'not_found' => Translate::t('term.labels.not_found'),
            ]);
        }

        return $labels;
    }
762860
public static function singular($string)
    {
        $result = $string;
        foreach (self::$_singular as $rule => $replacement) {
            $rule = self::_normalize($rule);
            if (preg_match($rule, $string)) {
                $result = preg_replace($rule, $replacement, $string);
                break;
            }
        }
        return $result;
    }
226215
public function translatePlural($singular, $plural, $number)
    {
        $locale = $this->configuration->
            get('i18n.locale', $this->fallbackLocale);
        return $this->getTranslatorService()
            ->translatePlural(
                $singular,
                $plural,
                $number,
                $this->domain,
                $locale
            );
    }
580559
private function getCachedSingular($plural)
    {
        $plural = Utf8String::strtolower($plural);

        return array_search($plural, $this->cache);
    }
1034027
public function pluralize ($word) {
		$word .= 's';
		$word = preg_replace ('/(x|ch|sh|ss])s$/', '\1es', $word);
		$word = preg_replace ('/ss$/', 'ses', $word);
		$word = preg_replace ('/([ti])ums$/', '\1a', $word);
		$word = preg_replace ('/sises$/', 'ses', $word);
		$word = preg_replace ('/([^aeiouy]|qu)ys$/', '\1ies', $word);
		$word = preg_replace ('/(?:([^f])fe|([lr])f)s$/', '\1\2ves', $word);
		$word = preg_replace ('/ieses$/', 'ies', $word);
		if (isset ($this->pleural_corrections[$word])) {
			return $this->pleural_corrections[$word];
		}
		return $word;
	}
38314
public static function singularise( $string ) {

		// save some time in the case that singular and plural are the same
		if ( in_array(mb_strtolower($string), self::$uncountable) )
			return $string;

		// check for irregular plural forms
		foreach( self::$irregular as $result => $pattern ) {
			$pattern = '/' . $pattern . '$/iu';
			if( preg_match($pattern, $string) )
				return preg_replace($pattern, $result, $string);
		}

		// check for matches using regular expressions
		foreach( self::$singular as $pattern => $result ) {
			if( preg_match($pattern, $string) )
				return preg_replace($pattern, $result, $string);
		}

		return $string;

	}
551068
private function getCachedPlural($singular)
    {
        $singular = Utf8String::strtolower($singular);

        // Check if the word is in cache.
        if (isset($this->cache[$singular])) {
            return $this->cache[$singular];
        }

        return false;
    }
183364
public static function pluralize($input) {
		if (self::$pluralizer === null) {
			self::$pluralizer = new StandardEnglishSingularizer();
		}

		return self::$pluralizer->getPluralForm($input);
	}