Package com.jalios.jcms.tools
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:- create a Debug or Run Java application on this class
- 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 wherealert.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 Summary
Fields Modifier and Type Field Description protected java.util.LinkedHashMap<java.lang.String,java.util.HashMap<java.lang.String,java.lang.Integer>>
checkedPropertyMap
protected org.apache.oro.text.regex.PatternCompiler
compiler
static 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 valueprotected org.apache.oro.text.regex.Pattern
keyPattern
protected java.util.List<java.lang.String>
langList
protected org.apache.oro.text.regex.PatternMatcher
matcher
protected org.apache.oro.text.regex.Pattern
paramPattern
protected LangProperties
properties
-
Fields inherited from class com.jalios.jcms.tools.AbstractChecker
CHANNEL, PROP_SUFFIX_FILE_FILTER
-
-
Constructor Summary
Constructors Constructor Description LangPropertiesChecker(LangProperties properties, java.util.List<java.lang.String> langList)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addPropertyKey(java.lang.String propKey)
CheckResult
checkProperties()
Performs the following checks on the loaded languages properties : property missing in one of the required language property defined multiple timesstatic void
main(java.lang.String[] args)
void
setCheckOnlyMissingProperties(boolean onlyMissing)
Request that the checker only check for missing properties and not for their correctness.static void
usage(java.lang.String[] args)
static void
usage(java.lang.String[] args, java.lang.String error)
-
Methods inherited from class com.jalios.jcms.tools.AbstractChecker
getCheckedFile, getFileList, getFileList, loadLanguageProperties, loadProperties, loadProperties, saveError
-
-
-
-
Field Detail
-
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 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
-
-