Obtains the symbols for a locale.

@param locale  the locale, null returns default
@return the symbols, not null
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;
    }
191760
public static String getEncodingFromLocale(Locale locale) {
    	init();
        if (locale == cachedLocale) {
            return cachedEncoding;
        }

        String encoding = null;
        /*(String) _localeMap.get(locale.toString());

        if (encoding == null) {
            encoding = (String) _localeMap.get(locale.getLanguage() + "_" + locale.getCountry());

            if (encoding == null) {
                encoding = (String) _localeMap.get(locale.getLanguage());
            }            
        }*/
        if (encoding == null) {
            //check the com.ibm.wsspi.http.EncodingUtils
            com.ibm.wsspi.http.EncodingUtils encodingUtils = com.ibm.ws.webcontainer.osgi.WebContainer.getEncodingUtils();
            if (encodingUtils!=null) {
                encoding = encodingUtils.getEncodingFromLocale(locale);
            }
        }

        cachedEncoding = encoding;
        cachedLocale = locale;

        return encoding;
    }
1098982
public static ResourceBundle getCurrentResourceBundle(String locale) {
		try {
			if (null != locale && !locale.isEmpty()) {
				return getCurrentResourceBundle(LocaleUtils.toLocale(locale));
			}
		} catch (IllegalArgumentException ex) {
			// do nothing
		}
		return getCurrentResourceBundle((Locale) null);
	}
1245720
public Properties getProperties(final Locale locale) {
        Resource url = this.baseResourcesResource;
        Properties properties = null;
        if(url != null) {
            StaticResourceLoader resourceLoader = new StaticResourceLoader();
            resourceLoader.setBaseResource(url);
            ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(resourceLoader);
            try {
                // first load all properties
                Resource[] resources = resolver.getResources('*' + PROPERTIES_EXTENSION);
                resources = resources.length > 0 ? filterResources(resources, locale) : resources;
                if(resources.length > 0) {
                    properties = new Properties();

                    // message bundles are locale specific. The more underscores the locale has the more specific the locale
                    // so we order by the number of underscores present so that the most specific appears
                    Arrays.sort(resources, (o1, o2) -> {
                        String f1 = o1.getFilename();
                        String f2 = o2.getFilename();

                        int firstUnderscoreCount = StringUtils.countOccurrencesOf(f1, "_");
                        int secondUnderscoreCount = StringUtils.countOccurrencesOf(f2, "_");

                        if(firstUnderscoreCount == secondUnderscoreCount) {
                            return 0;
                        }
                        else {
                            return firstUnderscoreCount > secondUnderscoreCount ?  1 : -1;
                        }
                    });

                    loadFromResources(properties, resources);
                }
            } catch (IOException e) {
                return null;
            }
        }
        return properties;
    }
1111136
public String getDisplayName(final String locale) {
        if (this.uiInfo != null) {
            val displayName = getLocalizedValues(locale, this.uiInfo.getDisplayNames());
            return displayName != null ? displayName : super.getDisplayName();
        }
        return super.getDisplayName();
    }
831492
public static List<Locale> getLocales(String localeNames) {

        if (localeNames == null) {
            return null;
        }
        return getLocales(CmsStringUtil.splitAsList(localeNames, ','));
    }
1293719
public static String toUpperCase(String string, Locale locale) {

    if (locale == null) {
      return toUpperCase(string, STANDARD_LOCALE);
    }
    return string.toUpperCase(locale);
  }
17369
public static Locale parseLocale(String localeString) {
    if (localeString == null) {
      return Locale.US;
    }
    String[] groups = localeString.split("[-_]");
    switch (groups.length) {
      case 1:
        return new Locale(groups[0]);
      case 2:
        return new Locale(groups[0], Ascii.toUpperCase(groups[1]));
      case 3:
        return new Locale(groups[0], Ascii.toUpperCase(groups[1]), groups[2]);
      default:
        throw new IllegalArgumentException("Malformed localeString: " + localeString);
    }
  }
1207865
public function getMessages($locale = null)
    {
        return $locale === null ? $this->messages : $this->messages[$locale];
    }
