Package org.compiere.util
Class Msg
- java.lang.Object
-
- org.compiere.util.Msg
-
public final class Msg extends Object
Reads all Messages and stores them in a HashMap- Version:
- $Id: Msg.java,v 1.2 2006/07/30 00:54:36 jjanke Exp $
- Author:
- Jorg Janke
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Msg
get()
Get Message Objectstatic 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(Properties ctx, String ColumnName)
Get Translation for Element using Sales terminologystatic String
getElement(Properties ctx, String ColumnName, boolean isSOTrx)
Get Translation for ElementCCache<String,String>
getElementMap(String ad_language)
Get language specific translation map for AD_ElementString[]
getLanguages()
Return an array of the installed Languagesstatic String
getMsg(String ad_language, String AD_Message)
Get translated text for AD_Messagestatic String
getMsg(String ad_language, String AD_Message, boolean getText)
Get translated text message for AD_Messagestatic String
getMsg(String ad_language, String AD_Message, Object[] args)
Get clear 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 clear text for AD_Message with parametersstatic String
getMsg(Language language, String AD_Message)
Get translated text message for AD_Messagestatic String
getMsg(Language language, String AD_Message, boolean getText)
Get translated text message for AD_Messagestatic String
getMsg(Language language, String AD_Message, Object[] args)
Get clear text for AD_Message with parametersCCache<String,String>
getMsgMap(String ad_language)
Get Language specific Message Mapstatic boolean
hasTranslation(String adLanguage, String text)
boolean
isLoaded(String language)
Check if Language is loadedstatic String
parseTranslation(Properties ctx, String text)
Translate elements enclosed in "@" (at sign)void
reset()
Reset Message cachestatic String
translate(String ad_language, boolean isSOTrx, String text)
"Translate" text.static String
translate(String ad_language, String text)
"Translate" text (SO Context).static String
translate(Properties ctx, String text)
"Translate" text.static String
translate(Language language, String text)
"Translate" text.
-
-
-
Method Detail
-
get
public static Msg get()
Get Message Object- Returns:
- Msg
-
getMsgMap
public CCache<String,String> getMsgMap(String ad_language)
Get Language specific Message Map- Parameters:
ad_language
- Language Key- Returns:
- HashMap of Language
-
getElementMap
public CCache<String,String> getElementMap(String ad_language)
Get language specific translation map for AD_Element- Parameters:
ad_language
-- Returns:
- ad_element map
-
reset
public void reset()
Reset Message cache
-
getLanguages
public String[] getLanguages()
Return an array of the installed Languages- Returns:
- Array of loaded Languages or null
-
isLoaded
public boolean isLoaded(String language)
Check if Language is loaded- Parameters:
language
- Language code- Returns:
- true, if language is loaded
-
getMsg
public static String getMsg(String ad_language, String AD_Message)
Get translated text for AD_Message- Parameters:
ad_language
- - LanguageAD_Message
- - Message Key- Returns:
- translated text
-
getMsg
public static String getMsg(Properties ctx, String AD_Message)
Get translated text message for AD_Message- Parameters:
ctx
- Context to retrieve languageAD_Message
- - Message Key- Returns:
- translated text
-
getMsg
public static String getMsg(Language language, String AD_Message)
Get translated text message for AD_Message- Parameters:
language
- LanguageAD_Message
- - Message Key- Returns:
- translated text
-
getMsg
public static String getMsg(String ad_language, String AD_Message, boolean getText)
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
public static String getMsg(Properties ctx, String AD_Message, boolean getText)
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
public static String getMsg(Language language, String AD_Message, boolean getText)
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
public static String getMsg(Properties ctx, String AD_Message, Object[] args)
Get clear text for AD_Message with parameters- Parameters:
ctx
- Context to retrieve languageAD_Message
- Message keyargs
- MessageFormat arguments- Returns:
- translated text
- See Also:
for formatting options
-
getMsg
public static String getMsg(Language language, String AD_Message, Object[] args)
Get clear text for AD_Message with parameters- Parameters:
language
- LanguageAD_Message
- Message keyargs
- MessageFormat arguments- Returns:
- translated text
- See Also:
for formatting options
-
getMsg
public static String getMsg(String ad_language, String AD_Message, Object[] args)
Get clear text for AD_Message with parameters- Parameters:
ad_language
- LanguageAD_Message
- Message keyargs
- MessageFormat arguments- Returns:
- translated text
- See Also:
for formatting options
-
getAmtInWords
public static String getAmtInWords(Language language, String amount)
Get Amount in Words- Parameters:
language
- languageamount
- numeric amount (352.80)- Returns:
- amount in words (three*five*two 80/100)
-
getElement
public static String getElement(String ad_language, String ColumnName, boolean isSOTrx)
Get Translation for Element- Parameters:
ad_language
- languageColumnName
- column nameisSOTrx
- if false PO terminology is used (if exists)- Returns:
- Name of the Column or "" if not found
-
getElement
public static String getElement(Properties ctx, String ColumnName)
Get Translation for Element using Sales terminology- Parameters:
ctx
- contextColumnName
- column name- Returns:
- Name of the Column or "" if not found
-
getElement
public static String getElement(Properties ctx, String ColumnName, boolean isSOTrx)
Get Translation for Element- Parameters:
ctx
- contextColumnName
- column nameisSOTrx
- sales transaction- Returns:
- Name of the Column or "" if not found
-
translate
public static String translate(String ad_language, boolean isSOTrx, String text)
"Translate" text.
If checking AD_Element, the SO terminology is used.- Check AD_Message.AD_Message -> MsgText - Check AD_Element.ColumnName -> Name
- Parameters:
ad_language
- LanguageisSOTrx
- sales order contexttext
- Text - MsgText or Element Name- Returns:
- translated text or original text if not found
-
translate
public static String translate(String ad_language, String text)
"Translate" text (SO Context).
If checking AD_Element, the SO terminology is used.- Check AD_Message.AD_Message -> MsgText - Check AD_Element.ColumnName -> Name
- Parameters:
ad_language
- Languagetext
- Text - MsgText or Element Name- Returns:
- translated text or original text if not found
-
translate
public static String translate(Properties ctx, String text)
"Translate" text.- Check AD_Message.AD_Message -> MsgText - Check AD_Element.ColumnName -> Name
- Parameters:
ctx
- Contexttext
- Text - MsgText or Element Name- Returns:
- translated text or original text if not found
-
translate
public static String translate(Language language, String text)
"Translate" text.- Check AD_Message.AD_Message -> MsgText - Check AD_Element.ColumnName -> Name
- Parameters:
language
- Languagetext
- Text- Returns:
- translated text or original text if not found
-
parseTranslation
public static String parseTranslation(Properties ctx, String text)
Translate elements enclosed in "@" (at sign)- Parameters:
ctx
- Contexttext
- Text- Returns:
- translated text or original text if not found
-
hasTranslation
public static boolean hasTranslation(String adLanguage, String text)
- Parameters:
adLanguage
-text
-- Returns:
- true if translation exists for text and adLanguage
-
getCleanMsg
public static String getCleanMsg(Properties ctx, String string)
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
-
-