Returns the language specific replacements for the ascii method.

Note: Adapted from Stringy\Stringy.

@see https://github.com/danielstjules/Stringy/blob/3.1.0/LICENSE.txt

@param  string  $language
@return array|null
767947
protected static function languageSpecificCharsArray($language)
    {
        static $languageSpecific;

        if (! isset($languageSpecific)) {
            $languageSpecific = [
                'bg' => [
                    ['х', 'Х', 'щ', 'Щ', 'ъ', 'Ъ', 'ь', 'Ь'],
                    ['h', 'H', 'sht', 'SHT', 'a', 'А', 'y', 'Y'],
                ],
                'da' => [
                    ['æ', 'ø', 'å', 'Æ', 'Ø', 'Å'],
                    ['ae', 'oe', 'aa', 'Ae', 'Oe', 'Aa'],
                ],
                'de' => [
                    ['ä',  'ö',  'ü',  'Ä',  'Ö',  'Ü'],
                    ['ae', 'oe', 'ue', 'AE', 'OE', 'UE'],
                ],
                'ro' => [
                    ['ă', 'â', 'î', 'ș', 'ț', 'Ă', 'Â', 'Î', 'Ș', 'Ț'],
                    ['a', 'a', 'i', 's', 't', 'A', 'A', 'I', 'S', 'T'],
                ],
            ];
        }

        return $languageSpecific[$language] ?? null;
    }
170700
private function getNewTranslation($language)
    {
        $translation = null;
        /** @var \yii\db\ActiveQuery $relation */
        $relation = $this->owner->getRelation($this->relation);
        /** @var ActiveRecord $class */
        $class = $relation->modelClass;
        //if ($translation === null) {
        $translation = new $class;
        $translation->{key($relation->link)} = $this->owner->getPrimaryKey();
        $translation->{$this->languageAttribute} = $language;
        //}
        return $translation;
    }
262270
private function getFlexLocale($language) {
        if(!empty($language))
        {
            $split = explode("-", $language, 2);

            if(count($split) == 2 && $split[1] != "") {
                $split[1] = strtoupper($split[1]);
            } else {
                $split = null;
            }
        }

        if(empty($split))
            $split = ['en', 'US'];

        return $split[0] . self::LANGUAGUE_SEPARATOR . $split[1];
    }
1290627
public function getStopWordsFromLanguage(string $language = 'de'): array
  {
    if (\in_array($language, self::$availableLanguages, true) === false) {
      throw new StopWordsLanguageNotExists('language not supported: ' . $language);
    }

    if (!isset($this->stopWords[$language])) {
      $this->loadLanguageData($language);
    }

    return $this->stopWords[$language];
  }
897545
protected function getLanguageNames($language = null)
    {
        $event = new LoadLanguageFileEvent('languages', $language, true);
        $this->eventDispatcher->dispatch(ContaoEvents::SYSTEM_LOAD_LANGUAGE_FILE, $event);

        return $GLOBALS['TL_LANG']['LNG'];
    }
622816
public function generateElements($language = null)
    {
        $sitemapElements = [];
        $transformer = $this->transformer;

        $entities = $this
            ->entitySitemapElementProvider
            ->getEntities();

        if (is_array($entities)) {
            foreach ($entities as $entity) {
                $sitemapElements[] = $this
                    ->sitemapElementFactory
                    ->create(
                        $transformer->getLoc($entity, $language),
                        $transformer->getLastMod($entity, $language),
                        $this->changeFrequency,
                        $this->priority
                    );
            }
        }

        return $sitemapElements;
    }
329604
public function get_language_fullname($language)
    {
        //Clean up the language name to prevent malicious code injection
        $language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language);

        $language = strtolower($language);

        // get fullpath-filename for a langname
        $fullpath = $this->language_path.$language.'.php';

        // we need to get contents :S
        if (false === ($data = file_get_contents($fullpath))) {
            $this->error = sprintf('Geshi::get_lang_fullname() Unknown Language: %s', $language);
            return false;
        }

        // match the langname
        if (!preg_match('/\'LANG_NAME\'\s*=>\s*\'((?:[^\']|\\\')+?)\'/', $data, $matches)) {
            $this->error = sprintf('Geshi::get_lang_fullname(%s): Regex can not detect language', $language);
            return false;
        }

        // return fullname for langname
        return stripcslashes($matches[1]);
    }
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;
    }
697356
public function getTranslation(
        string $language,
        string $key
    ) : Translation {
        $languages = $this
            ->repositoryCollection
            ->getTranslations(
                [],
                [$language],
                function (Translation $translation) use ($key) {
                    return $translation->getKey() === $key;
                }
            );

        $firstLanguage = reset($languages);

        return $firstLanguage;
    }
1156332
public function getKeyword($language = null)
    {
        if (empty($language)) {
            $language = $this->mainLanguageCode;
        }

        if (!is_array($this->keywords) || !array_key_exists($language, $this->keywords)) {
            return null;
        }

        return $this->keywords[$language];
    }
67269
public function lang($lang = NULL)
	{
		if ( ! func_num_args())
		{
			return $this->_lang;
		}
		$this->_lang = $lang;
		return $this;
	}
1291504
public function getLanguageFullname($language)
    {
        //Clean up the language name to prevent malicious code injection
        $language = preg_replace('#[^a-zA-Z0-9\-_]#', '', $language);

        $language = strtolower($language);

        // get fullpath-filename for a langname
        $fullpath = self::LANG_ROOT . $language . '.php';

        // we need to get contents :S
        if (false === ($data = file_get_contents($fullpath))) {
            $this->error = sprintf('%s->%s Unknown Language: %s', __CLASS__, __METHOD__, $language);

            return false;
        }

        // match the langname
        if (!preg_match('/\'LANG_NAME\'\s*=>\s*\'((?:[^\']|\\\')+?)\'/', $data, $matches)) {
            $this->error = sprintf('%s->%s(%s): Regex can not detect language', __CLASS__, __METHOD__, $language);

            return false;
        }

        // return fullname for langname
        return stripcslashes($matches[1]);
    }
500652
public function get($language)
    {
        if (!isset($this->alphabets[$language])) {
            // Not found alphabet for language
            return null;
        }

        return $this->alphabets[$language];
    }
616622
public function byLanguage($language = null)
    {
        if (!$language) {
            if (Yii::$app->id === 'app-backend') {
                $language = Yii::$app->wavecms->editedLanguage;
            } else {
                $language = Yii::$app->language;
            }
        }

        return $this->andWhere(['REGEXP', News::tableName() . '.languages', '(^|;)(' . $language . ')(;|$)']);
    }
871299
private function getMessageFile($language) {
		if(!isset($this->messageFile[$language])) {
			$this->messageFile[$language] = new MessageFileLanguage($this->getPath(), $language);
		}
		return $this->messageFile[$language];
	}
57589
private function loadTranslation($language) {
        $translation = null;
        /** @var \yii\db\ActiveQuery $relation */
        $relation = $this->owner->getRelation($this->relation);
        /** @var ActiveRecord $class */
        $class = $relation->modelClass;
        $language = strtolower($language);
        if ($this->owner->getPrimarykey()) {
            $translation = $class::findOne(
                            [$this->languageField => $language, key($relation->link) => $this->owner->getPrimarykey()]
            );
        }
        if ($translation === null) {
            $translation = new $class;
            $translation->{key($relation->link)} = $this->owner->getPrimaryKey();
            $translation->{$this->languageField} = $language;
        }
        return $translation;
    }