Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • They are used for rule descriptions, which might be long and need HTML tags
  • These files must be stored in the package "org.sonar.l10n.<plugin key>_<language>, for example "
    • Starting with Sonar 2.15, the files should be stored in the package "org.sonar.l10n.
    checkstyle_fr
    • <plugin key>_<language>.rules.<repository key>" (backward compatibility is ensured for l10n plugins which use the former location)
  • The name of these files must be the key of the rule they translate
  • E.g.Example: the French description of the Squid Architectural Constraint rule is "src/main/resources/org/sonar/i18n/squidjava_fr/ArchitecturalConstraint.html"
    • Or, starting with Sonar 2.15: "src/main/resources/org/sonar/i18n/squidjava_fr/rules/squid/ArchitecturalConstraint.html" (as "squidjava" is the plugin key and "squid" the repository key)
Warning
titleUTF-8 encoding

In the Java API, properties files are supposed to be encoded in ISO-8859 charset. Without good tooling, this can be quite annoying to write translation for languages that do not fit in this charset.
This is why we deciced to encode the properties files in UTF-8, and let Maven turn them into ASCII at build time thanks to native2ascii-maven-plugin (check the French plugin POM). This makes the process of writing translations with a standard editor far easier.
HTML files must also be encoded in UTF-8.

...

  • Standard messages : org/sonar/l10n/<plugin key>_<language>.properties
  • Rule descriptions :
    • Up to Sonar 2.15: org/sonar/l10n/<plugin key>_<language>/*.html
    • Since Sonar 2.15: org/sonar/l10n/<plugin key>_<language>/rules/<repository key>/*.html

The english bundle is mandatory. For example the plugin with key "technicaldebt" must define the following files in order to enable the french bundle :

...