Registering localized resources with ResourceBundle service

In this example, you have a resource file, that is ViewSource_en.properties. The _en suffix means English. You can write many resources for other languages.

  1. Edit the ViewSource_en.properties file as below:

    MoreExtensionContainer.action.ViewSource=View Source

    This indicates that the label of your action will be View Source.

    Name of the MoreExtensionContainer.action.ViewSource property must be changed if you use another type. It is dependent on the gtmpl file you use in your Java class. See this code in wiki.war!/templates/wiki/webui/control/action/AbstractActionComponent.gtmpl:

    String labelName = _ctx.appRes(uicomponent.getParent().getName() + ".action." + actionName);
  2. Configure the ResourceBundle service in the configuration.xml file as below:

            <name>UI Extension</name>

    Pay attention to the resource name: locale.com.acme.ViewSource. It is a translation of the locale/com/acme/ViewSource_en.properties file path (relative to the Jar archive), with the _en suffix and the .properties extension is eliminated.

    See here for the ResourceBundle configuration.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus