Skip to content

Commit

Permalink
Updating ActionBar title. Save button is now Undo.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyr59h committed Jul 14, 2015
1 parent fcf0b6f commit 05d9908
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;

public class StringUtils {
public static String[] mergeStringArrays(String array1[], String array2[]) {
Expand Down Expand Up @@ -228,6 +229,28 @@ public static String replaceUnicodeSurrogateBlocksWithHTMLEntities(final String
return out.toString();
}

/**
* Used to convert a language code ([lc]_[rc] where lc is language code (en, fr, es, etc...)
* and rc is region code (zh-CN, zh-HK, zh-TW, etc...) to a displayable string with the languages
* name.
*
* The input string must be between 2 and 6 characters, inclusive. An empty string is returned
* if that is not the case.
*
* If the input string is recognized by {@link Locale} the result of this method is the given
*
* @return
* non-null
*/
public static String getLanguageString(String languagueCode, Locale displayLocale) {
if (languagueCode == null || languagueCode.length() < 2 || languagueCode.length() > 6) {
return "";
}

Locale languageLocale = new Locale(languagueCode.substring(0, 2));
return languageLocale.getDisplayLanguage(displayLocale) + languagueCode.substring(2);
}

/**
* This method ensures that the output String has only
* valid XML unicode characters as specified by the
Expand Down

0 comments on commit 05d9908

Please sign in to comment.