Package org.compiere.util
Class Language
- java.lang.Object
-
- org.compiere.util.Language
-
- All Implemented Interfaces:
Serializable
public class Language extends Object implements Serializable
Language Management.- Version:
- $Id: Language.java,v 1.2 2006/07/30 00:52:23 jjanke Exp $
- Author:
- Jorg Janke
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Language(String name, String AD_Language, Locale locale)
Define Language with A4 and default decimal point and date formatLanguage(String name, String AD_Language, Locale locale, Boolean decimalPoint, String javaDatePattern, MediaSize mediaSize)
Define LanguageLanguage(Language copy)
Copy constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Equals.String
getAD_Language()
Get Application Dictionary Language (system supported).static String
getAD_Language(String langInfo)
Get Supported Languagestatic String
getAD_Language(Locale locale)
Get Supported Languagestatic String
getBaseAD_Language()
Get Base Language code.static Language
getBaseLanguage()
Get Base LanguageSimpleDateFormat
getDateFormat()
Get (Short) Date Format.SimpleDateFormat
getDateTimeFormat()
Get Date Time Format.String
getDBdatePattern()
Get Database Date Pattern.static Language
getLanguage(int index)
Get Languagestatic Language
getLanguage(String langInfo)
Get Language.String
getLanguageCode()
Get Language Code.static int
getLanguageCount()
Get Number of LanguagesLocale
getLocale()
Get Localestatic Locale
getLocale(String langInfo)
Get Supported Localestatic Language
getLoginLanguage()
Get Current Login LanguageMediaSize
getMediaSize()
Get default MediaSizeString
getName()
Get Language Name.static String
getName(String langInfo)
Get Language Namestatic String[]
getNames()
Get Display names of supported languagesSimpleDateFormat
getTimeFormat()
Get Time Format.int
hashCode()
Hash Codeboolean
isBaseLanguage()
Is This the Base Languagestatic boolean
isBaseLanguage(String langInfo)
Is it the base languageboolean
isDecimalPoint()
Returns true if Decimal Point (not comma)static boolean
isDecimalPoint(String langInfo)
Returns true if Decimal Point (not comma)boolean
isLeftToRight()
Component orientation is Left To Rightstatic void
main(String[] args)
Testvoid
setAD_Language(String AD_Language)
Set Application Dictionary Language (system supported).static void
setBaseLanguage(String baselang)
void
setDateFormat(String javaDatePattern)
Set Date Pattern.void
setLocale(Locale locale)
Overwrite Localestatic void
setLoginLanguage(Language language)
Set Current Login Languagevoid
setMediaSize(MediaSize size)
Set default MediaSizeString
toString()
String Representation
-
-
-
Constructor Detail
-
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
public Language(String name, String AD_Language, Locale locale)
Define Language with A4 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
public Language(Language copy)
Copy constructor- Parameters:
copy
-
-
-
Method Detail
-
getLanguageCount
public static int getLanguageCount()
Get Number of Languages- Returns:
- Language count
-
getLanguage
public static Language getLanguage(int index)
Get Language- Parameters:
index
- index- Returns:
- Language
-
getLanguage
public static Language getLanguage(String langInfo)
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
public static void setBaseLanguage(String baselang)
-
isBaseLanguage
public static boolean isBaseLanguage(String langInfo)
Is it the base language- Parameters:
langInfo
- either language (en) or locale (en-US) or display name- Returns:
- true if base language
-
getBaseLanguage
public static Language getBaseLanguage()
Get Base Language- Returns:
- Base Language
-
getBaseAD_Language
public static String getBaseAD_Language()
Get Base Language code. (e.g. en-US)- Returns:
- Base Language
-
getLocale
public static Locale getLocale(String langInfo)
Get Supported Locale- Parameters:
langInfo
- either language (en) or locale (en-US) or display name- Returns:
- Supported Locale
-
getAD_Language
public static String getAD_Language(String langInfo)
Get Supported Language- Parameters:
langInfo
- either language (en) or locale (en-US) or display name- Returns:
- AD_Language (e.g. en-US)
-
getAD_Language
public static String getAD_Language(Locale locale)
Get Supported Language- Parameters:
locale
- Locale- Returns:
- AD_Language (e.g. en-US)
-
getName
public static String getName(String langInfo)
Get Language Name- Parameters:
langInfo
- either language (en) or locale (en-US) or display name- Returns:
- Language Name (e.g. English)
-
isDecimalPoint
public static boolean isDecimalPoint(String langInfo)
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
public static String[] getNames()
Get Display names of supported languages- Returns:
- Array of Language names
-
getLoginLanguage
public static Language getLoginLanguage()
Get Current Login Language- Returns:
- login language
-
setLoginLanguage
public static void setLoginLanguage(Language language)
Set Current Login Language- Parameters:
language
- language
-
getName
public String getName()
Get Language Name. e.g. English- Returns:
- name
-
getAD_Language
public String getAD_Language()
Get Application Dictionary Language (system supported). e.g. en-US- Returns:
- AD_Language
-
setAD_Language
public void setAD_Language(String AD_Language)
Set Application Dictionary Language (system supported).- Parameters:
AD_Language
- e.g. en-US
-
getLocale
public Locale getLocale()
Get Locale- Returns:
- locale
-
setLocale
public void setLocale(Locale locale)
Overwrite Locale- Parameters:
locale
- locale
-
getLanguageCode
public String 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
public void setDateFormat(String javaDatePattern)
Set Date 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
public SimpleDateFormat getDateFormat()
Get (Short) Date Format. The date format must parseable by org.compiere.grid.ed.MDocDate i.e. leading zero for date and month- Returns:
- date format MM/dd/yyyy - dd.MM.yyyy
-
getDateTimeFormat
public SimpleDateFormat getDateTimeFormat()
Get Date Time Format. Used for Display only- 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
public SimpleDateFormat getTimeFormat()
Get Time Format. Used for Display only- Returns:
- Time format h:mm:ss z or HH:mm:ss z
-
getDBdatePattern
public String getDBdatePattern()
Get Database Date Pattern. Derive from date pattern (make upper case and replace month as word with MM)- Returns:
- date pattern
-
getMediaSize
public MediaSize getMediaSize()
Get default MediaSize- Returns:
- media size
-
setMediaSize
public void setMediaSize(MediaSize size)
Set default MediaSize- Parameters:
size
- media size
-
toString
public String toString()
String Representation
-
equals
public boolean equals(Object obj)
Equals. Two languages are equal, if they have the same AD_Language
-
main
public static void main(String[] args)
Test- Parameters:
args
- ignored
-
-