Compiere Looks 1.2.1

org.compiere.util
Class Language

java.lang.Object
  |
  +--org.compiere.util.Language

public class Language
extends Object

Language Management.

Version:
$Id: Language.java,v 1.30 2003/04/29 08:07:34 jpedersen Exp $
Author:
Jorg Janke

Field Summary
static String AD_Language_en_US
          Base Language
 
Constructor Summary
Language(String name, String AD_Language, Locale locale)
          Define Language with A4 and default decimal point and date format
Language(String name, String AD_Language, Locale locale, Boolean decimalPoint, String javaDatePattern, MediaSize mediaSize)
          Define Language
 
Method Summary
static void addLanguage(Language language)
          Add Language to supported Languages
 boolean equals(Object obj)
          Equals.
 String getAD_Language()
          Get Application Dictionary Language (system supported).
static String getAD_Language(Locale locale)
          Get Supported Language
static String getAD_Language(String langInfo)
          Get Supported Language
static String getBaseAD_Language()
          Get Base Language code.
static Language getBaseLanguage()
          Get Base Language
 SimpleDateFormat getDateFormat()
          Get (Short) Date Format.
 SimpleDateFormat getDateTimeFormat()
          Get Date Time Format.
 String getDBdatePattern()
          Get Database Date Pattern.
static Language getLanguage()
          Get Default Language
static Language getLanguage(int index)
          Get Language
static Language getLanguage(String langInfo)
          Get Language.
 String getLanguageCode()
          Get Language Code.
static int getLanguageCount()
          Get Number of Languages
 Locale getLocale()
          Get Locale
static Locale getLocale(String langInfo)
          Get Supported Locale
 MediaSize getMediaSize()
          Get default MediaSize
 String getName()
          Get Language Name.
static String getName(String langInfo)
          Get Language Name
static String[] getNames()
          Get Display names of supported languages
 SimpleDateFormat getTimeFormat()
          Get Time Format.
 int hashCode()
          Hash Code
 boolean isBaseLanguage()
          Is This the Base Language
static boolean isBaseLanguage(String langInfo)
          Is it the base language
 boolean 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 Right
static void main(String[] args)
          Test
 void setAD_Language(String AD_Language)
          Set Application Dictionary Language (system supported).
 void setDateFormat(String javaDatePattern)
          Set Date Pattern.
static void setLanguage(Language language)
          Set Default Language
 void setLocale(Locale locale)
          Overwrite Locale
 void setMediaSize(MediaSize size)
          Set default MediaSize
 String toString()
          String Representation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

AD_Language_en_US

public static final String AD_Language_en_US
Base Language

See Also:
Constant Field Values
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. English
AD_Language - - the code of system supported langauge, 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
decimalPoint - true if Decimal Point - if null, derived from Locale
javaDatePattern - Java date pattern as not all locales are defined - if null, derived from Locale
mediaSize - 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. English
AD_Language - - the code of system supported langauge, 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
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

addLanguage

public static void addLanguage(Language language)
Add Language to supported Languages

Parameters:
language - new language

getLanguage

public static Language getLanguage(String langInfo)
Get Language. If language does not exist, create it on the fly assuming taht it is valid

Parameters:
langInfo - either language (en) or locale (en-US) or display name
Returns:
Name (e.g. Deutsch)

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:
Langauge 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

getLanguage

public static Language getLanguage()
Get Default Language

Returns:
default Language

setLanguage

public static void setLanguage(Language language)
Set Default 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)

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

Overrides:
toString in class Object
Returns:
string representation

hashCode

public int hashCode()
Hash Code

Overrides:
hashCode in class Object
Returns:
hashcode

equals

public boolean equals(Object obj)
Equals. Two languages are equal, if they have the same AD_Language

Overrides:
equals in class Object
Parameters:
obj - compare
Returns:
true if AD_Language is the same

main

public static void main(String[] args)
Test

Parameters:
args - args

Compiere Looks 1.2.1

Copyright (c) 1999-2003 ComPiere, Inc. - Author: Jorg Janke