FileDocCategorySizeDatePackage
AndroidLocale.javaAPI DocAndroid 5.1 API1989Thu Mar 12 22:22:44 GMT 2015com.android.layoutlib.bridge.android

AndroidLocale

public class AndroidLocale extends Object
This class provides an alternate implementation for {@code java.util.Locale#toLanguageTag} which is only available after Java 6. The create tool re-writes references to the above mentioned method to this one. Hence it's imperative that this class is not deleted unless the create tool is modified.

Fields Summary
Constructors Summary
Methods Summary
public static java.lang.StringadjustLanguageCode(java.lang.String languageCode)

        String adjusted = languageCode.toLowerCase(Locale.US);
        // Map new language codes to the obsolete language
        // codes so the correct resource bundles will be used.
        if (languageCode.equals("he")) {
            adjusted = "iw";
        } else if (languageCode.equals("id")) {
            adjusted = "in";
        } else if (languageCode.equals("yi")) {
            adjusted = "ji";
        }

        return adjusted;
    
public static java.util.LocaleforLanguageTag(java.lang.String tag)

        return ULocale.forLanguageTag(tag).toLocale();
    
public static java.lang.StringgetScript(java.util.Locale locale)

        return ULocale.forLocale(locale).getScript();
    
public static java.lang.StringtoLanguageTag(java.util.Locale locale)

        return ULocale.forLocale(locale).toLanguageTag();