You are looking at documentation for an older release. Not what you want? See the current release documentation.
In your custom-extension.war
, if you want to add your own resource files to support localization,
you can do as follows:
Add some folders and files to your custom extension to have:
WEB-INF |__ classes | |__ locale | |__ portal | |__ sample_en.properties | |__ sample_fr.properties |__ conf | |__ configuration.xml | |__ locale-configuration.xml |__ web.xml
In this example there are 2 resources for English (_en) and French (_fr). The resource files can be .properties or .xml.
It is necessary that the resources are located in WEB-INF/classes
.
Edit locale-configuration.xml
to configure ResourceBundleService
:
<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd http://www.exoplatform.org/xml/ns/kernel_1_2.xsd"
xmlns="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd">
<external-component-plugins>
<target-component>org.exoplatform.services.resources.ResourceBundleService</target-component>
<component-plugin>
<name>Sample ResourceBundle Plugin</name>
<set-method>addResourceBundle</set-method>
<type>org.exoplatform.services.resources.impl.BaseResourceBundlePlugin</type>
<init-params>
<values-param>
<name>init.resources</name>
<value>locale.portal.sample</value>
</values-param>
<values-param>
<name>portal.resource.names</name>
<value>locale.portal.sample</value>
</values-param>
</init-params>
</component-plugin>
</external-component-plugins>
</configuration>
Pay attention to the value locale.portal.sample
. It is like a translation of the path of your resources
(locale/portal/sample
- with the language code and file extension name is eliminated).
Edit configuration.xml
to import the locale-configuration.xml
:
<configuration
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd http://www.exoplatform.org/xml/ns/kernel_1_2.xsd"
xmlns="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd">
<import>war:/conf/locale-configuration.xml</import>
</configuration>