Class LanguageTags

java.lang.Object
org.apache.fop.util.LanguageTags

public final class LanguageTags extends Object
Provides utility methods for manipulating language tags compliant with the RFC 3066 specification available at http://www.ietf.org/rfc/rfc3066.txt. A typical language tag is a 2-letter language code sometimes followed by a country code. For example: en, en-US.
  • Method Details

    • toLanguageTag

      public static String toLanguageTag(Locale locale)
      Converts the given locale to an RFC 3066 compliant language tag.
      Parameters:
      locale - a locale
      Returns:
      the corresponding language tag
    • toLocale

      public static Locale toLocale(String languageTag)
      Converts an RFC 3066 compliant language tag to a locale.
      Parameters:
      languageTag - language tag to convert
      Returns:
      the corresponding locale