Provide an array of locales where the locale is the key and the label is
the value for easy display in a dropdown select for example
example: array('de_CH' => 'Deutsch', 'en_GB' => 'English').

@return array
12914
protected function getLocaleChoices()
    {
        $locale = [];

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

        return $locale;
    }
188393
private function getAvailableLanguages()
    {
        if ($this->availableLanguages === null) {
            $this->availableLanguages = [];

            if (!empty($this->LLkey)) {
                $this->availableLanguages[] = $this->LLkey;
            }
            // The key for English is "default", not "en".
            $this->availableLanguages = str_replace(
                'en',
                'default',
                $this->availableLanguages
            );
            // Remove duplicates in case the default language is the same as the fall-back language.
            $this->availableLanguages = array_unique($this->availableLanguages);

            // Now check that we only keep languages for which we have
            // translations.
            foreach ($this->availableLanguages as $index => $code) {
                if (!isset($this->LOCAL_LANG[$code])) {
                    unset($this->availableLanguages[$index]);
                }
            }
        }

        return $this->availableLanguages;
    }
614497
public static Map<String, String> getSupportedLocales() {
		Map<String, String> locales = new HashMap<String, String>();
		for (String localeName : LocaleInfo.getAvailableLocaleNames()) {
			String displayName = LocaleInfo.getLocaleNativeDisplayName(localeName);
			locales.put(localeName, displayName);
		}
		return locales;
	}
1218473
public function getStringsToLocalize() {
		$switched_locale = switch_to_locale( Modules\Export\Export::locale() );

		$localized = [
			/**
			 * Filter the label used for post types (front matter/parts/chapters/back matter) in the TOC and section headings.
			 *
			 * @since 5.6.0
			 *
			 * @param string $label
			 * @param array $args
			 *
			 * @return string Filtered label
			 */
			'chapter' => apply_filters( 'pb_post_type_label', __( 'Chapter', 'pressbooks' ), [ 'post_type' => 'chapter' ] ),
			/**
			 * Filter the label used for post types (front matter/parts/chapters/back matter) in the TOC and section headings.
			 *
			 * @since 5.6.0
			 *
			 * @param string $label
			 * @param array $args
			 *
			 * @return string Filtered label
			 */
			'part' => apply_filters( 'pb_post_type_label', __( 'Part', 'pressbooks' ), [ 'post_type' => 'part' ] ),
		];

		if ( $switched_locale ) {
			restore_previous_locale();
		}

		return $localized;

	}
290169
public function getAvailableLocales() {

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

		return $this->locales;
	}
1165862
public static function countriesLocaleCodes()
    {
        static $list;

        if ($list === null) {
            $list = [];
            foreach (static::codes() as $localeCode) {
                if ($countryCode = \Locale::getRegion($localeCode)) {
                    $list[$countryCode][] = $localeCode;
                }
            }
        }

        return $list;
    }
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;
	}
705319
private function getIso3166Countries(): array
    {
        $countries = $this->country_service->getAllCountries();

        // Get the country names for each language
        $country_to_iso3166 = [];

        foreach (I18N::activeLocales() as $locale) {
            I18N::init($locale->languageTag());

            foreach ($this->country_service->iso3166() as $three => $two) {
                $country_to_iso3166[$three]             = $two;
                $country_to_iso3166[$countries[$three]] = $two;
            }
        }

        return $country_to_iso3166;
    }
325586
public function locales()
    {
        if ($this->locales) {
            return $this->locales;
        }

        $cfg = $this->app()->config();
        $locales = isset($cfg['locales']) ? $cfg['locales'] : [];
        $languages = isset($locales['languages']) ? $locales['languages'] : [];
        $file = isset($locales['file']) ? $locales['file'] : $this->argOrInput('output');
        // Default to FR
        $default = isset($locales['default_language']) ? $locales['default_language'] : 'fr';

        $this->locales = [
            'languages' => $languages,
            'file' => $file,
            'default_language' => $default
        ];
        return $this->locales;
    }
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);
	}
246449
private function getI18nStats()
	{
		$selected_instance   = $this->filter_post->getString( 'instance' );
		$selected_raw_locale = $this->filter_post->getString( 'locale' );

		list( $file_type, $language_code, $country_code_and_extension ) = explode( '_', $selected_raw_locale );
		$this->assign( 'language', $language_code );
		$locale = $language_code . '_' . $country_code_and_extension[0] . $country_code_and_extension[1];

		$literals = $this->getLiterals( $selected_instance );
		$this->assign( 'literals', $literals );

		try
		{
			\Sifo\I18N::setDomain( $file_type, $locale, $selected_instance );
			$translations_i18 = \Sifo\I18N::$translations;

			$missing_messages  = array_diff_key( $literals, $translations_i18[$file_type . '_' . $locale] );
			$leftover_messages = array_diff_key( $translations_i18[$file_type . '_' . $locale], $literals );

			$this->assign( 'selected_instance', $selected_instance );
			$this->assign( 'missing_messages', $missing_messages );
			$this->assign( 'leftover_messages', $leftover_messages );
			$this->assign( 'selected_locale', $selected_raw_locale );
			$this->assign( 'selected_charset', $this->filter_post->getString( 'charset' ) );
		}
		catch ( \Sifo\Exception_500 $exception )
		{
			$this->assign( 'error', $exception->getMessage() );
		}
	}
769768
public function getLocales()
	{
		$currentLocales = array();
		
		foreach($this->localeCategories as $category) {
			if($category === LC_ALL)
				continue;
			
			$currentLocales[$category] = setlocale($category, 0);
		}
		
		return $currentLocales;
	}
517367
public function geti18nStyles()
    {
        $i18nStyles = [];
        foreach ($this->styles as $key => $label) {
            $i18nStyles[$key] = _t(__CLASS__ . '.STYLE' . strtoupper($key), $label);
        }
        $this->extend('updatei18nStyles', $i18nStyles);
        return $i18nStyles;
    }
950147
public function getLocales()
    {
        $entities = [];
        if ($this->entity->getLocales()) {
            foreach ($this->entity->getLocales() as $locale) {
                $entities[] = new ContactLocale($locale);
            }
        }

        return $entities;
    }
1029902
public function getSiblingLocales()
    {
        $domain = $this->getDomain();
        $locales = $domain
            ? $domain->getLocales()
            : Locale::getCached();
        return $locales;
    }
1310780
protected function prepareOptionLocal()
    {
        $local = $this->defaultLocal;
        foreach ($local as $key => $value) {
            if (!empty($this->local[$key]) && is_string($this->local[$key])) {
                $value = $this->local[$key];
            }
            $local[$key] = Yii::t($this->translateCategory, $value);
        }

        $shortlocal = [];
        $shortNames = [
            'allRecords'        => 'allr',
            'error'             => 'erro',
            'minimumCharacters' => 'mcha',
            'next'              => 'next',
            'noRecords'         => 'nrec',
            'previous'          => 'prev',
            'recordsContaining' => 'rcon',
        ];
        foreach ($local as $key => $value) {
            if (isset($shortNames[$key])) {
                $shortlocal[$shortNames[$key]] = $value;
            } else {
                $shortlocal[$key] = $value;
            }
        }

        return $shortlocal;
    }
121506
public static function activeLocales(): array
    {
        $locales = app(ModuleService::class)
            ->findByInterface(ModuleLanguageInterface::class, false, true)
            ->map(static function (ModuleLanguageInterface $module): LocaleInterface {
                return $module->locale();
            });

        if ($locales->isEmpty()) {
            return [new LocaleEnUs()];
        }

        return $locales->all();
    }