Question about implementing internationalization in a plugin

Hi there,

I have what I hope is a relatively simple question to answer. According the live documentation at https://docs.sonarqube.org/latest/extend/i18n/, implementing internationalization on a server-side plugin can be done via a provided API class:

The component org.sonar.api.i18n.I18n is available for web server extensions.

However when experimenting I quickly realised that this class has been marked as deprecated. A quick look at https://docs.sonarqube.org/latest/extend/developing-plugin/#header-4 shows this has been the case since SonarQube 7.8.

I am unable to find any documentation that says what approach should be used in its place. Interestingly the JIRA that the deprecation was made in (https://jira.sonarsource.com/browse/SONAR-9898) states:

Let’s fully deprecate org.sonar.api.i18n.I18n as there’s no more reason for a plugin to use it.

I realise that plugin properties support localization via bundle keys, but what about other custom localization values that may be used server-side e.g. when sending custom notifications etc. Previously you would retrieve these via the message method on the I18n interface.
If you could please clarify what the recommended approach is moving forwards, particularly from the perspective of usage in a @ComputeEngineSide extension, it would be greatly appreciated!

Thanks in advance,
Sam

Hi @santhonisz,

The I18n API was used when the UI was using Java API, mostly when Rails was used.

In your case, you’d like to use it in a Compute Engine extension, but it’s useless as there’s no bundle on server side, only the English bundle is used.
So you can safely use some hardcoded english message.

Regards,
Julien Lancelot