Example usage for java.util Locale.Builder Locale.Builder

List of usage examples for java.util Locale.Builder Locale.Builder

Introduction

In this page you can find the example usage for java.util Locale.Builder Locale.Builder.

Prototype

Locale.Builder

Source Link

Usage

From source file:com.carlomicieli.jtrains.value.objects.LocalizedField.java

private static Locale localeFromKey(String key) {
    return new Locale.Builder().setLanguage(key).build();
}

From source file:org.apache.marmotta.kiwi.persistence.KiWiConnection.java

protected static Locale getLocale(String language) {
    Locale locale = localeMap.get(language);
    if (locale == null && language != null && !language.isEmpty()) {
        try {// w ww. ja va  2 s  .  c  o m
            Locale.Builder builder = new Locale.Builder();
            builder.setLanguageTag(language);
            locale = builder.build();
            localeMap.put(language, locale);
        } catch (IllformedLocaleException ex) {
            throw new IllegalArgumentException("Language was not a valid BCP47 language: " + language, ex);
        }
    }
    return locale;
}