Class LangPropertiesChecker


  • public class LangPropertiesChecker
    extends AbstractChecker
    Check language properties for missing or duplicated internationalization string.

    Calling this class in Eclipse:
    1. create a Debug or Run Java application on this class
    2. arguments: specify which langProperties files or directory you want to check

    JCMS lang properties (all langs)

    LangPropertiesChecker ${workspace_loc}/JCMS/webapps/en/WEB-INF/jalios/languages

    JCMS lang properties (en + fr only)

    ${workspace_loc}/JCMS/webapps/en/WEB-INF/jalios/languages/en.prop ${workspace_loc}/JCMS/webapps/en/WEB-INF/jalios/languages/fr.prop

    Plugin lang properties (all langs)

    ${workspace_loc}/JCMS/webapps/en/WEB-INF/plugins/ACMEPlugin/properties/languages

    Plugin lang properties (en + fr only)

    ${workspace_loc}/JCMS/webapps/en/WEB-INF/plugins/ACMEPlugin/properties/languages/en.prop ${workspace_loc}/JCMS/webapps/en/WEB-INF/plugins/ACMEPlugin/properties/languages/fr.prop
    Note: some plugins may require core properties to pass tests. Eg: ESNPlugin where alert.name.recommendation property is declared in core I18N.prop
    ${workspace_loc}/JCMS/webapps/en/WEB-INF/jalios/languages/en.prop ${workspace_loc}/JCMS/webapps/en/WEB-INF/jalios/languages/fr.prop ${workspace_loc}/JCMS/webapps/en/WEB-INF/plugins/ESNPlugin/properties/languages/en.prop ${workspace_loc}/JCMS/webapps/en/WEB-INF/plugins/ESNPlugin/properties/languages/fr.prop
    Since:
    jcms-5.0.1
    Author:
    Olivier Jaquemet
    • Field Detail

      • compiler

        protected final org.apache.oro.text.regex.PatternCompiler compiler
      • matcher

        protected final org.apache.oro.text.regex.PatternMatcher matcher
      • langList

        protected java.util.List<java.lang.String> langList
      • keyPattern

        protected org.apache.oro.text.regex.Pattern keyPattern
      • paramPattern

        protected org.apache.oro.text.regex.Pattern paramPattern
      • checkedPropertyMap

        protected java.util.LinkedHashMap<java.lang.String,​java.util.HashMap<java.lang.String,​java.lang.Integer>> checkedPropertyMap
      • DATE_PARAMETER_PATTERN

        public static final java.util.regex.Pattern DATE_PARAMETER_PATTERN
        Pattern used to match all date parameter such as {0,date,yyyy/MM/dd HH:mm} in a property value
    • Constructor Detail

      • LangPropertiesChecker

        public LangPropertiesChecker​(LangProperties properties,
                                     java.util.List<java.lang.String> langList)
    • Method Detail

      • usage

        public static void usage​(java.lang.String[] args)
      • usage

        public static void usage​(java.lang.String[] args,
                                 java.lang.String error)
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • addPropertyKey

        protected void addPropertyKey​(java.lang.String propKey)
      • setCheckOnlyMissingProperties

        public void setCheckOnlyMissingProperties​(boolean onlyMissing)
        Request that the checker only check for missing properties and not for their correctness. Default is to check every required aspect possible.
        Parameters:
        onlyMissing - true to check only missing, false to perform every required aspect possible.
      • checkProperties

        public CheckResult checkProperties()
        Performs the following checks on the loaded languages properties :
        • property missing in one of the required language
        • property defined multiple times
        Returns:
        a CheckResult with errors if any