1236687
public Iterable<Di18n> queryByLocale(java.lang.String locale) {
    return queryByField(null, Di18nMapper.Field.LOCALE.getFieldName(), locale);
  }
120470
public Locale parseLocale(String localeString) {
        String language = null;
        String country = null;
        String variant = null;

        // Sometimes people specify "en-US" instead of "en_US", so
        // we'll try to clean that up.
        localeString = localeString.replaceAll("-", "_");

        StringTokenizer st = new StringTokenizer(localeString, "_");

        if (st.hasMoreTokens()) {
            language = st.nextToken();
        }
        if (st.hasMoreTokens()) {
            country = st.nextToken();
        }
        if (st.hasMoreTokens()) {
            variant = st.nextToken();
        }

        Locale locale = null;

        if (variant != null) {
            locale = new Locale(language, country, variant);
        } else if (country != null) {
            locale = new Locale(language, country);
        } else if (language != null) {
            locale = new Locale(language);
        }

        return locale;
    }
993290
MessageResource loadResource(final Locale locale) {

        if(locale == null) {
            return defaultResource;
        }

        if(resources.containsKey(locale)) {
            return resources.get(locale);
        }

        MessageResource localeResource = null;
        synchronized (resources) {
            for(String path : getPropertyPath(locale)) {

                try {
                    final Properties props = new Properties();
                    props.load(new InputStreamReader(MessageResolver.class.getResourceAsStream(path), "UTF-8"));

                    localeResource = new MessageResource();

                    final Enumeration<?> keys = props.propertyNames();
                    while(keys.hasMoreElements()) {
                        String key = (String) keys.nextElement();
                        String value = props.getProperty(key);
                        localeResource.addMessage(key, value);
                    }

                    // ユーザのリソースの読み込み
                    if(appendUserResource) {
                        localeResource.addMessage(loadUserResource(path));
                    }

                    break;

                } catch(NullPointerException | IOException e) {
                    continue;
                }

            }

            if(localeResource == null) {
                // 該当するリソースが見つからない場合は、デフォルトの値を返す。
                localeResource = defaultResource;
            }

            resources.put(locale, localeResource);
        }

        return localeResource;

    }
1211232
private static final String getNlsKey(String resourceBundle, Locale locale) {
        return new StringBuffer(resourceBundle).append("#").append(locale.toString()).toString();
    }
238249
@GET
    @Path("/{locale}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response getTranslations(@PathParam("locale") String locale) {
        Map<String, String> messages = getMessages(locale);
        if (!messages.isEmpty()) {
			return Response.ok(messages).build();
		}
        return Response.ok("{}").build();
    }
1363603
public String getDisplayLanguage(Locale locale) {
        String languageCode = baseLocale.getLanguage();
        if (languageCode.isEmpty()) {
            return "";
        }

        // Hacks for backward compatibility.
        //
        // Our language tag will contain "und" if the languageCode is invalid
        // or missing. ICU will then return "langue indéterminée" or the equivalent
        // display language for the indeterminate language code.
        //
        // Sigh... ugh... and what not.
        final String normalizedLanguage = normalizeAndValidateLanguage(
                languageCode, false /* strict */);
        if (UNDETERMINED_LANGUAGE.equals(normalizedLanguage)) {
            return languageCode;
        }

        // TODO: We need a new hack or a complete fix for http://b/8049507 --- We would
        // cover the frameworks' tracks when they were using "tl" instead of "fil".
        String result = ICU.getDisplayLanguage(this, locale);
        if (result == null) { // TODO: do we need to do this, or does ICU do it for us?
            result = ICU.getDisplayLanguage(this, Locale.getDefault());
        }
        return result;
    }
1326448
protected function getCurrentLocale($locale = null)
    {
        return null !== $locale
            ? LocaleUtils::formatLocale($locale)
            : $this->getLocale();
    }
386315
public static final function configuration(string $locale) {
    if (!empty($locale)) {
      Lang::$locale = $locale;
    } else {
      Lang::$locale = Lang::STANDARD_LOCALE;
    }
    return null;
  }