Retrieve all country names in the given language.

@param string $language The language key.

@return string[]

@SuppressWarnings(PHPMD.Superglobals)
@SuppressWarnings(PHPMD.CamelCaseVariableName)
340735
protected function getCountryNames($language)
    {
        $event = new LoadLanguageFileEvent('countries', $language, true);
        $this->eventDispatcher->dispatch(ContaoEvents::SYSTEM_LOAD_LANGUAGE_FILE, $event);

        return $GLOBALS['TL_LANG']['CNT'];
    }
339337
public function getTranslation($language = null)
    {
        $language = $language ?: $this->getLanguage();

        $translations = $this->getTranslateRelations();
        if (isset($translations[$language])) {
            return $translations[$language];
        }

        $sourceLanguage = $this->getSourceLanguage();
        $attributes = isset($translations[$sourceLanguage]) ?
            ArrayHelper::toArray($translations[$sourceLanguage]) : [];

        $translations[$language] = $this->createTranslation($language, $attributes);

        $this->setTranslateRelations($translations);

        return $translations[$language];
    }
424781
private function collectValues($languages)
    {
        $values = [];

        foreach ($languages as $languageKey) {
            $languageContent = $this->manager->getFileContent($this->files[$languageKey]);

            $values[$languageKey] = $this->ask(
                sprintf(
                    '<fg=yellow>%s.%s:%s</> translation',
                    $this->fileName,
                    $this->key,
                    $languageKey
                ),
                isset($languageContent[$this->key]) ? $languageContent[$this->key] : null
            );
        }

        return $values;
    }
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;
    }
54386
public function get_list_of_currencies($lang = null) {
        if ($lang === null) {
            $lang = current_language();
        }

        $currencies = $this->load_component_strings('core_currencies', $lang);
        asort($currencies);

        return $currencies;
    }
12914
protected function getLocaleChoices()
    {
        $locale = [];

        foreach ($this->languages as $language) {
            $locale[$language['label']] = $language['locale'];
        }

        return $locale;
    }
477637
public function getLanguage( $language )
	{
		$pattern		= '/^([a-z]{1,8}(?:-[a-z]{1,8})*)(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?$/i';
		if( !$language )
			return $this->default;
		$accepted	= preg_split( '/,\s*/', $language );
		$curr_lang	= $this->default;
		$curr_qual	= 0;
		foreach( $accepted as $accept)
		{
			if( !preg_match ( $pattern, $accept, $matches) )
				continue;
			$lang_code = explode ( '-', $matches[1] );
			$lang_quality =  isset( $matches[2] ) ? (float)$matches[2] : 1.0;
			while (count ($lang_code))
			{
				if( in_array( strtolower( join( '-', $lang_code ) ), $this->allowed ) )
				{
					if( $lang_quality > $curr_qual )
					{
						$curr_lang	= strtolower( join( '-', $lang_code ) );
						$curr_qual	= $lang_quality;
						break;
					}
				}
				array_pop ($lang_code);
			}
		}
		return $curr_lang;
	}
72590
public function getKeys(
        array $domains = [],
        array $languages = []
    ) : array {
        return array_reduce(
            $this->getTranslations(
                $domains,
                $languages
            ),
            function (array $keys, Translation $translation) {
                $keys[] = $translation->getKey();

                return $keys;
            },
            []
        );
    }
60536
public function getAvailableLanguagesNames($lang = null)
    {
        if (!is_null($lang)) {
            $original_lang = $this->getLanguage();
            $this->setLanguage($lang);
        }
        $db = $this->getLoader()->getOption('available_languages');
        $full_locales = array();
        if (!empty($db)) {
            foreach ($db as $ln=>$locale) {
                $full_locales[$ln] = Locale::getDisplayName($locale);
            }
        }
        if (!empty($original_lang)) {
            $this->setLanguage($original_lang);
        }
        return $full_locales;
    }
333439
public function getAvailableLangs( $domain = null ) {
		$domainInfo = $this->getDomainInfo( $domain ?? $this->getDomain() );
		if ( !$domainInfo ) {
			$languages = [];
		} else {
			if ( isset( $domainInfo['langs'] ) ) {
				$languages = $domainInfo['langs'];
			} else {
				$files = @scandir( $domainInfo['dir'], SCANDIR_SORT_NONE ) ?: [];

				$languages = [];
				foreach ( $files as $filename ) {
					$langCode = basename( $filename, '.json' );
					$langName = $this->getLangName( $langCode );
					if ( $langName !== '' ) {
						$languages[$langCode] = $langName;
					}
				}
				$this->addDomainInfo( $domain, [ 'langs' => $languages ] );
			}
		}

		$languages = array_merge( $languages, $this->availableLanguages );
		ksort( $languages );
		return $languages;
	}
864653
public static function countryLanguageCodes($countryCode)
    {
        $localeCodes = Locale::countryLocaleCodes($countryCode);

        $list = [];
        foreach ($localeCodes as $localeCode) {
            $list[] = Locale::languageCode($localeCode);
        }

        return $list;
    }
685127
public function filterLanguage($language)
    {
        $countries = array();
        foreach ($this->countries as $country) {
            if ($country->getLanguages()->contains($language)) {
                $countries[] = $country;
            }
        }

        return new self($countries);
    }
674357
private function getPosixLocale(Language $language): ?array
    {
        if (!$language->enabled) {
            return null;
        }

        $posixLocale = $this->localeConverter->convertToPOSIX($language->languageCode);
        if ($posixLocale === null) {
            return null;
        }

        if (!Locales::exists($posixLocale)) {
            return null;
        }

        return [$posixLocale, Locales::getName($posixLocale)];
    }
947080
public function getLanguagesFiltered($tag) {
		$alllanguages = $this->getAllLanguages();
		
		$languages = array();
		
		foreach ($alllanguages as $code=>$lang) {
			if (in_array($tag,$lang['tags'])) {
				$languages[$code] = $lang;
			}
		}
		
		return $languages;
	}
1060953
private function getContaoLanguages(): array
    {
        $languages = [];
        foreach ($this->connection->createQueryBuilder()
                     ->select('language', 'id', 'fallback')
                     ->from('tl_page')
                     ->where('type=:type')
                     ->setParameter('type', 'root')
                     ->orderBy('fallback')
                     ->addOrderBy('sorting')
                     ->execute()->fetchAll(\PDO::FETCH_ASSOC) as $root) {
            $language = $root['language'];

            $languages[] = $language;
        }

        return $languages;
    }
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;
    }
1158998
public function getPlaceholders($language)
    {
        return [
            [
                'placeholder' => '%s',
                'title' => $this->translator->trans('siteroots.siteroot_title', [], 'gui', $language),
            ],
            [
                'placeholder' => '%b',
                'title' => $this->translator->trans('siteroots.element_backend_title', [], 'gui', $language),
            ],
            [
                'placeholder' => '%p',
                'title' => $this->translator->trans('siteroots.element_page_title', [], 'gui', $language),
            ],
            [
                'placeholder' => '%n',
                'title' => $this->translator->trans('siteroots.element_navigation_title', [], 'gui', $language),
            ],
            [
                'placeholder' => '%r',
                'title' => $this->translator->trans('siteroots.project_title', [], 'gui', $language),
            ],
        ];
    }