Package jaxx.compiler

Class I18nHelper


  • public class I18nHelper
    extends Object
    I18n methods to add I18n.t(String, Object...) method on some attributes. Make sure to set an i18nable compiler to have his CompilerConfiguration.isI18nable() returning true.
    Author:
    Tony Chemit - chemit@codelutin.com
    • Field Detail

      • log

        protected static final org.apache.commons.logging.Log log
      • I18N_ATTRIBUTES

        public static final List<String> I18N_ATTRIBUTES
    • Constructor Detail

      • I18nHelper

        public I18nHelper()
    • Method Detail

      • isI18nableAttribute

        public static boolean isI18nableAttribute​(String attributeName,
                                                  JAXXCompiler compiler)
        Test if we have an active i18n attribute (says an i18n attribute on a i18neable compiler).
        Parameters:
        attributeName - name of attribute to test
        compiler - current used compiler (contains options)
        Returns:
        true if wa have an active i18n attribute, false otherwise.
      • isI18nAttribute

        public static boolean isI18nAttribute​(String attributeName)
        Test if we have an i18n attribute.
        Parameters:
        attributeName - name of attribute to test
        Returns:
        true if wa have an active i18n attribute, false otherwise.
      • addI18nInvocation

        public static String addI18nInvocation​(String widgetId,
                                               String attributeName,
                                               String attributeValueCode,
                                               JAXXCompiler compiler)
        Add the i18n on a attribute. Note: Be ware : no test is done here to ensure we are on a i18neable attribute for an i18nable compiler. Make sure with the method isI18nableAttribute(String, JAXXCompiler) returns true before using this method.
        Parameters:
        widgetId - the id of the widget
        attributeName - the name of the attribute
        attributeValueCode - the value code of the attribute value
        compiler - the current used compile
        Returns:
        the surrender i18n call if attribute name is match the attributeValueCode otherwise
      • addI18nMnemonicInvocation

        public static String addI18nMnemonicInvocation​(CompiledObject object,
                                                       String attributeName,
                                                       String attributeValueCode,
                                                       JAXXCompiler compiler)
        Box a i18n key with code to be used as a i18n mnemonic. Note: Be ware : no test is done here to ensure we are on a i18neable attribute for an i18nable compiler.
        Parameters:
        object - the object to use
        attributeName - the name of the attribute
        attributeValueCode - the value code of the attribute value
        compiler - the current used compile
        Returns:
        the surrender i18n call if attribute name is match the attributeValueCode otherwise
        Since:
        2.6.11