Name of notification channel
Subscription to notification channel
Description of rule parameter
|Dashboard name, since 2.14.|
|Qualifier name, since 2.13.|
|Name of widget property|
|Description of widget property|
|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
|Short description of category of properties, since 3.6|
|Subcategory name of properties, since 3.6|
|Short description of subcategory of properties, since 3.6|
Property name, since 2.11
Property description, since 2.11
Any other keys used by plugin
Deprecated - HTML Files for Rule Descriptions
Rule descriptions could be translated through HTML files in versions prior to 4.1.
- They are used for rule descriptions, which might be long and need HTML tags
- The files should be stored in the
org.sonar.l10n.<key of the plugin to translate>_<language>.rules.<repository key>package.
- Before SonarQube 3.0, the location is
org.sonar.l10n.<plugin key>_<language>package. Backward compatibility is ensured for l10n plugins which use this old location.
- Before SonarQube 3.0, the location is
- The names of these files should correspond to the keys of the rules they translate
- Example: the French description of the Squid Architectural Constraint rule is: src/main/resources/org/sonar/l10n/squidjava_fr/rules/squid/ArchitecturalConstraint.html (since squidjava is the plugin key, and squid is the repository key)
- Prior to SonarQube 3.0: src/main/resources/org/sonar/l10n/squidjava_fr/ArchitecturalConstraint.html
- Supported tags are:
- <p> for paragraphs. Must be used for each paragraph.
- <ul> and <ul> for lists
- <h2> and <h3> for titles and subtitles (since version 3.7.1)
- <blockquote> for quotations (since version 3.7.1)
- <code> for short code in paragraph
- <pre> for block of code
- <table class="rule-table">, with <thead><tr><th> and <tbody><tr><td> cells (since version 3.7.1)
How to use localized messages?
Ruby on Rails API
This API is used when implementing Ruby widgets or pages. It's really simple, and works with just a single method:
Options are :
:defaultis the default value when the property key does not exist in bundles. If it's not set, then the key itself is returned.
:paramsis an array of string message arguments.
message('cloud.size') message('cloud.size', :default => 'Cloud') message('with.arguments', :params => ['First', 'Two']) message('with.arguments', :params => ['First', 'Two'], :default => 'Not found')
Of course, the Rails framework provides other formatting methods like :
# localize dates or datetimes l(date_or_time)
org.sonar.api.i18n.I18n is available for web server extensions. Batch Scanner extensions are not supported yet and can not load bundles.
Writing a Language Pack
A Language Pack defines bundles for the SonarQube platform and for the SonarQube community and/or plugins.
The easiest way to create a new pack is to copy the French Pack and adapt it to your language.
<properties> ... <!-- Versions of the plugins translated by this language pack --> <bundle.abacus>0.1</bundle.abacus> <bundle.branding>0.3</bundle.branding> <bundle.core>3.4-RC3</bundle.core> <bundle.javasquid>1.1</bundle.javasquid> <bundle.jira>1.0</bundle.jira> <bundle.motionchart>1.4</bundle.motionchart> <bundle.squidjava>1.0</bundle.squidjava> <bundle.violationdensity>1.2</bundle.violationdensity> ... </properties>
When it's time to update your language pack for a new version of SonarQube or a plugin, the easiest way to see what keys are missing is to run:
Each time you add a new bundle or update an existing one, please create a JIRA ticket on the corresponding L10n component in order to track changes.
Localizing a Plugin
This section applies if you are developing a commercial / closed-source plugin, or an open-source plugin that is not part of the SonarSonarQube Community Plugins forge.
If your plugin falls in this category, it must embed its own bundles. Bundles Bundle must be added to defined in src/main/resources with the following naming convention :
- org/sonar/l10n/<plugin key>_<language>/rules/<repository key>/*.html
- Prior to version 3.0 : org/sonar/l10n/<plugin key>_<language>/*.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: