-
Notifications
You must be signed in to change notification settings - Fork 1
Validators
The .properties files are loaded as Java Properties and some checks are performed, depending on the type of resource.
Most checks apply at property value level, but some coherency checks have a larger scope (whole property file, or even whole multi-language bundle)
There are 3 severity levels:
- Error: Serious issue that will break the application in all cases. By default will fail the build (this is configurable via ignoreFailure configuration property).
- Warn: Issue that may impact the application in some cases, incoherence, or bad practice. Can be ignored via --quiet trigger
- Info: Minor issue or recommendation. Can be ignored via --quiet trigger
- Description: Same key is used twice in same property file
- Severity: Error
- Impact: Unspecified behaviour on which value will get loaded
Translated resources are resource translated in more than 1 language.
- Description: Resource is translated in at least 2 languages excluding root bundle (meaning translation process has somehow started), but not all languages
- Severity: Warn
- Impact: Default language/nothing/???key??? is displayed depending on implementation
- Description: Resource has identical translations in all languages, it could be moved to root bundle.
- Severity: Info
- Impact: Duplication, risk of de-synchronization between languages
- Description: Resource has identical translations in most languages, but a different one in few (less than half) languages, suggesting it may not be language dependent and a typo error.
- Severity: Warn
- Impact: -
example.text.start=Hello
example.text.end= !
- Description: Resource has a trailing whitespace character, that could indicate some translation concatenation.
- Severity: Warn
- Impact: Syntax errors in some languages (spaces, order of words)
- Description: Resource has some spell-checking errors, using Jazzy Spellchecker. Dictionaries have to be provided to the plugin. Proper nouns (brands, ...) and other domain specific keywords or terms can be added to a dedicated user-defined dictionary (language dependant or not) to reduce false positives
- Severity: Warn
- Impact: Syntax errors
Parametric resources are resources containing formatting parameters. Supports java.text.MessageFormat {0} {1,date} etc., as well as java.util.Formatter %1$s %2$s (explicitly indexed args only)
example.param=this is {0}'s book
- Description: Single quotes are not escaped by another single quote. Limitation: Single quotes used as escape sequence (ex: '{this text is escaped}') will raise false positive
- Severity: Error
- Impact: Single quotes swallowed by MessageFormat, or formatting not applied
# bundle_en.properties
example.param=Hello {0} !
# bundle_fr.properties
example.param=Bonjour {1} !
- Description: Usage of parameters between languages is incoherent (different number of parameters, or different index used), the order of the parameters being ignored. Limitation: Types are ignored here, {0, date} is considered the same as {0}
- Severity: Warn
- Impact: Translation has no meaning
example.noparam=this is John''s book
- Description: Some single quotes are escaped but resource does not contain any formatting parameter. Limitation: if the parametric replacement is not performed by MessageFormat - for instance in javascript-, it is assumed it will follow same behaviour and consume escaped single quotes
- Severity: Warn
- Impact: Two single quotes displayed
example.included = Re-used text
example.text = ${example.inclued}
- Description: If properties are loaded via a library allowing resource substitution (such as eProperties, XProperties or Apache commons), checks that the substituted resource actually exists
- Severity: Error
- Impact: -
Resource key matching htmlKeys plugin property (default: .text.) | HTML5 data-* custom attributes are ignored
example.html=some <b>important<b> text
example.html=bed & breakfast
- Description: XHTML validation fails using XHTM 1.0 transitional (default), XHTML 1.0 strict or XHTML 5 (using XMLmind schema). Note: data-attributes are ignored during validation
- Severity: Error
- Impact: Malformed HTML, dependent on browser quirks
# bundle_en.properties
example.text=This is <b>important</b>
# bundle_fr.properties
example.text=C'est <strong>important</strong>
- Description: HTML tag usage is not coherent between translations of a resource (order is ignored). Limitation: nested tags coherence is not checked
- Severity: Warn
- Impact: Incoherent translations
- Example:
Resource key matching jsKeys plugin property (default: .js.). They are also considered as an HTML/Text resource, after javascript unescaping.
example.js=Some client side text\n
- Description: Some newline characters (\n, \r) are present. They are interpreted as end of javascript statement by browsers
- Severity: Error
- Impact: JavaScript error`
example.js=click on "Ok"` `var text="<fmt:message key='example.js'/>";
- Description: Quotes are unescaped (" or ' depending on configuration)
- Severity: Error
- Impact: Javascript error`
Resource key matching urlKeys plugin property (default: .url.). HTML unescaping is applied before validation.
example.url=http//www.google.com
- Description: Not a valid (pseudo-)URL pattern. Limitaion: only https(s),ftp and mailto protocol allowed, if any.
- Severity: Error
- Impact: Invalid link (Unknown address)
example.url=http://www.google.com/script.js
- Description: URL is an HTML import and does not support https context (cf scheme relative URLs).
- Severity: Error
- Impact: Mixed content warning
Resource keys matching textKeys plugin property (default: .title.)
example.alt=alternative text<br/>of an image
- Description: Contains HTML
- Severity: Error
- Impact: Tags not interpreted by browser
example.alt=Go to http://www.google.com
- Description: Contains URL
- Severity: Error
- Impact: URLs not clickable
Resource keys matching a custom pattern.
- Description: custom pattern regex doesn't match.
- Severity: Error
- Impact: -
Resource key not matching any of the previous.
example.other=This is <br/> actually HTML
- Description: Contains HTML or URL but wasn't checked, so probably some key patterns are wrong in plugin configuration
- Severity: Warn
- Impact: -
- Description: Resource has been skipped using excludedKeys configuration property. If this was to bypass a false positive raised by the plugin for a somehow valid case, feel free to report a bug ;-)
- Severity: Info
- Impact: No check performed