This section mentions code from Portal Extension Example from the Quickstarts Collection.
There are two resource bundle customization scenarios possible with a Portal Extension:
Both scenarios can be demonstrated on locale.portal.extension resource bundle. To use this bundle we need to include it in both init.resources and portal.resource.names parameters of BaseResourceBundlePlugin in war/src/main/webapp/WEB-INF/conf/sample-ext/common/common-configuration.xml:
common-configuration.xml containing declarations of navigation resource bundles
19. <configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20. xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_2.xsd http://www.exoplaform.org/xml/ns/kernel_1_2.xsd" xmlns="http://www.exoplaform.org/xml/ns/kernel_1_2.xsd">
21. <external-component-plugins>
22. <!-- The full qualified name of the ResourceBundleService -->
23. <target-component>org.exoplatform.services.resources.ResourceBundleService</target-component>
24. <component-plugin>
25. <!-- The name of the plugin -->
26. <name>Sample ResourceBundle Plugin</name>
27. <!-- The name of the method to call on the ResourceBundleService in order to register the ResourceBundles -->
28. <set-method>addResourceBundle</set-method>
29. <!-- The full qualified name of the BaseResourceBundlePlugin -->
30. <type>org.exoplatform.services.resources.impl.BaseResourceBundlePlugin</type>
31. <init-params>
32. <values-param>
33. <name>init.resources</name>
34. <description>Initiate the following resources during the first launch.</description>
35. <value>locale.portal.extension</value>
36. <value>locale.navigation.user.root</value>
37. <!--
38. Note that we actually do not need to name locale.navigation.portal.classic and
39. locale.navigation.group.platform.administrators here as they are in init.resources
40. of the default GateIn installation. But it makes no harm to include them once again here.
41. -->
42. <value>locale.navigation.portal.classic</value>
43. <value>locale.navigation.group.platform.administrators</value>
44. </values-param>
45. <values-param>
46. <name>portal.resource.names</name>
47. <description>These resources are merged to a single resource bundle which is accessible from anywhere
48. in GateIn. All these keys are located in the same bundle, which is separated from the navigation
49. resource bundles.</description>
50. <value>locale.portal.extension</value>
51. </values-param>
52. </init-params>
53. </component-plugin>
54. </external-component-plugins>
55. </configuration>
The English version of locale.portal.extension can be found under war/src/main/webapp/WEB-INF/classes/locale/portal/extension_en.properties:
English version of locale.portal.extension
17. UIHomePagePortlet.Label.Slogan=Congratulations!
18. UIHomePagePortlet.Label.SubSlogan=You have just installed the GateIn Portal Extension
19. UIHomePagePortlet.Label.Title=Sign in as:
UIHomePagePortlet.Label.SubSlogan is a new key which is not available in default GateIn Portal installation.
However, UIHomePagePortlet.Label.Slogan is redefined in extension_en.properties shown above. In gatein.ear/web.war/WEB-INF/classes/locale/portlet/web/GroovyPortlet_en.properties it is already defined as
UIHomePagePortlet.Label.Slogan=The Best of eXo and JBoss Portal<div>GateIn #{gatein.version}</div>
and here, within the Portal Extension we assign a new value Congratulations! to it.
Please refer to the previous section for more details on internationalization of navigation nodes.