Resource bundles
Resource bundles are used to store text displayed in JSPs or text used in Java code.
To support a new language to IBM WebSphere Portal...
- Add resource bundles
- Add JSPs for the new language (Optional)
- Configure CreateLanguage.xml
- Update the list of available languages by adding the new language to the portal using the XML configuration interface
The new language is then listed in the language selection menu boxes that are available in administration portlets, or for example, in...
Edit My Profile | Preferred languageThe new language will be available only to portlets that you add to your portal, if these portlets support the newly added language and if you make the required language files available. None of the WebSphere Portal user interface or messages will be translated to the new language.
Resource bundles are located in...
- portal_server_root/ui/wp.ui/shared/app/wp.ui.jar
- portal_server_root/theme/wp.theme.customizer.ext/shared/app/wp.theme.customizer.ext.jar
Resource bundles are also found in the deployed war file under...
nls/wp.theme.customizer.extTo add new resource bundles for additional languages place them into...
portal_server_root/shared/app/nls
The naming convention for resource bundles is...
[bundle]_[language]_[country]_[variant].propertiesPortlets define resource bundles as part of their Java Resources. For example, BookmarkPortletView.jsp contains...
<fmt:setBundle basename="com.ibm.portal.examples.nl.BookmarkPortletJSP"/> <% ResourceBundle myText = ResourceBundle.getBundle("com.ibm.portal.examples.nl.BookmarkPortletJSP", request.getLocale()); %> <h4><fmt:message key="available_bookmarks"/></h4>...where file...
com.ibm.portal.examples.nl.BookmarkPortletJSP...contains...
available_bookmarks = Available bookmarks
no_bookmarks = No bookmaks available. Use edit mode to add bookmaks.
undefined = undefined
name = Name
url = URL
set = Set
reset = reset
back = Back to view modeThe ISO standard ISO-639 is used for the language codes of most languages.
For Hebrew the old language code iw is used.
The ISO standard ISO-3166 is used for the country/region codes. WebSphere Portal supports the use of [variant] although resource bundles supplied with the portal do not use it.
If your portal configuration includes Lotus Collaborative Services, for each additional language, add a new...
portal_server_root/shared/app/nls/CSRes_language.propertiesWebSphere Portal uses properties files called by...
java.util.ResourceBundle...to store text rendered in JSPs. The Java mechanism searches for the resource bundles in the following order:
- [bundle]_[language]_[country]_[variant].properties
- [bundle]_[language]_[country].properties
- [bundle]_[language].properties
- [bundle].properties
The default bundles [bundle].properties are in English.
Add a resource bundle
To add a resource bundle...
- Copy all existing resource bundles into...
portal_server_root\shared\app\nls- Name it according to the naming convention for resource bundles using locale code for the language(s) installed.
- Translate the resource bundle files.
- Convert it into Unicode with the Native-to-ASCII converter native2ascii
- Restart Portal
Add JSPs for a new language
Some JSPs that contain mostly text, such as help JSPs, are translated directly which means that the text is contained in the JSP and not in a resource bundle.
For JSPs that do not use resource bundles, copy and translate an existing JSP and store it in the appropriate location.
The location of JSPs can be, for example...
jsp/[mime-type]/[language]/[country]/[variant]/files.jspFor instance, existing help JSPs are already translated in WebSphere Portal and placed in the relevant [language]and [country] subdirectories. When deciding where to store new JSPs, consider how the portal locates a JSP for rendering its content.
The following is an example of the order in which directories are searched, where path2 is a user-defined path, ie5 is the markup version (here: Internet Explorer 5), and the locale is en_US:
- /html/path2/ie5/en_US/mytemplate.jsp
- /html/path2/ie5/en/mytemplate.jsp
- /html/path2/ie5/mytemplate.jsp
- /html/path2/en_US/mytemplate.jsp
- /html/path2/en/mytemplate.jsp
- /html/path2/mytemplate.jsp
- /html/en_US/mytemplate.jsp
- /html/en/mytemplate.jsp
- /html/mytemplate.jsp
- /mytemplate.jsp
This means that if the user language is not supported, the portal will choose the file in the locale independent location, which in the example is the English file.
Parent topic
Language support
Related tasks
Related reference
Sample XML configuration files