|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.common.util.Language
public class Language
An immutable Language by specification. The specifier consists of up to three parts:
for license details.
The copyright to this program is held by it's authors.
Nested Class Summary | |
---|---|
private static class |
Language.CanonicalUtils
Converts substrings to the canonical representation for language code, script and country. |
Field Summary | |
---|---|
private String |
code
The lower case iso639 language code. |
private String |
country
The UPPER case iso3166 country code. |
static Language |
DEFAULT_LANG
The default language is English. |
static String |
DEFAULT_LANG_CODE
The default language code is en for English. |
private String |
found
The effective specification. |
private String |
given
The original specification provided by the user. |
private boolean |
knowsDirection
|
private boolean |
ltor
|
private String |
name
The name as defined by Languages. |
private String |
script
The Title case iso15924 script code. |
static String |
UNKNOWN_LANG_CODE
The language code for invalid language specifications is und for Undetermined. |
private boolean |
valid
Flag to store whether the code is valid. |
Constructor Summary | |
---|---|
Language(String specification)
A single language defined by an ISO-639 code. |
Method Summary | |
---|---|
private boolean |
compareStrings(String a,
String b)
Equal if both a and b are the same. |
int |
compareTo(Language o)
|
boolean |
equals(Object obj)
|
String |
getCode()
Get the iso639 language code. |
String |
getCountry()
Get the iso3166 script for the language. |
String |
getFoundSpecification()
The specification that was given might not be be the one that ultimately gets the name. |
String |
getGivenSpecification()
The specification that was given might not be be the one that ultimately gets the name. |
String |
getName()
Get the localized language name. |
String |
getScript()
Get the iso15924 script for the language. |
int |
hashCode()
|
boolean |
isLeftToRight()
Determine whether this language is a Left-to-Right or a Right-to-Left language. |
boolean |
isValidLanguage()
Determine whether this language is valid. |
private void |
parse(String spec)
Split the specification on '-' into 1 to 3 parts. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_LANG_CODE
public static final String UNKNOWN_LANG_CODE
public static final Language DEFAULT_LANG
private String given
private String found
private String code
private String script
private String country
private String name
private boolean valid
private boolean knowsDirection
private boolean ltor
Constructor Detail |
---|
public Language(String specification)
specification
- the specifier for the particular languageMethod Detail |
---|
public String getGivenSpecification()
public String getFoundSpecification()
public boolean isValidLanguage()
public String getCode()
public String getScript()
public String getCountry()
public String getName()
public boolean isLeftToRight()
Note: This is problematic. Languages do not have direction. Scripts do. Further, there are over 7000 living languages, many of which are written in Right-to-Left scripts and are not listed here.
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public String toString()
toString
in class Object
public int compareTo(Language o)
compareTo
in interface Comparable<Language>
private void parse(String spec)
spec
- private boolean compareStrings(String a, String b)
a
- b
-
|
Copyright ? 2003-2011 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |