Versions Compared

Key

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

...

The component org.sonar.api.i18n.I18n is available for server extensions. Batch extensions are not supported yet and can not load bundles.

How to

...

How to localize a plugin

...

create a Language Pack for the Sonar Community

A Language Pack defines bundles for the Sonar Core Platform and for Sonar Community Plugins. The easiest way to create a new pack is to copy the French Pack and to adapt it to your language.

From there, you can regularly check bundles from:

  • The English Pack - which contains all the bundles of the Sonar Core Platform that should be translated (you are not obliged to translate them all at once, you can proceed with baby steps)
  • The following Sonar Community Plugins which support L10n (as of August 2012):
    • Abacus
    • Branding
    • JIRA
    • Tab Metrics
    • Thucydides
    • Useless Code Tracker
    • Violation Density
    • Web
    • Widget Lab

How to localize an independant plugin

This part applies if you are developing a commercial / closed-source plugin, or an open-source plugin that is not part of the Sonar 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 3.0: org/sonar/l10n/<plugin key>_<language>/*.html
    • Since Sonar 3.0: org/sonar/l10n/<plugin key>_<language>/rules/<repository key>/*.html

The english default bundle is mandatory, and must be the English translation. For example the plugin with key "technicaldebtmysonarplugin" must define the following files in order to enable the french bundle French translation:

  • org/sonar/l10n/technicaldebtmysonarplugin.properties
  • org/sonar/l10n/technicaldebtmysonarplugin_fr.properties

How to create a language pack

A language pack defines bundles for the whole Sonar distribution. 

To create a new pack, it's recommended to copy the English bundles and to adapt them to the new language.

The language pack plugin must be executed in the same classloader than the English pack, so the property "basePlugin" must be set to "l10nen" into the configuration of sonar-packaging-maven-plugin (see example).