Class LangPropertiesChecker

java.lang.Object
com.jalios.jcms.tools.AbstractChecker
com.jalios.jcms.tools.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 Details

    • compiler

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

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

      protected LangProperties properties
    • langList

      protected List<String> langList
    • keyPattern

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

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

      protected LinkedHashMap<String,HashMap<String,Integer>> checkedPropertyMap
    • DATE_PARAMETER_PATTERN

      public static final 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 Details

  • Method Details

    • usage

      public static void usage(String[] args)
    • usage

      public static void usage(String[] args, String error)
    • main

      public static void main(String[] args) throws IOException
      Throws:
      IOException
    • addPropertyKey

      protected void addPropertyKey(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