Class 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 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 - - Language
        AD_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 language
        AD_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 - Language
        AD_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 - - Language
        AD_Message - - Message Key
        getText - 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 language
        AD_Message - Message Key
        getText - 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 - Language
        AD_Message - Message Key
        getText - 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 language
        AD_Message - Message key
        args - 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 - Language
        AD_Message - Message key
        args - 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 - Language
        AD_Message - Message key
        args - 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 - language
        amount - 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 - language
        ColumnName - column name
        isSOTrx - 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 - context
        ColumnName - 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 - context
        ColumnName - column name
        isSOTrx - 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.
        
        		- Check AD_Message.AD_Message 	->	MsgText
        		- Check AD_Element.ColumnName	->	Name
          
        If checking AD_Element, the SO terminology is used.
        Parameters:
        ad_language - Language
        isSOTrx - sales order context
        text - 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).
        
        		- Check AD_Message.AD_Message 	->	MsgText
        		- Check AD_Element.ColumnName	->	Name
          
        If checking AD_Element, the SO terminology is used.
        Parameters:
        ad_language - Language
        text - 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 - Context
        text - 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 - Language
        text - 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 - Context
        text - 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 language
        string - AD_Message - Message Key
        Returns:
        translated text