Get all locale codes and names

@return array Map of locale code => name
779860
public function getLocales()
    {
        // Cache by locale
        $locale = i18n::get_locale();
        if (!empty(static::$cache_locales[$locale])) {
            return static::$cache_locales[$locale];
        }

        // Localise all locales
        $locales = $this->config()->get('locales');
        $localised = [];
        foreach ($locales as $code => $default) {
            $localised[$code] = $this->localeName($code);
        }

        // Save cache
        static::$cache_locales[$locale] = $localised;
        return $localised;
    }
61372
protected function getLocalCatalogs()
    {
        $result = array();

        $folders = array(
            $this->srcDir,
            dirname($this->srcDir) . '/app',
        );

        foreach($folders as $folder){
            $finder = new Finder();
            $finder->files()->in($folder)->name('/\w+\.\w+\.yml$/i');

            foreach($finder as $file){
                //$yml = $file->getRealpath();
                //$relativePath = $file->getRelativePath();
                $fileName = $file->getRelativePathname();

                if(preg_match("/translations\/(\w+)\.(\w+)\.yml/i", $fileName, $matches)){
                    $catalog = $matches[1];
                    $result[$catalog] = null;
                }
            }
        }

        return array_keys($result);
    }
706384
public function getDisplayLocales()
    {
        $locales = array();

        foreach ($this->allowedLocales as $locale) {
            $locales[$locale] = \Locale::getDisplayName($locale);
        }

        return $locales;
    }
371264
public function getNames(): array
    {
        if (!$this->names) {
            $this->names = static::all()[$this->code] ?? [
                'isoName' => $this->code,
                'nativeName' => $this->code,
            ];
        }

        return $this->names;
    }
1249693
public function getLocaleArray()
	{
		$localeArray = array();

		foreach ($this->getLocales() as $locale) {

			$country = $locale->getCountry();

			if (! isset($localeArray[$country])) {
				$localeArray[$country] = array(
					'title' => $country,
					'languages' => array()
				);
			}

			$localeArray[$country]['languages'][] = array(
				'id' => $locale->getId(),
				'title' => $locale->getTitle(),
				'flag' => $locale->getProperty('flag')
			);
		}

		return array_values($localeArray);
	}
406084
public function getAllKey()
    {
        $keys = array();
        // First, let's merge all the arrays in order to get all the keys:
        foreach ($this->getAllTranslationByLanguage() as $translations) {
            $keys = array_merge($keys, $translations);
        }

        return array_keys($keys);
    }
996414
public function getSupportedLocales()
    {
        $return = [];
        $process = new Process(['locale', '-a']);
        $process->run();
        $installedLocales = explode(PHP_EOL, trim($process->getOutput()));
        foreach ($this->supportedLocales as $supportedLocale) {
            if (in_array($supportedLocale, $installedLocales)
                || in_array($supportedLocale.'.utf8', $installedLocales)
            ) {
                $return[] = new Locale($supportedLocale);
            }
        }

        return $return;
    }
50790
protected function getMessageKeys()
    {
        $messageKeys = Config::get('js-localization.messages');
        $messageKeys = JsLocalizationHelper::resolveMessageKeyArray($messageKeys);

        $messageKeys = array_unique(
            array_merge($messageKeys, JsLocalizationHelper::getAdditionalMessages())
        );

        return $messageKeys;
    }
1033581
public function getLanguageCodesList()
    {
        $languages = array();
        foreach ($this->getStores() as $store) {
            $languages[] = $store->getLanguageCode();
        }
        return array_unique($languages);
    }
1050063
public function getAvailableLocales()
    {
        $availableLocales = [];
        $translations = $this->getTranslations();
        foreach ($translations as $translation) {
            $availableLocales[] = $translation->getLocale();
        }

        return $availableLocales;
    }
290169
public function getAvailableLocales() {

		foreach($this->locales as $id => $l) {
			if(!$l) {
				$this->locales[$id] = new Locale($id);
			}
		}

		return $this->locales;
	}
1274735
public function getLocale()
	{
        $locales = explode(',', $this->_meta->locale);

		for($i = 0; $i < count($locales); $i++ ) {
			$locale = $locales[$i];
			$locale = trim($locale);
			$locales[$i] = $locale;
		}

		return $locales;
	}
1331216
static function fetchLocaleList()
    {
        $languages = eZContentLanguage::fetchList();
        $localeList = array();

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

        return $localeList;
    }
1272480
protected function getLanguages()
    {
        // Check if we have the data in the cache.
        if (null !== $this->languageCache) {
            return $this->languageCache;
        }

        $loadedLanguage = $this->getMetaModel()->getActiveLanguage();
        $languageValues = $this->getLanguageNames($loadedLanguage);
        $languages      = $this->getRealLanguages();
        $keys           = \array_keys($languages);
        $aux            = [];
        $real           = [];

        // Fetch real language values.
        foreach ($keys as $key) {
            if (isset($languageValues[$key])) {
                $aux[$key]  = \utf8_romanize($languageValues[$key]);
                $real[$key] = $languageValues[$key];
            }
        }

        // Add needed fallback values.
        $keys = \array_diff($keys, \array_keys($aux));
        if ($keys) {
            $this->addNeededFallbackLanguages($keys, $aux, $real);
        }

        $keys = \array_diff($keys, \array_keys($aux));
        if ($keys) {
            foreach ($keys as $key) {
                $aux[$key]  = \utf8_romanize($languages[$key]);
                $real[$key] = $languages[$key];
            }
        }

        \asort($aux);
        $return = [];
        foreach (\array_keys($aux) as $key) {
            $return[$key] = $real[$key];
        }

        // Switch back to the original FE language to not disturb the frontend.
        if ($loadedLanguage != $GLOBALS['TL_LANGUAGE']) {
            $event = new LoadLanguageFileEvent('languages', null, true);
            $this->eventDispatcher->dispatch(ContaoEvents::SYSTEM_LOAD_LANGUAGE_FILE, $event);
        }

        return $this->languageCache = $return;
    }
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;
    }
367217
public function getLanguages()
    {
        // Cache by locale
        $locale = i18n::get_locale();
        if (!empty(static::$cache_languages[$locale])) {
            return static::$cache_languages[$locale];
        }

        // Localise all languages
        $languages = $this->config()->get('languages');
        $localised = [];
        foreach ($languages as $code => $default) {
            $localised[$code] = $this->languageName($code);
        }

        // Save cache
        static::$cache_languages[$locale] = $localised;
        return $localised;
    }
784589
@Override
    public Enumeration<Locale> getLocales() {
        if (null == this.locales) {
            this.locales = connection.getEncodingUtils().getLocales(this.request.getHeader("Accept-Language"));
        }
        return Collections.enumeration(this.locales);
    }