Получить индетификатор формы множественного числа

@param string $lang индетификатор языка
@param integer $n число по которму определяется форма слова
@return integer индетификатор формы слова
496209
private static function PluralLangGetForm($lang, $n)
    {
        switch ($lang) {
            case 'ach':
            case 'ak':
            case 'am':
            case 'arn':
            case 'br':
            case 'fil':
            case 'fr':
            case 'ln':
            case 'mfe':
            case 'mg':
            case 'mi':
            case 'oc':
            case 'ti':
            case 'tr':
            case 'wa':
                return (int)($n > 1);
            case 'af':
            case 'an':
            case 'ast':
            case 'az':
            case 'bg':
            case 'bn':
            case 'ca':
            case 'da':
            case 'de':
            case 'el':
            case 'en':
            case 'eo':
            case 'es':
            case 'et':
            case 'eu':
            case 'fi':
            case 'fo':
            case 'fur':
            case 'fy':
            case 'gl':
            case 'gu':
            case 'ha':
            case 'he':
            case 'hi':
            case 'hu':
            case 'ia':
            case 'it':
            case 'kn':
            case 'ku':
            case 'lb':
            case 'mai':
            case 'ml':
            case 'mn':
            case 'mr':
            case 'nah':
            case 'nap':
            case 'nb':
            case 'ne':
            case 'nl':
            case 'se':
            case 'nn':
            case 'no':
            case 'nso':
            case 'or':
            case 'ps':
            case 'pa':
            case 'pap':
            case 'pms':
            case 'pt':
            case 'rm':
            case 'sco':
            case 'si':
            case 'so':
            case 'son':
            case 'sq':
            case 'sw':
            case 'sv':
            case 'ta':
            case 'te':
            case 'tk':
            case 'ur':
            case 'yo':
                return (int)($n != 1);
            case 'jv':
                return (int)($n != 0);
            case 'ay':
            case 'bo':
            case 'cgg':
            case 'dz':
            case 'fa':
            case 'hy':
            case 'id':
            case 'ja':
            case 'jbo':
            case 'ka':
            case 'kk':
            case 'km':
            case 'ko':
            case 'ky':
            case 'lo':
            case 'ms':
            case 'sah':
            case 'su':
            case 'tg':
            case 'th':
            case 'tt':
            case 'ug':
            case 'uz':
            case 'vi':
            case 'wo':
            case 'zh':
                return (int)(0);

            case 'be':
            case 'bs':
            case 'hr':
            case 'ru':
            case 'sr':
            case 'uk':
                return (int)($n % 10 == 1 && $n % 100 != 11 ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2));
            case 'lt':
                return (int)($n % 10 == 1 && $n % 100 != 11 ? 0 : ($n % 10 >= 2 && ($n % 100 < 10 or $n % 100 >= 20) ? 1 : 2));
            case 'lv':
                return (int)($n % 10 == 1 && $n % 100 != 11 ? 0 : ($n != 0 ? 1 : 2));
            case 'mt':
                return (int)($n == 1 ? 0 : ($n == 0 || ($n % 100 > 1 && $n % 100 < 11) ? 1 : (($n % 100 > 10 && $n % 100 < 20) ? 2 : 3)));
            case 'pl':
                return (int)($n == 1 ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2));
            case 'ar':
                return (int)($n == 0 ? 0 : ($n == 1 ? 1 : ($n == 2 ? 2 : ($n % 100 >= 3 && $n % 100 <= 10 ? 3 : ($n % 100 >= 11 ? 4 : 5)))));
            case 'gd':
                return (int)(($n == 1 || $n == 11) ? 0 : (($n == 2 || $n == 12) ? 1 : (($n > 2 && $n < 20) ? 2 : 3)));
            case 'is':
                return (int)($n % 10 != 1 || $n % 100 == 11);

            case 'cs':
            case 'sk':
                return (int)(($n == 1) ? 0 : (($n >= 2 && $n <= 4) ? 1 : 2));
            case 'cy':
                return (int)(($n == 1) ? 0 : (($n == 2) ? 1 : (($n != 8 && $n != 11) ? 2 : 3)));
            case 'ga':
                return (int)(($n == 1) ? 0 : (($n == 2) ? 1 : ($n < 7 ? 2 : ($n < 11 ? 3 : 4))));
            case 'kw':
                return (int)(($n == 1) ? 0 : (($n == 2) ? 1 : (($n == 3) ? 2 : 3)));

            case 'mk':
                return (int)(($n == 1 || $n % 10 == 1) ? 0 : 1);
            case 'mnk':
                return (int)($n == 0 ? 0 : ($n == 1 ? 1 : 2));

            case 'ro':
                return (int)($n == 1 ? 0 : (($n == 0 || ($n % 100 > 0 && $n % 100 < 20)) ? 1 : 2));
            case 'sl':
                return (int)($n % 100 == 1 ? 1 : ($n % 100 == 2 ? 2 : ($n % 100 == 3 || $n % 100 == 4 ? 3 : 0)));
            default:
                return 0;
        }
    }
1125565
public function getLabel($lang = null)
    {
        $lang = empty($lang) ? $this->getDefaultLanguage() : $lang;

        if (!isset($this->labels[$lang])) {
            return $this->getFirstLabel();
        }

        return $this->labels[$lang];
    }
671288
public function setLanguage($lang)
	{
		$this->lang     = $lang;
		$this->metadata = $this->getMetadata($this->lang);

		return $this;
	}
