Please also refer to the SonarQube documentation for more details on how to create a translation plugin.
These are the steps to generate a translation plugin for SonarQube.
- Download the source code from the repository:
- Empty the
src/main/resources/l10n/<TRANSLATION>.propertiesfile. - Build the project using Maven:
mvn test - This will generate a list of missing translations in the
target/directory. - Configure the python script to include your OpenAI API key by editing the
.envfile in the python folder: - Run the python script
generate_translations.py.This script will automatically assume the missing translation file inpython3 generate_translations.py
../target/surefire-reports/org.sonar.plugins.l10n.JapanesePackPluginTest.txtand output it to../src/main/resources/org/sonar/l10n/core_ja.properties - Build the project again using Maven:
mvn clean package
- Copy the target JAR file to the SonarQube plugins directory:
cp target/sonar-l10n-ja-plugin-*.jar /path/to/sonarqube/extensions/plugins/
You will need to repackage this plugin to release any updates
- Update your server version in your
pom.xml - Run
mvn test
For enterprise and developer edition:
You can also view the full translation file in our public repo here https://github.com/SonarSource/sonarqube/blob/master/README.md#translations-files
From the ts file, you can convert to .properties using the above-mentioned command
You may encounter the following issues with alerts.operator.!= not being translated correctly.
You can fix this by updating it to alerts.operator.!\u003d=
The same will happen for alerts.operator.== which should be updated to alerts.operator.\u003d=
The python script assume the following:
- An empty translation file, so if you have existing translations, you may need to manually merge them with the generated translations.
- The source file is in the format of surefire reports missing translations, which is the output of the SonarQube test.
It will consume approximately 55k tokens to translate. With chatgpt-4o, it will cost approximately US$1. Adjust the model accordingly to fit your budget.
This sample project is free to use for any purpose, including commercial use, without any restrictions. This is not part of Sonar's official plugins. This sample plugin is to be use at your own risk, and it is not supported by Sonar. The plugin is provided "as is" without any warranty of any kind, either express or implied.