Verifies if the give locale is in the Java list of known locales.

@param locale
Locale to verify.

@return TRUE if the locale is known else FALSE.
770791
public static boolean validLocale(final Locale locale) {
        for (final Locale found : Locale.getAvailableLocales()) {
            if (found.equals(locale)) {
                return true;
            }
        }
        return false;
    }
1217995
public void setLocale(Locale locale)
  {
    if(locale != null && report != null && report instanceof LocalizableReport) 
    {
      ((LocalizableReport) report).setLocale(locale); 
    }
  }
245268
public static Locale getLocaleFromString(String locale) throws LocaleException {
		for(Locale l : Locale.getAvailableLocales()) {
			if(locale.toLowerCase().equals(l.toString().toLowerCase())) {
				return l;
			}
		}
		throw new LocaleException();
	}
244529
public static function hasDependency($locale) {
		$locale = PropelL10n::normalize($locale);
		return isset(self::$dependencies[$locale]);
	}
650461
public function locale($locale = null)
    {
        if ($locale) {
            $this->_locale = $locale;
        }
        if ($this->_locale) {
            return $this->_locale;
        }
        if (isset($this->_params['locale'])) {
            return $this->_params['locale'];
        }
    }
613285
public boolean matchesLocale(String loc) {
		return getLocale()==null || (getLocale().isPresent() && getLocale().get().startsWith(loc));
	}
794179
public boolean isMarkedNoTranslation(Locale locale) {

        if (m_noTranslation != null) {
            return CmsLocaleManager.getLocales(m_noTranslation).contains(locale);
        }
        return false;
    }
319901
public Translation get(String locale) {
        locale = locale.replace("-", "_");
        Translation tr = translations.get(locale);
        if (locale.contains("_") && tr == null)
            tr = translations.get(locale.substring(0, 2));

        return tr;
    }
656030
private function hasLocale(string $locale): bool
    {
        assert(empty($locale) === false);

        $result = in_array($locale, $this->getLocales());

        return $result;
    }
729693
public function hasTranslation($locale = null)
    {
        $locale = $locale ?: \localizer\locale()->id();

        foreach ($this->cachedTranslations() as $translation) {
            if ((int) $translation->getAttribute($this->getLocaleKey()) === (int) $locale) {
                return true;
            }
        }

        return false;
    }
867715
public void setLocale(Locale locale) {
		if (!initialized) {
			super.setLocale(locale);
		} else {
			this.locale = locale;
			super.setLocale(locale);
			init();
		}
	}
1318368
public function hasTranslation($keyName, ?LocaleTransfer $locale = null)
    {
        return $this->glossaryFacade->hasTranslation($keyName, $locale);
    }
593299
public boolean hasResource(String name, Locale locale) {
        name = UrlUtils.cleanName(name);
        locale = cleanLocale(locale);
        return stringLoader.exists(name, locale) || loader.exists(name, locale);
    }
512432
static GJLocaleSymbols forLocale(Locale locale) {
        if (locale == null) {
            locale = Locale.getDefault();
        }
        GJLocaleSymbols symbols = cCache.get(locale);
        if (symbols == null) {
            symbols = new GJLocaleSymbols(locale);
            GJLocaleSymbols oldSymbols = cCache.putIfAbsent(locale, symbols);
            if (oldSymbols != null) {
                symbols = oldSymbols;
            }
        }
        return symbols;
    }
215629
public static LocaleData get(Locale locale) {
        if (locale == null) {
            throw new NullPointerException("locale == null");
        }

        final String languageTag = locale.toLanguageTag();
        synchronized (localeDataCache) {
            LocaleData localeData = localeDataCache.get(languageTag);
            if (localeData != null) {
                return localeData;
            }
        }
        LocaleData newLocaleData = initLocaleData(locale);
        synchronized (localeDataCache) {
            LocaleData localeData = localeDataCache.get(languageTag);
            if (localeData != null) {
                return localeData;
            }
            localeDataCache.put(languageTag, newLocaleData);
            return newLocaleData;
        }
    }
1053242
public static LocalizedMessages getInstance(Locale locale)
  {
    LocalizedMessages instance = null;

    if (locale == null)
    {
      locale = Locale.getDefault();
    }

    String localeKey = locale.getLanguage();
    if (localizedMessages.containsKey(localeKey))
    {
      instance = localizedMessages.get(localeKey);
    } 
    else
    {
      synchronized (LocalizedMessages.class)
      {
        if (instance == null)
        {
          instance = new LocalizedMessages(locale);
          localizedMessages.put(localeKey, instance);
        }
      }
    }

    return instance;
  }
1170004
public function setLocale($locale)
    {
        //Check if we have information for this locale
        $file = __DIR__ . '/i18n/' . $locale . '.json';
        if (file_exists($file)) {
            //Read the locale information from the file
            $meta = json_decode(file_get_contents($file), true);
            if (is_array($meta)) {
                $this->locale = $meta;

                return true;
            } else {
                throw new LocaleParseErrorException('Locale "' . $locale . '" could not be parsed correctly');
            }
        } else {
            throw new LocaleNotSupportedException('Locale not supported by this library');
        }
    }