src/i18n/Data/Intl/IntlLocales.php
public function getCountries()
    {
        // Cache by locale
        $locale = i18n::get_locale();
        if (!empty(static::$cache_countries[$locale])) {
            return static::$cache_countries[$locale];
        }

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

        // Always sort by localised name, not key
        $collator = new Collator(i18n::get_locale());
        $collator->asort($localised);
        static::$cache_countries[$locale] = $localised;
        return $localised;
    }
public function getCountries()
    {
        // Cache by locale
        $locale = i18n::get_locale();
        if (!empty(static::$cache_countries[$locale])) {
            return static::$cache_countries[$locale];
        }

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

        // Always sort by localised name, not key
        $collator = new Collator(i18n::get_locale());
        $collator->asort($localised);
        static::$cache_countries[$locale] = $localised;
        return $localised;
    }
public function getCountries ( ) { // Cache by locale $ locale = i18n :: get_locale ( ) ; if ( ! empty ( static :: $ cache_countries [ $ locale ] ) ) { return static :: $ cache_countries [ $ locale ] ; } // Localise all countries $ countries = $ this -> config ( ) -> get ( 'countries' ) ; $ localised = [ ] ; foreach ( $ countries as $ code => $ default ) { $ localised [ $ code ] = $ this -> countryName ( $ code ) ; } // Always sort by localised name, not key $ collator = new Collator ( i18n :: get_locale ( ) ) ; $ collator -> asort ( $ localised ) ; static :: $ cache_countries [ $ locale ] = $ localised ; return $ localised ; }
Get all country codes and names

@return array Map of country code => name
Get all country codes and names