This page gives guidelines to I18n for:

  • Plugin developers who would like to apply the I18n mechanism in their own plugin, so that this plugin can be available in several languages
  • People who would like to help the Sonar community by making the Sonar core platform available in a new language

Sonar and the Sonar Plugins

Although the basics of the I18n mechanism are the same for every part of the Sonar ecosystem, the packaging differs if you want to apply this i18n mechanism to the Sonar core platform or to one Sonar plugin:

  • Sonar platform relies on plugins to get translations
  • Sonar plugins embed by themselves all the translations they need

Sonar I18n main principles

The LanguagePack extension point

Sonar I18n mechanism relies on the LanguagePack extension point, which gives information about:

For instance, here is the EnglishPack class of the Sonar platform:

public class EnglishPack extends LanguagePack {

  public List<String> getPluginKeys() {
    return Arrays.asList("core", "design", "squidjava");

  public List<Locale> getLocales() {
    return Arrays.asList(Locale.ENGLISH);

We can see that:

The translation files

To better understand the following concepts, we'll use the sonar-i18n-fr-plugin as an exmaple to better understand the different points.

There are 2 kind of files that are used to get I18n translations:

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.

Conventions for the I18n keys

Here are the conventions you have to know about key namings:

For any other key that a Sonar Plugin would define for its own I18n, the key must start with : "plugin-key."

Want to contribute to I18n in Sonar?

You are a plugin developer

Here are the main steps:

  1. Implement the LanguagePack extension point. In your case:
  2. Once you've implemented this extension point, you obviously have to declare this extension in your plugin class

  3. Use the I18n mechanism in your code
  4. Add translation files into the "src/main/resources/org/sonar/i18n/" folder
  5. And finally, translate the keys within those files!

You want to create a Language Pack plugin to offer a new translation to the Sonar platform

Here are the main steps:

  1. Check out the "I18n English Pack"

  2. *Create a new plugin, let's say the "I18n Japanese Pack", where you will copy and adapt files from the "I18n English Pack"
  3. And finally, translate the keys within those files!