...
Although the basics of the i18n mechanism are the same for every part of the ecosystem, the packaging differs depending on what you are developing:
- Translations for the Sonar SonarQube Platform: making the Sonar SonarQube Platform available in a new language requires to develop and publish a new Language Pack plugin.
- By default Sonar embeds default SonarQubeembeds the English Pack.
- All other Language Pack plugins (like the French Pack plugin) are hosted in the Plugins Forge, are maintained by the community and are available through Update Center (category "Localization").
- Translations for the Sonar the SonarQube Community Plugins: open-source plugins of the Sonar the SonarQube Community (hosted in the Plugins Forge) must embed only the bundles for the default locale. Translations will be done in the Language Pack plugins.
- Translations for other Plugins: closed-source/commercial/independant plugins must embed the bundles for the default locale and the translations for every language they want to support.
| Tip | ||
|---|---|---|
| ||
|
...
- These are regular properties files with key/value pairs where you will put most translations
- These files must be stored in the package "
org.sonar.l10n" package (usually in the directory src/main/resources/org/sonar/l10n directory) - The name of these files must respect the convention "<key of the plugin to translate>_<language>.properties", for example "technicaldebt_fr.properties" or "core_fr.properties". See sonar-packaging-maven-plugin for details on plugin key derivation.
Messages accept arguments. Such entries would look like:
No Format myplugin.foo=This is a message with 2 params: the first "{0}" and the second "{1}".
...
- 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>" package.- Starting with Sonar 3SonarQube3.0, the files should be stored in the package "
org.sonar.l10n.<key of the plugin to translate>_<language>.rules.<repository key>" package (backward compatibility is ensured for l10n plugins which use the former location)
- Starting with Sonar 3SonarQube3.0, the files should be stored in the package "
- The name of these files must be the key of the rule they translate
- Example: the French description of the Squid Architectural Constraint rule is "src/main/resources/org/sonar/l10n/squidjava_fr/ArchitecturalConstraint.html"
- Or, starting with Sonar 3SonarQube3.0: "src/main/resources/org/sonar/l10n/squidjava_fr/rules/squid/ArchitecturalConstraint.html" (as "squidjava" is the plugin key and "squid" the repository key)
| Warning | ||
|---|---|---|
| ||
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. |
...
Key | Description | Example |
|---|---|---|
| Metric name |
|
| Metric description |
|
| Name of notification channel |
|
| Subscription to notification channel |
|
| Rule name |
|
| Description of rule parameter |
|
dashboard.<key>.name | Dashboard name, since 2.14. | dashboard.Hotstpots.name=Point Chauds |
| Qualifier name, since 2.13. |
|
| Widget name |
|
| Widget description |
|
widget.<key>.property.<property key>.name | Name of widget property | widget.hotspot_most_violated_rules.property.defaultSeverity.name=Default severity |
widget.<key>.property.<property key>.desc | Description of widget property | widget.hotspot_most_violated_rules.property.defaultSeverity.desc=If selected, |
widget.<key>.property.<property>.option.<option>.name | Name of item of dropdown list | |
| Any other widget message |
|
| Page names shown in the left sidebar |
|
| Any other keys used in a page |
|
| Category name of properties, since 2.11 |
|
property.category.<category key>.description | Short description of category of properties, since 3.6 | property.category.General.description=General properties of SonarQube |
property.category. | Subcategory name of properties, since 3.6 | property.category.exclusions.global=Global exclusions |
property.category. | Short description of subcategory of properties, since 3.6 | property.category.exclusions.global.description=Configuration of global exclusions |
| Property name, since 2.11 |
|
| Property description, since 2.11 |
|
| Any other keys used by plugin |
|
...
A Language Pack defines bundles for the Sonar Platform SonarQubePlatform and for the Sonar SonarQube Community plugins.
Creating a new Language Pack
...
This part applies if you are developing a commercial / closed-source plugin, or an open-source plugin that is not part of the Sonar SonarSonarQube Community Plugins.
Such plugins must embed their own bundles. Bundles must be added to src/main/resources with the following convention names :
- Standard messages : org/sonar/l10n/<plugin key>_<language>.properties
- Rule descriptions :
- Up to Sonar 3SonarSonarQube3.0: org/sonar/l10n/<plugin key>_<language>/*.html
- Since Sonar SonarSonarQube 3.0: org/sonar/l10n/<plugin key>_<language>/rules/<repository key>/*.html
The default bundle is mandatory, and must be the English translation. For example the plugin with key "mysonarplugin" must define the following files in order to enable the French translation:
- org/sonar/l10n/mysonarplugin.properties
- org/sonar/l10n/mysonarplugin_fr.properties

