Sets an inflected word in the cache.

@param   string  $singular  The singular form of the word.
@param   string  $plural    The plural form of the word. If omitted, it is assumed the singular and plural are identical.

@return  void

@since   1.0
14568
private function setCache($singular, $plural = null)
	{
		$singular = String::strtolower($singular);

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

		$this->cache[$singular] = $plural;
	}
1281029
public static function pluralise($iValue, $sSingular, $sSpecified = null)
    {
        $sSingular = trim($sSingular);

        if ($iValue == 1) {
            return $sSingular;
        } else {
            return $sSpecified ?: plural($sSingular);
        }
    }
1000516
public function make(string $slug, $objects, string $plural, string $singular): TaxonomyInterface
    {
        $taxonomy = (new Taxonomy($slug, (array) $objects, $this->container, $this->action))
            ->setLabels([
                'name' => $plural,
                'singular_name' => $singular,
                'search_items' => sprintf('Search %s', $plural),
                'popular_items' => sprintf('Popular %s', $plural),
                'all_items' => sprintf('All %s', $plural),
                'parent_item' => sprintf('Parent %s', $singular),
                'parent_item_colon' => sprintf('Parent %s:', $singular),
                'edit_item' => sprintf('Edit %s', $singular),
                'view_item' => sprintf('View %s', $singular),
                'update_item' => sprintf('Update %s', $singular),
                'add_new_item' => sprintf('Add New %s', $singular),
                'new_item_name' => sprintf('New %s Name', $singular),
                'separate_items_with_commas' => sprintf('Separate %s with commas', strtolower($plural)),
                'add_or_remove_items' => sprintf('Add or remove %s', strtolower($plural)),
                'choose_from_most_used' => sprintf('Choose from the most used %s', strtolower($plural)),
                'not_found' => sprintf('No %s found', strtolower($plural)),
                'no_terms' => sprintf('No %s', strtolower($plural)),
                'items_list_navigation' => sprintf('%s list navigation', $plural),
                'items_list' => sprintf('%s list', $plural),
                'most_used' => 'Most Used',
                'back_to_items' => sprintf('Back to %s', $plural)
            ])
            ->setArguments([
                'public' => true,
                'show_in_rest' => true,
                'show_admin_column' => true
            ]);

        $abstract = sprintf('themosis.taxonomy.%s', $slug);

        if (! $this->container->bound($abstract)) {
            $this->container->instance($abstract, $taxonomy);
        } else {
            throw new TaxonomyException('The taxonomy ['.$slug.'] already exists.');
        }

        return $taxonomy;
    }
386233
public function toPlural($word)
    {
        // Try to get the cached plural form from the singular.
        $cache = $this->getCachedPlural($word);

        if ($cache !== false) {
            return $cache;
        }

        // Check if the word is a known singular.
        if ($this->getCachedSingular($word)) {
            return false;
        }

        // Compute the inflection.
        $inflected = $this->matchRegexRule($word, 'plural');

        if ($inflected !== false) {
            $this->setCache($word, $inflected);

            return $inflected;
        }

        return false;
    }
1051323
public function translatePlural( $singular,
                                     $plural,
                                     $number,
                                     $textDomain = self::DEFAULT_TEXT_DOMAIN,
                                     $locale     = null )
    {
        return $this->getTranslator()
                    ->translatePlural( $singular, $plural, $number,
                                       $textDomain, $locale );
    }
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;
    }
172787
public static function pluralize($word) {
        foreach(self::$_exceptions as $exception) {
			if($exception['singular'] == $word){
				return $exception['plural'];
			}
        }

        return parent::pluralize($word);
	}
1230609
public function init($words = array())
    {
        if ($words)
        {
            $this->words = array();
            foreach ($words as $word) {
                $this->words[$this->prepare_word($word)] = $word;
            }
        }
        foreach ($this->words as $word)
        {
            $word = $this->prepare_word($word);
            $parts = $this->get_parts($word);

            $this->wordInfo[$word] = array("word" => $word, "num_parts" => count($parts));

            foreach ($parts as $part)
            {
                $size = mb_strlen($part);
                $skey = $size;
                if (!isset($this->wordParts[$skey]))
                {
                    $this->wordParts[$skey] = array();
                }
                if (!isset($this->wordParts[$skey][$part]))
                {
                    $this->wordParts[$skey][$part] = array("words" => array());
                }
                $this->wordParts[$skey][$part]["words"][$word] = $word;
            }
        }
        $this->isInitialized = true;
    }
367707
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];
            }
        }
    }
649552
public function setCustomHeaders(array $headers)
    {
        foreach ($headers as $k => &$v) {
            if (strpos($v, ':') === false) {
                $v = $k.': '.$v;
            }
        }
        $this->headers = $headers;
    }
767488
public function translatePlural(
        $singular,
        $plural,
        $number,
        $textDomain = 'default',
        $locale = null
    )
    {
        $textDomain = $textDomain !== 'default' ? $textDomain : $this->domain();
        $locale = $locale ?: (string) $this->currentLanguage();

        return $this->translationService()->translatePlural($singular, $plural, $number, $textDomain, $locale);
    }
1316031
public function ngettext($single, $plural, $number) {
        return Config::$o->lang?self::driver()->ngettext($single, $plural, $number) : ($number > 1 ? $plural : $single);
        //self::init();
        //return self::$_lang ? self::$_loaded->ngettext($single, $plural, $number) : ($number > 1 ? $plural : $single);
    }
1010076
public function setPlural($title = [])
    {
        if (! empty($title) && isset($title[1])) {
            $this->plural = $title[1];
        } else {
            $name = str_replace('_', ' ', $this->getSlug());

            $this->plural = Str::plural(Str::title($name));
        }

        return $this;
    }
156374
public function remap($key, $plural = null)
    {
        $this->remappings[] = [$key, null === $plural ? $key.'s' : $plural];

        return $this;
    }
1187721
public static void addPlural(String match, String rule, boolean insensitive){
        plurals.add(0, new Replacer(match, rule, insensitive));
    }
1014618
public function setSingular($title = [])
    {
        if (! empty($title) && isset($title[0])) {
            $this->singular = $title[0];
        } else {
            $name = str_replace('_', ' ', $this->getSlug());

            $this->singular = Str::singular(Str::title($name));
        }

        return $this;
    }
858851
public static function rename( $post_type, $name_singular, $name_plural ) {
		if ( ! post_type_exists( $post_type ) ) {
			return;
		}

		( new Post_Type_Labels( $post_type, $name_singular, $name_plural ) )->init();
	}