Package com.castlabs.utils
Class LanguageUtils
java.lang.Object
com.castlabs.utils.LanguageUtils
This object contains enums and utilities for working with language tags. Language tags are
defined as in [RFC 5646] and the matching criteria as in [RFC 4647]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Locale
fromString
(String languageTag) Translates simple language tags like "en" or "en-EN" intoLocale
s.static String
mapISO6392BtoISO6392T
(String langCode) Locale supports only ISO 639-2/T and not ISO 639-2/B thus failing for languages whose two codes differ, e.g.
-
Constructor Details
-
LanguageUtils
public LanguageUtils()
-
-
Method Details
-
fromString
Translates simple language tags like "en" or "en-EN" intoLocale
s. NOTE that if you are using Android API >= 21 and Java 7, you can use the more powerfulLocale.forLanguageTag(String)
.- Parameters:
languageTag
- in complete form (e.g. "en-EN") or in truncated ("en")- Returns:
- Locale instance
-
mapISO6392BtoISO6392T
Locale supports only ISO 639-2/T and not ISO 639-2/B thus failing for languages whose two codes differ, e.g. Chinese (zho/chi) or Czech (ces/cze) only one of the two is supported.This method remaps the values. Mapping extracted from: http://www.loc.gov/standards/iso639-2/php/English_list.php
-