org.crosswire.common.util
Class Languages

java.lang.Object
  extended by 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 getLanguage(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.

getLanguage

public static String getLanguage(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). Otherwise, it will generate a log message and return unknown. 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

Copyright ยจ 2003-2007