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.
Constructor Summary |
private |
Languages()
Make the class a true utility class by having a private constructor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
Languages
private Languages()
- Make the class a true utility class by having a private constructor.
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