614568
public function children($lang='',$alias=''){
		$collname=$this->collectionName;
		$bitems=$collname::GetInstance();
		$children=$bitems->itemsFilter(array('parent'=>$this->id));
		if(empty($alias)){
			return $children;
			}
		foreach($children as $ch){
			$chalias=$ch->getalias($lang);
			if($chalias==$alias){
				return $ch;
				}
			}
		return NULL;
		}
464114
public static function set($lang = NULL) {
        $languages = get_config('langs');
        if (!$languages) {
            throw new \Exception(ExceptionMessages::MISCONFIGURED_LANG_CONFIG);
        }

        if (!get_config('lang_default')) {
            throw new \Exception(ExceptionMessages::MISCONFIGURED_LANG_DEFAULT_CONFIG);
        }

        if (empty($lang) || !in_array($lang, $languages)) {
            $lang = get_config('lang_default');
        }

        self::$currentLang = $lang;
        self::load($lang);
    }
981558
public function getTranslation($lang, $key, $array_support = false)
    {
        $translation = Grav::instance()['languages']->get($lang . '.' . $key, null);
        if (!$array_support && is_array($translation)) {
            return (string)array_shift($translation);
        }

        return $translation;
    }
1365292
public function getNodeTranslation($lang, $includeOffline = false)
    {
        $nodeTranslations = $this->getNodeTranslations($includeOffline);
        /* @var NodeTranslation $nodeTranslation */
        foreach ($nodeTranslations as $nodeTranslation) {
            if ($lang == $nodeTranslation->getLang()) {
                return $nodeTranslation;
            }
        }

        return null;
    }
1328398
public static function getInstance($lang, $debug = false)
	{
		if (!isset(self::$languages[$lang . $debug]))
		{
			$language = new self($lang, $debug);

			self::$languages[$lang . $debug] = $language;

			// Check if Language was instantiated with a null $lang param;
			// if so, retrieve the language code from the object and store
			// the instance with the language code as well
			if (is_null($lang))
			{
				self::$languages[$language->getLanguage() . $debug] = $language;
			}
		}

		return self::$languages[$lang . $debug];
	}
334252
public function getLanguageCode($lang = null)
    {
        $parts = $this->_callInternalLocale('parseLocale', null, $lang, false);
        return isset($parts['language']) ? $parts['language'] : null;
    }
1371321
public function getOptionsByLang($lang = 'en')
    {
        $finalOptions = [];

        foreach ($this->getOptions() as $options) {
            foreach ($options as $option) {
                if ($option->lang == $lang || $option->isPlain) {
                    $finalOptions[] = $option;
                }
            }
        }

        return empty($finalOptions) ? null : $finalOptions;
    }
1153287
public static function set($lang)
    {
        exception_if(!in_array($lang, self::$supported), LanguageNotSupportedException::class, $lang);

        Cookie::create(self::$cookieName, $lang, config('lang.lifetime'));
        Session::put(self::$sessionName, $lang);

        self::change($lang);

        return true;
    }
39980
public function delete($lang, $id)
    {
        if(!User::hasAccess('Categories', 'delete')) {
            return $this->noPermission();
        }

        $categoryDeleteRes = $this->deleteCategory($id);
        if(gettype($categoryDeleteRes) == "boolean") {
            if($categoryDeleteRes) {
                return $this->response('Category could not be deleted.', 500);
            }
        }else{
            return $categoryDeleteRes;
        }

        return $this->response('Category could not be deleted. Please try again later or contact your Administrator!', 500);
    }
1025928
public static function language(string $lang = 'en', string $locale = 'en') : string
    {
        return static::languages($locale)->get($lang);
    }
1311775
public function getNodeRef($nodeId, $lang = null)
    {
        $this->initNodeVersions();

        $lang = $lang ?: $this->currentLocale->getCurrentLocale();

        return isset($this->nodeRefs[$lang][$nodeId]) ? $this->nodeRefs[$lang][$nodeId] : null;
    }
1311210
public static function loadLang($lang)
	{
		$list = array ();
		// 框架语言包
		$file = ROOT_PATH . Config::get('@.LANG_PATH') . '/' . $lang . '.lang.php';
		if (is_file($file))
		{
			$data = include $file;
			$list = array_merge($list, $data);
		}
		// 项目语言包
		$file = APP_LANG . $lang . '.lang.php';
		if (is_file($file))
		{
			$data = include $file;
			$list = array_merge($list, $data);
		}
		// 获取模块名
		$m = Dispatch::module();
		// 是否开启模块
		if ('' !== $m)
		{
			// 模块语言包
			$file = APP_MODULE . $m . '/' . Config::get('@.LANG_PATH') . '/'. $lang .'.lang.php';
			if (is_file($file))
			{
				$data = include $file;
				$list = array_merge($list, $data);
			}
		}
		return $list;
	}
723994
public static function set_current( $lang ) 
	{
		$lang = static::parse( $lang );
		
		if ( !array_key_exists( $lang, static::$data ) ) 
		{
			static::$data[$lang] = array();
		}
		
		return static::$current_language = $lang;
	}
479685
public function setLangDefault($lang, $text)
    {
        $this->setLangForm($lang, $text);
        $this->setLangColumn($lang, $text);
        $this->setLangFilter($lang, $text);

        return $this;
    }