Internationalization

Localizing the content provided by the plugin

The /config directory is the place where the localized property files are stored.

The property files are named plugin_(locale).properties : for example, plugin_fr.properties, for the French translation.

Basic localization

The basic way to access the keys in JSP pages is by initializing your bundle :

<noheto:setPluginBundle var="myPluginBundle" plugin="${plugin}" locale="${locale}" scope="request"/>

Then look for localized messages :

<noheto:message bundle="${myPluginBundle}" key="the_label_key"> <noheto:parameter value="${optional parameters if you need to customize the message}" /> </noheto:message>

Common bundle init within multiple pages

If your plugin contains multiple pages that hook on the Back-Office, it is good practice to init your bundle once :

Create a page/bov3/common/init/initBundle/initBundle_content_before.jsp

<%@page pageEncoding="UTF-8"%> <%@taglib prefix="c" uri="/WEB-INF/c.tld" %> <%@taglib prefix="noheto" uri="/WEB-INF/noheto.tld" %> <noheto:skipPage test="${not pageContext.request.included}"/> <noheto:setBundle var="myPluginBundle" scope="request" baseName="${plugin.bundleBaseName}" locale="${surfer.CTSurfer.locale}"/>

 

Then, you will have the following method available in your BOv3 pages :

Java localization in your plugins

Another way in pure Java to address the bundle could be :

Localizing the Info descriptions

The "Info" section gives general information about the plugin and is likely to be localized in a multilingual environment

If you need to localize in multiple languages the information description, you can create new keys in a "plugin_(locale).properties" file in the /config directory of your plugin.

Keys for a specific information should follow this pattern : info.tag_to_be_translated

For example : for an english (en) translation of short description (shortdescription) :

  • create the <plugin>/config/plugin_en.properties

  • populate it with info.shortdescription = "This is my short description"

Localizing the Parameters descriptions

If you need to localize in multiple languages the parameter description, you can create new keys in a "plugin_(locale).properties" file in the /config directory of your plugin.

Keys for a specific parameter name should follow this pattern : parameter_<name>_description

For example : for an english (en) translation of mystring parameter :

  • create the <plugin>/config/plugin_en.properties

  • populate it with parameter_mystring_description = "This is my parameter description"