Package com.castlabs.utils

# Class LanguageUtils

java.lang.Object
com.castlabs.utils.LanguageUtils

public class LanguageUtils extends Object
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

  Constructors
  Constructor
  Description
  `LanguageUtils()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Locale`
  `fromString(String languageTag)`
  Translates simple language tags like "en" or "en-EN" into `Locale`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.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### LanguageUtils

    public LanguageUtils()

- ## Method Details

  - ### fromString

    public static Locale fromString(String languageTag)
    Translates simple language tags like "en" or "en-EN" into `Locale`s. NOTE that if you are using Android API >= 21 and Java 7, you can use the more powerful `Locale.forLanguageTag(String)`.
    Parameters:
      `languageTag` - in complete form (e.g. "en-EN") or in truncated ("en")
    Returns:
      Locale instance

  - ### mapISO6392BtoISO6392T

    @NonNull public static String mapISO6392BtoISO6392T(@NonNull 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. 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