Package org.compiere.util
Class Msg
java.lang.Object
org.compiere.util.Msg
Contain static methods to access AD_Message, AD_Element and its translations.
- Version:
- $Id: Msg.java,v 1.2 2006/07/30 00:54:36 jjanke Exp $
- Author:
- Jorg Janke
-
Method Summary
Modifier and TypeMethodDescriptionstatic Msg
get()
Get the singleton Message instancestatic String
getAmtInWords
(Language language, String amount) Get Amount in Wordsstatic String
getCleanMsg
(Properties ctx, String string) Get translated text message for AD_Message, ampersand cleaned (used to indicate shortcut)static String
getElement
(String ad_language, String ColumnName, boolean isSOTrx) Get Translation for Elementstatic String
getElement
(String ad_language, String ColumnName, boolean isSOTrx, boolean isPrintName) Get Translation for Elementstatic String
getElement
(Properties ctx, String ColumnName) Get Translation for Element using Sales terminologystatic String
getElement
(Properties ctx, String ColumnName, boolean isSOTrx) Get Translation for ElementgetElementMap
(String ad_language) Get language specific translation map for AD_ElementgetElementPrintNameMap
(String ad_language) Get language specific translation map for AD_Element print nameString[]
Return an array of the installed Languagesstatic String
Get translated text for AD_Messagestatic String
Get translated text message for AD_Messagestatic String
Get translated text for AD_Message with parametersstatic String
getMsg
(Properties ctx, String AD_Message) Get translated text message for AD_Messagestatic String
getMsg
(Properties ctx, String AD_Message, boolean getText) Get translated text message for AD_Messagestatic String
getMsg
(Properties ctx, String AD_Message, Object[] args) Get translated text for AD_Message with parametersstatic String
Get translated text message for AD_Messagestatic String
Get translated text message for AD_Messagestatic String
Get translated text for AD_Message with parametersGet Language specific Message Mapstatic boolean
hasTranslation
(String adLanguage, String text) Is translation exists for textboolean
Check if Language is loadedstatic String
parseTranslation
(Properties ctx, String text) Translate elements enclosed in "@" (at sign)void
reset()
Reset/clear message cachestatic String
"Translate" text.static String
"Translate" text.static String
"Translate" text (SO Context).static String
translate
(Properties ctx, String text) "Translate" text.static String
"Translate" text.
-
Method Details
-
get
Get the singleton Message instance- Returns:
- Msg
-
getMsgMap
Get Language specific Message Map- Parameters:
ad_language
- Language Key- Returns:
- HashMap of Language
-
getElementMap
Get language specific translation map for AD_Element- Parameters:
ad_language
-- Returns:
- ad_element map
-
getElementPrintNameMap
Get language specific translation map for AD_Element print name- Parameters:
ad_language
-- Returns:
- map of element column name:print name
-
reset
public void reset()Reset/clear message cache -
getLanguages
Return an array of the installed Languages- Returns:
- Array of loaded Languages or null
-
isLoaded
Check if Language is loaded- Parameters:
language
- Language code- Returns:
- true, if language is loaded
-
getMsg
Get translated text for AD_Message- Parameters:
ad_language
- - LanguageAD_Message
- - Message Key- Returns:
- translated text
-
getMsg
Get translated text message for AD_Message- Parameters:
ctx
- Context to retrieve languageAD_Message
- - Message Key- Returns:
- translated text
-
getMsg
Get translated text message for AD_Message- Parameters:
language
- LanguageAD_Message
- - Message Key- Returns:
- translated text
-
getMsg
Get translated text message for AD_Message- Parameters:
ad_language
- - LanguageAD_Message
- - Message KeygetText
- if true only return Text, if false only return Tip- Returns:
- translated text
-
getMsg
Get translated text message for AD_Message- Parameters:
ctx
- Context to retrieve languageAD_Message
- Message KeygetText
- if true only return Text, if false only return Tip- Returns:
- translated text
-
getMsg
Get translated text message for AD_Message- Parameters:
language
- LanguageAD_Message
- Message KeygetText
- if true only return Text, if false only return Tip- Returns:
- translated text
-
getMsg
Get translated text for AD_Message with parameters- Parameters:
ctx
- Context to retrieve languageAD_Message
- Message keyargs
- MessageFormat arguments- Returns:
- translated text
- See Also:
-
getMsg
Get translated text for AD_Message with parameters- Parameters:
language
- LanguageAD_Message
- Message keyargs
- MessageFormat arguments- Returns:
- translated text
- See Also:
-
getMsg
Get translated text for AD_Message with parameters- Parameters:
ad_language
- LanguageAD_Message
- Message keyargs
- MessageFormat arguments- Returns:
- translated text
- See Also:
-
getAmtInWords
Get Amount in Words- Parameters:
language
- languageamount
- numeric amount (352.80)- Returns:
- amount in words (three*five*two 80/100)
-
getElement
Get Translation for Element- Parameters:
ad_language
- languageColumnName
- element column nameisSOTrx
- if false PO terminology is used (if exists)- Returns:
- Translated Element Name or "" if not found
-
getElement
public static String getElement(String ad_language, String ColumnName, boolean isSOTrx, boolean isPrintName) Get Translation for Element- Parameters:
ad_language
- languageColumnName
- element column nameisSOTrx
- if false PO terminology is used (if exists)isPrintName
- if true, return element PrintName instead of element Name- Returns:
- Translated Element Name/PrintName of the Column or "" if not found
-
getElement
Get Translation for Element using Sales terminology- Parameters:
ctx
- contextColumnName
- element column name- Returns:
- Translated Element Name of the Column or "" if not found
-
getElement
Get Translation for Element- Parameters:
ctx
- contextColumnName
- element column nameisSOTrx
- sales transaction- Returns:
- Translated Element Name of the Column or "" if not found
-
translate
"Translate" text.- Check AD_Message.AD_Message -> MsgText - Check AD_Element.ColumnName -> Name
If checking AD_Element, the SO terminology is used.- Parameters:
ad_language
- LanguageisSOTrx
- sales order contexttext
- Text - Message Value or Element Column Name- Returns:
- translated text or original text if not found
-
translate
public static String translate(String ad_language, boolean isSOTrx, String text, boolean isPrintName) "Translate" text.- Check AD_Message.AD_Message -> MsgText - Check AD_Element.ColumnName -> Name/PrintName
If checking AD_Element, the SO terminology is used.- Parameters:
ad_language
- LanguageisSOTrx
- sales order contexttext
- Text - Message Value or Element Column NameisPrintName
- if true, return element PrintName instead of element Name- Returns:
- translated text or original text if not found
-
translate
"Translate" text (SO Context).- Check AD_Message.AD_Message -> MsgText - Check AD_Element.ColumnName -> Name
If checking AD_Element, the SO terminology is used.- Parameters:
ad_language
- Languagetext
- Text - Message Value or Element Column Name- Returns:
- translated text or original text if not found
-
translate
"Translate" text.- Check AD_Message.AD_Message -> MsgText - Check AD_Element.ColumnName -> Name
- Parameters:
ctx
- Contexttext
- Text - Message Value or Element Column Name- Returns:
- translated text or original text if not found
-
translate
"Translate" text.- Check AD_Message.AD_Message -> MsgText - Check AD_Element.ColumnName -> Name
- Parameters:
language
- Languagetext
- Message Value or Element Column Name- Returns:
- translated text or original text if not found
-
parseTranslation
Translate elements enclosed in "@" (at sign)- Parameters:
ctx
- Contexttext
- Text- Returns:
- translated text or original text if not found
-
hasTranslation
Is translation exists for text- Parameters:
adLanguage
-text
-- Returns:
- true if translation exists for text and adLanguage
-
getCleanMsg
Get translated text message for AD_Message, ampersand cleaned (used to indicate shortcut)- Parameters:
ctx
- Context to retrieve languagestring
- AD_Message - Message Key- Returns:
- translated text
-