Android Utililty Methods Language Get

List of utility methods to do Language Get

Description

The list of methods to do Language Get are organized into topic(s).

Method

StringlanguagePrefix()
language Prefix
final String language = Locale.getDefault().getLanguage();
if ("de".equals(language))
    return "_de";
else if ("cs".equals(language))
    return "_cs";
else if ("el".equals(language))
    return "_el";
else if ("es".equals(language))
...
StringdefaultLanguageCode()
default Language Code
return Locale.getDefault().getLanguage();
StringlanguageByIntCode(int languageCode, int subLanguageCode)
language By Int Code
switch (languageCode) {
default:
    return null;
case 0x01:
    return "ar"; 
case 0x02:
    return "bg"; 
case 0x03:
...
StringlanguageByCode(int languageCode, int subLanguageCode)
language By Code
switch (languageCode) {
default:
    return null;
case 0x01:
    return "ar"; 
case 0x02:
    return "bg"; 
case 0x03:
...
StringtoLanguageTag(Locale locale)
to Language Tag
StringBuilder languageTag = new StringBuilder();
languageTag.append(locale.getLanguage());
if (!isNullOrEmpty(locale.getCountry())) {
    languageTag.append('-').append(locale.getCountry());
if (!isNullOrEmpty(locale.getVariant())) {
    languageTag.append('-').append(locale.getVariant());
return languageTag.toString();
StringgetCurrentLanguage()
get Current Language
return Locale.getDefault().getLanguage();