Set plural rule

@param int $pluralRule
@return $this
760888
public function setPluralRule($pluralRule)
	{
		$this->pluralRule = $pluralRule;
		$this->langkeyValidator->setPluralRule($pluralRule);
		return $this;
	}
239710
public function make_plural_form_function($nplurals, $expression)
    {
        try {
            $handler = new PluralForms(rtrim($expression, ';'));

            return array($handler, 'get');
        } catch (\Exception $e) {
            // Fall back to default plural-form function.
            return $this->make_plural_form_function(2, 'n != 1');
        }
    }
1203445
public static function irregular($singular, $plural, $locale = 'default')
    {
        $rules = !is_array($singular) ? [$singular => $plural] : $singular;

        $len = min(strlen($singular), strlen($plural));

        $prefix = '';
        $index = 0;
        while ($index < $len && ($singular[$index] === $plural[$index])) {
            $prefix .= $singular[$index];
            $index++;
        }
        if (!$sSuffix = substr($singular, $index)) {
            $sSuffix = '';
        }
        if (!$pSuffix = substr($plural, $index)) {
            $pSuffix = '';
        }

        static::singular("/({$singular})$/i", "\\1", $locale);
        static::singular("/({$prefix}){$pSuffix}$/i", "\\1{$sSuffix}", $locale);
        static::plural("/({$plural})$/i", "\\1", $locale);
        static::plural("/({$prefix}){$sSuffix}$/i", "\\1{$pSuffix}", $locale);
    }
739717
public function addRule( $rule )
    {
        if ( ! ( $rule instanceof RuleStructure ) )
        {
            $rule = new RuleStructure( $rule );
        }

        $this->rules[] = $rule;
        return $this;
    }
986961
protected function setRules( array $rules )
	{
		foreach( $rules as $key => $rule ) {
			$rules[ $key ] = is_string( $rule ) ? explode( '|', $rule ) : $rule;
		}

		$this->rules = $rules;

		return $this;
	}
791842
public function setLocale($locale = null)
    {
        if (is_null($locale)) {
            $locale = $this->getParent()->getLocale();
        }
        $this->locale = $locale;

        return $this;
    }
370897
private function composeValidationRules(
        SettingsProviderInterface $settingsProvider,
        FileSystemInterface $fileSystem,
        string $singular,
        string $plural
    ): TemplateOutput {
        $folder = $settingsProvider
                      ->get(FluteSettingsInterface::class)[FluteSettingsInterface::KEY_JSON_VALIDATION_RULES_FOLDER];

        $outputRootFolder = $this->filterOutFolderMask($folder);
        $outputFileName   = $singular . 'Rules.php';
        $outputContent    = $this->composeTemplateContent(
            $fileSystem,
            $this->getTemplatePath('ValidationRules.txt'),
            [
                '{%SINGULAR_CC%}' => $singular,
                '{%PLURAL_CC%}'   => $plural,
                '{%SINGULAR_LC%}' => strtolower($singular),
                '{%PLURAL_LC%}'   => strtolower($plural),
            ]
        );

        return new TemplateOutput($outputRootFolder, $outputFileName, $outputContent, $singular);
    }
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;
    }
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;
	}
846399
protected function addRule(IRule $rule)
    {
        if ($this->inCondition) {
            /** @var ConditionalRule $lastRule */
            $lastRule = $this->rules[count($this->rules) - 1];
            $lastRule->addRule($rule);
        } else {
            $this->rules[] = $rule;
        }
    }
1322344
private function getNounDeclensionForNumber($pluralRule, $noun)
    {
        // Nothing for abstract count
        if ($noun[2] === Gender::GENDER_ABSTRACT) {
            return '';
        }

        // One
        if ($pluralRule === 'o') {
            return $noun[0];
        }

        // Few
        if ($pluralRule === 'f') {
            return $noun[1];
        }

        // Many
        return Dictionary::$manyPart . Dictionary::$wordSeparator . $noun[1];
    }
144907
public function addRule(AbstractRule $validationRule)
    {
        $validationRule->setErrorMessagePrototype($this->errorMessagePrototype);
        $this->rules->attach($validationRule);

        return $this;
    }
664196
public function setRules($rules)
    {
        foreach ($rules as $ruleName => $rule) {
            $this->setRule($ruleName, $rule);
        }
    }
128964
public function setRule($fieldName, Rule $rule)
    {
        $this->rules[$fieldName][get_class($rule)] = $rule;
        
        $rule->setValidator($this);
        
        return $this;
    }
428456
public function translatePlural($singular, $plural, $number)
    {
        $this->checkTranslator();
        return $this->translator->translatePlural($singular, $plural, $number);
    }
571806
protected function inflect(array $plurals, $value, $rdc = null)
    {
        foreach ($plurals as $pattern => $repl) {
            if (preg_match($pattern, $value)) {
                return preg_replace($pattern, $repl, $value);
            }
        }

        return null === $rdc ? $value : (self::REDUCE === $rdc ? $this->reduceVal($value) : $this->appendVal($value));
    }
52583
public function set(array $rules)
    {
        $this->items = array_merge(
            $this->items,
            $this->parseRules($rules)
        );

        return $this;
    }