Versions Compared

Key

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

...

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 SonarQube Platform: making the SonarQube Platform available in a new language requires you to develop and publish a new Language Pack plugin.
    • By default SonarQube embeds 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").

...

  • These are regular properties files with key/value pairs where you put most translations
  • These files must be stored in the org.sonar.l10n package (usually in the src/main/resources/org/sonar/l10n directory)
  • The names of these files must follow the convention "<key of the plugin to translate>_<language>.properties", for example "technicaldebtwidgetlabs_fr.properties" or "core_fr.properties" for core bundle. See sonar-packaging-maven-plugin for details on plugin key derivation.
  • Messages can 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}".
    

...

Key

Description

Example

metric.<key>.name

Metric name

metric.ncloc.name=Lines of code

metric.<key>.description

Metric description

metric.ncloc.description=Non Commenting Lines of Code

notification.channel.<channel key>

Name of notification channel

notification.channel.EmailNotificationChannel=Email

notification.dispatcher.<dispatcher key>

Subscription to notification channel

notification.dispatcher.ChangesInReviewAssignedToMeOrCreatedByMe=Changes in review assigned to me or created by me

rule.<repository>.<key>.name

Rule name

rule.pmd.StringInstantiation.name=String Instantiation

rule.<repository>.<key>.param.<param key>

Description of rule parameter

rule.pmd.VariableNamingConventions.param.memberSuffix=Suffix for member variables

dashboard.<key>.nameDashboard name, since 2.14.dashboard.Hotstpots.name=Point Chauds

qualifier.<key>

qualifiers.<key>

Qualifier name, since 2.13.

qualifier.TRK=Project

qualifiers.TRK=Projects

widget.<key>.name

Widget name

widget.alerts.name=Alerts

widget.<key>.description

Widget description

widget.alerts.description=Display project alerts

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, 
severity used to initialize the dropdown list of widget
widget.<key>.property.<property>.option.<option>.name
Name of item of dropdown list 

widget.<key>.*

Any other widget message

widget.alerts.tooltip=Threshold is raised

<page key>.page

Page names shown in the left sidebar

cloud.page=Cloud

<page key>.*

Any other keys used in a page

cloud.size=Size

property.category.<category key>

Category name of properties, since 2.11

property.category.General=Général

property.category.<category key>.description
Short description of category of properties, since 3.6property.category.General.description=General properties of SonarQube
property.category.<category key>.<subcategory key>
Subcategory name of properties, since 3.6property.category.exclusions.global=Global exclusions
property.category.<category key>.<subcategory key>.descriptionShort description of subcategory of properties, since 3.6property.category.exclusions.global.description=Configuration of global exclusions

property.<key>.name

Property name, since 2.11

property.sonar.sourceEncoding.name=Source encoding

property.<key>.description

Property description, since 2.11

property.sonar.sourceEncoding.description=Source encoding

<plugin key>.*

Any other keys used by plugin

 

How to

...

read localized messages from a plugin extension?

Java API

The component org.sonar.api.i18n.I18n is available for web server extensions. Scanner extensions can not load bundles.

...

The easiest way to create a new pack is to copy the French Pack and adapt it to your language.

...

In the pom file, set the versions of SonarQube and of the plugins you want to translate:

...

.

...

...

<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:

...