Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.common.util
Class Languages

    java.lang.Object
      org.crosswire.common.util.Languages

    public class Languages

extends Object

A utility class that converts ISO-639 codes or locales to their "friendly" language name.

Author:
  DM Smith [dmsmith555 at yahoo dot com]
See Also:
  `for license details. The copyright to this program is held by it's authors.`

Field Summary
`static String` | `DEFAULT_LANG_CODE`
`private static ResourceBundle` | `languages`
`private static String` | `UNKNOWN_LANG_CODE`

Constructor Summary
`private` | `Languages()` Make the class a true utility class by having a private constructor.

Method Summary
`static String` | `getLanguageCode(String input)` Get the language code from the input.
`static String` | `getLanguageName(String iso639Code)` Get the language name from the language code.
`static boolean` | `isValidLanguage(String iso639Code)` Determine whether the language code is valid.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_LANG_CODE

    public static final String DEFAULT_LANG_CODE

See Also:
  Constant Field Values

### UNKNOWN_LANG_CODE

    private static final String UNKNOWN_LANG_CODE

See Also:
  Constant Field Values

### languages

    private static ResourceBundle languages

Constructor Detail

### Languages

    private Languages()

  Make the class a true utility class by having a private constructor.

Method Detail

### isValidLanguage

    public static boolean isValidLanguage(String iso639Code)

  Determine whether the language code is valid. The code is valid if it is null or empty. The code is valid if it is in iso639.properties. If a locale is used for the iso639Code, it will use the part before the '_'. Thus, this code does not support dialects, except as found in the iso639.

  Parameters:
    `iso639Code` -
  Returns:
    true if the language is valid.

### getLanguageName

    public static String getLanguageName(String iso639Code)

  Get the language name from the language code. If the code is null or empty then it is considered to be DEFAULT_LANG_CODE (that is, English). If it starts with x- or is too long then it will return unknown. If the code's name cannot be found, it will return the code. If a locale is used for the iso639Code, it will use the part before the '_'. Thus, this code does not support dialects, except as found in the iso639.

  Parameters:
    `iso639Code` -
  Returns:
    the name of the language

### getLanguageCode

    public static String getLanguageCode(String input)

  Get the language code from the input. If the code is null or empty then it is considered to be DEFAULT_LANG_CODE (that is, English). If a locale is used for the iso639Code, it will use the part before the '_'. Thus, this code does not support dialects, except as found in the iso639. If it is known to be unknown then return unknown. Otherwise, return the 2 or 3 letter code. Note: it might not be valid.

  Parameters:
    `input` -
  Returns:
    the code for the language

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¨ 2003-2007
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD