Gets all the locales available in the application.

@return list of locale representation or 204 (no content)
770992
@GET
    @Produces(MediaType.APPLICATION_JSON)
    @RequiresPermissions(I18nPermissions.LOCALE_READ)
    public Response getAvailableLocales() {
        List<LocaleRepresentation> availableLocales = localeFinder.findAvailableLocales();
        if (!availableLocales.isEmpty()) {
            return Response.ok(availableLocales).build();
        }
        return Response.noContent().build();
    }
104609
def allLocales(self):
        
        if self._allLocales:
            return self._allLocales
        
        expr = re.compile('[a-z]+_[A-Z]+')
        locales = babel.core.localedata.locale_identifiers()
        babel_locales = {}
        for locale in locales:
            if expr.match(locale):
                babel_locale = babel.Locale.parse(locale)
                if babel_locale.territory and babel_locale.language:
                    babel_locales[babel_locale.territory] = babel_locale
        
        babel_locales = babel_locales.values()
        babel_locales.sort(key=str)
        self._allLocales = babel_locales
        return self._allLocales
223407
public Locale getLocale()
    {
        Enumeration enm = _httpRequest.getFieldValues(HttpFields.__AcceptLanguage,
                                                       HttpFields.__separators);

        // handle no locale
        if (enm == null || !enm.hasMoreElements())
            return Locale.getDefault();
        
        // sort the list in quality order
        List acceptLanguage = HttpFields.qualityList(enm);
        if (acceptLanguage.size()==0)
            return  Locale.getDefault();

        int size=acceptLanguage.size();
        
        // convert to locals
        for (int i=0; i<size; i++)
        {
            String language = (String)acceptLanguage.get(i);
            language=HttpFields.valueParameters(language,null);
            String country = "";
            int dash = language.indexOf('-');
            if (dash > -1)
            {
                country = language.substring(dash + 1).trim();
                language = language.substring(0,dash).trim();
            }
            return new Locale(language,country);
        }

        return  Locale.getDefault();
    }
1178604
public Set<String> getLanguages() {
        Set<String> result = new HashSet<String>();
        for (QueryParser parser : parsers.values()) {
            result.add(parser.getLanguage());
        }
        return Collections.unmodifiableSet(result);
    }
337658
private Collection<Locale> initLocales() {

        Collection<Locale> locales = null;
        switch (m_bundleType) {
            case DESCRIPTOR:
                locales = new ArrayList<Locale>(1);
                locales.add(Descriptor.LOCALE);
                break;
            case XML:
            case PROPERTY:
                locales = OpenCms.getLocaleManager().getAvailableLocales(m_cms, m_resource);
                break;
            default:
                throw new IllegalArgumentException();
        }
        return locales;

    }
955428
public function getAllLocalizations()
    {
        $localizations = [];
        foreach ($this->getLocalizations() as $child) {
            $localizations[] = $child;
            $localizations = array_merge($localizations, $child->getAllLocalizations());
        }

        return $localizations;
    }
569845
public ULocale[] getAvailableULocales() {
        Set<String> keys = getLocaleIdToRulesIdMap(PluralType.CARDINAL).keySet();
        ULocale[] locales = new ULocale[keys.size()];
        int n = 0;
        for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
            locales[n++] = ULocale.createCanonical(iter.next());
        }
        return locales;
    }
137226
public static List<Locale> getLocalesFromHeader(final String acceptLanguage) {
        if(acceptLanguage == null) {
            return Collections.emptyList();
        }
        return getLocalesFromHeader(Collections.singletonList(acceptLanguage));
    }
1311998
private List<Locale> extractLocales(List<List<String>> allLangs) {
        List<Locale> rc = new ArrayList<Locale>();
        for (List<String> langList : allLangs) {
            for (String language : langList) {
                String country = "";
                String variant = "";
                int countryIndex = language.indexOf('-');
                if (countryIndex > -1) {
                    int variantIndex = language.indexOf('-', (countryIndex + 1));
                    if (variantIndex > -1) {
                        variant = language.substring(variantIndex + 1).trim();
                        country = language.substring(countryIndex, variantIndex).trim();
                    } else {
                        country = language.substring(countryIndex + 1).trim();
                    }
                    language = language.substring(0, countryIndex).trim();
                }

                rc.add(new Locale(language, country, variant));
            }
        }

        return rc;
    }
735955
private function getAvailableLocales()
    {
        if (empty($this->availableLocales)) {
            // Open the pages directory.
            $pagesDirectory = opendir('../data/pages/');
            while ($directory = readdir($pagesDirectory)) {
                if (($directory != '.') && ($directory != '..')) {
                    $this->availableLocales[] = $directory;
                }
            }
            closedir($pagesDirectory);
        }

        return $this->availableLocales;
    }
1181620
public Locale[] getAvailableLocales() {
        // TODO make this wrap getAvailableULocales later
        Set<String> visIDs = getVisibleIDs();
        Locale[] locales = new Locale[visIDs.size()];
        int n = 0;
        for (String id : visIDs) {
            Locale loc = LocaleUtility.getLocaleFromName(id);
            locales[n++] = loc;
        }
        return locales;
    }
988876
public Collection<Locale> getCountries() {
        Collection<Locale> result = get(KEY_QUERY_COUNTRIES, Collection.class);
        if (result == null) {
            return Collections.emptySet();
        }
        return result;
    }
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;
    }
84140
@GET
    @Produces(MediaType.APPLICATION_JSON)
    @RequiresPermissions(I18nPermissions.LOCALE_READ)
    public Response getSupportedLocales() {
        List<LocaleRepresentation> locales = supportedLocaleFinder.findSupportedLocales();
        if (!locales.isEmpty()) {
			return Response.ok(locales).build();
		}
        return Response.noContent().build();
    }
1008738
public Map<String, String> getAll(final Locale locale) {
        Map<String, String> ret = LANGS.get(locale);
        if (null == ret) {
            ret = new HashMap<>();
            final ResourceBundle defaultLangBundle = ResourceBundle.getBundle(Keys.LANGUAGE, Latkes.getLocale());
            final Enumeration<String> defaultLangKeys = defaultLangBundle.getKeys();
            while (defaultLangKeys.hasMoreElements()) {
                final String key = defaultLangKeys.nextElement();
                final String value = replaceVars(defaultLangBundle.getString(key));

                ret.put(key, value);
            }

            final ResourceBundle langBundle = ResourceBundle.getBundle(Keys.LANGUAGE, locale);
            final Enumeration<String> langKeys = langBundle.getKeys();
            while (langKeys.hasMoreElements()) {
                final String key = langKeys.nextElement();
                final String value = replaceVars(langBundle.getString(key));

                ret.put(key, value);
            }

            LANGS.put(locale, ret);
        }

        return ret;
    }
831492
public static List<Locale> getLocales(String localeNames) {

        if (localeNames == null) {
            return null;
        }
        return getLocales(CmsStringUtil.splitAsList(localeNames, ','));
    }
379430
public static function languagesLocaleCodes()
    {
        static $list;

        if ($list === null) {
            $list = [];
            foreach (static::codes() as $localeCode) {
                if ($languageCode = static::languageCode($localeCode)) {
                    $list[$languageCode][] = $localeCode;
                }
            }
        }

        return $list;
    }