Package org.compiere.util
Class Language
java.lang.Object
org.compiere.util.Language
- All Implemented Interfaces:
Serializable
Language Management.
- Version:
- $Id: Language.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $
- Author:
- Jorg Janke
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Equals.Get Application Dictionary Language (system supported).static String
getAD_Language
(String langInfo) Get Language from langInfostatic String
getAD_Language
(Locale locale) Get Language code from localestatic String
Get Base Language code.static Language
Get Base LanguageGet (Short) Date Format.Get Date Time Format.Get Database Date Pattern.
Derive from date pattern (make upper case and replace month as word with MM)static Language
getLanguage
(int index) Get Languagestatic Language
getLanguage
(String langInfo) Get Language.
If language does not exist, create it on the fly assuming that it is validGet Language Code.static int
Get Number of LanguagesGet Localestatic Locale
Get Locale from langInfostatic Language
Get Current Login LanguageGet default MediaSizegetName()
Get Language Name.static String
Get Language Name from langInfostatic String[]
getNames()
Get Display names of supported languagesGet Time Format.int
hashCode()
Hash Codeboolean
Is This the Base Languagestatic boolean
isBaseLanguage
(String langInfo) Is it the base languageboolean
Returns true if Decimal Point (not comma)static boolean
isDecimalPoint
(String langInfo) Returns true if Decimal Point (not comma)boolean
Component orientation is Left To Rightvoid
setAD_Language
(String AD_Language) Set Application Dictionary Language (system supported).static void
setBaseLanguage
(String baselang) Set baselang as base languagevoid
setDateFormat
(String javaDatePattern) Set Date Format Pattern.
The date format is not checked for correctnessvoid
Overwrite Localestatic void
setLoginLanguage
(Language language) Set Current Login Languagevoid
setMediaSize
(MediaSize size) Set default MediaSizetoString()
String Representation
-
Constructor Details
-
Language
public Language(String name, String AD_Language, Locale locale, Boolean decimalPoint, String javaDatePattern, MediaSize mediaSize) Define Language- Parameters:
name
- - displayed value, e.g. EnglishAD_Language
- - the code of system supported language, e.g. en_US (might be different than Locale - i.e. if the system does not support the language)locale
- - the Locale, e.g. Locale.USdecimalPoint
- true if Decimal Point - if null, derived from LocalejavaDatePattern
- Java date pattern as not all locales are defined - if null, derived from LocalemediaSize
- default media size
-
Language
Define Language with AD_Language and default decimal point and date format- Parameters:
name
- - displayed value, e.g. EnglishAD_Language
- - the code of system supported language, e.g. en_US (might be different than Locale - i.e. if the system does not support the language)locale
- - the Locale, e.g. Locale.US
-
Language
Copy constructor- Parameters:
copy
-
-
-
Method Details
-
getLanguageCount
public static int getLanguageCount()Get Number of Languages- Returns:
- Language count
-
getLanguage
Get Language- Parameters:
index
- index- Returns:
- Language
-
getLanguage
Get Language.
If language does not exist, create it on the fly assuming that it is valid- Parameters:
langInfo
- either language (en) or locale (en-US) or display name- Returns:
- Name (e.g. Deutsch)
-
setBaseLanguage
Set baselang as base language- Parameters:
baselang
-
-
isBaseLanguage
Is it the base language- Parameters:
langInfo
- either language (en) or locale (en-US) or display name- Returns:
- true if base language
-
getBaseLanguage
Get Base Language- Returns:
- Base Language
-
getBaseAD_Language
Get Base Language code. (e.g. en-US)- Returns:
- Base Language
-
getLocale
Get Locale from langInfo- Parameters:
langInfo
- either language (en) or locale (en-US) or display name- Returns:
- Locale
-
getAD_Language
Get Language from langInfo- Parameters:
langInfo
- either language (en) or locale (en-US) or display name- Returns:
- AD_Language (e.g. en-US)
-
getAD_Language
Get Language code from locale- Parameters:
locale
- Locale- Returns:
- AD_Language (e.g. en-US)
-
getName
Get Language Name from langInfo- Parameters:
langInfo
- either language (en) or locale (en-US) or display name- Returns:
- Language Name (e.g. English)
-
isDecimalPoint
Returns true if Decimal Point (not comma)- Parameters:
langInfo
- either language (en) or locale (en-US) or display name- Returns:
- use of decimal point
-
getNames
Get Display names of supported languages- Returns:
- Array of Language names
-
getLoginLanguage
Get Current Login Language- Returns:
- login language
-
setLoginLanguage
Set Current Login Language- Parameters:
language
- language
-
getName
Get Language Name. e.g. English- Returns:
- name
-
getAD_Language
Get Application Dictionary Language (system supported). e.g. en-US- Returns:
- AD_Language
-
setAD_Language
Set Application Dictionary Language (system supported).- Parameters:
AD_Language
- e.g. en-US
-
getLocale
Get Locale- Returns:
- locale
-
setLocale
Overwrite Locale- Parameters:
locale
- locale
-
getLanguageCode
Get Language Code. e.g. en - derived from Locale- Returns:
- language code
-
isLeftToRight
public boolean isLeftToRight()Component orientation is Left To Right- Returns:
- true if left-to-right
-
isDecimalPoint
public boolean isDecimalPoint()Returns true if Decimal Point (not comma)- Returns:
- use of decimal point
-
isBaseLanguage
public boolean isBaseLanguage()Is This the Base Language- Returns:
- true if base Language
-
setDateFormat
Set Date Format Pattern.
The date format is not checked for correctness- Parameters:
javaDatePattern
- for details see java.text.SimpleDateFormat, format must be able to be converted to database date format by using the upper case function. It also must have leading zero for day and month.
-
getDateFormat
Get (Short) Date Format.- Returns:
- date format MM/dd/yyyy - dd.MM.yyyy
-
getDateTimeFormat
Get Date Time Format.- Returns:
- Date Time format MMM d, yyyy h:mm:ss a z -or- dd.MM.yyyy HH:mm:ss z -or- j nnn aaaa, H' ?????? 'm' ????'
-
getTimeFormat
Get Time Format.- Returns:
- Time format h:mm:ss z or HH:mm:ss z
-
getDBdatePattern
Get Database Date Pattern.
Derive from date pattern (make upper case and replace month as word with MM)- Returns:
- date pattern
-
getMediaSize
Get default MediaSize- Returns:
- media size
-
setMediaSize
Set default MediaSize- Parameters:
size
- media size
-
toString
String Representation -
hashCode
public int hashCode()Hash Code -
equals
Equals. Two languages are equal, if they have the same AD_Language
-