Web Space Server is localized out-of-box in 22 languages. Sun provides localization support for Japanese (ja) and Simplified Chinese (zh_CN) but support for others is community driven.
The following sections describe how to perform localization:
Users can use Web Space Server in any of the supported languages.
Log in to Web Space Server.
Choose My Account from the Welcome menu.
The Control Panel is displayed.
Choose Display Settings under Miscellaneous in the menu on the right.
Select a language from the Language drop-down list.
Click Save.
The user interface changes to the language selected.
You can use the same page to change the time zone and the greeting message.
You can add localization support for a language that is not supported by Web Space Server by default. This section describes how you can add localization support for a new language.
This task describes how to create a portal-ext.properties file, and make changes to it to support localization.
Create a temporary folder. In this example, name the folder as test.
mkdir /tmp/test
Copy portal-impl.jar to the tmp folder.
The portal-impl.jar file contains resource bundles for Web Space Server. This JAR file is located in the GlassFish install-dir/domains/domain1/application/j2ee-modules/webspace/WEB-INF/lib/ directory.
cd GlassFish-install-dir/domains/domain1/application/j2ee-modules
cp webspace/WEB-INF/lib/portal-impl.jar /tmp/test
Change to the tmp directory.
cd /tmp/test
Extract the portal-impl.jar file.
jar -xvf portal-impl.jar
The portal.properties file will be placed in the current directory.
Open portal.properties and copy the locales property from the Languages and Time Zones section.
If a portal-ext.properties file does not already exist, create a text file with that name.
The default location of portal-ext.properties is GlassFish home/applications/j2ee-modules/webspace/WEB-INF/classes/portal-ext.properties.
Paste the locales property into the portal-ext.properties file.
Add the new locale at the end of the locales property in the format LanguageCode_CountryCode.
See the following links to find language and country codes:
http://ftp.ics.uci.edu/pub/ietf/http/related/iso639.txt for language codes.
http://userpage.chemie.fu-berlin.de/diverse/doc/ISO_3166.html for country codes.
For example, if you are adding support for Hindi, you need to add hi_IN at the end of locales property as follows:
locales=ar_SA,ca_AD,ca_ES,zh_CN,zh_TW,cs_CZ,nl_NL,en_US,fi_FI,fr_FR,de_DE,el_GR,hu_HU, it_IT,ja_JP,ko_KR,nb_NO,fa_IR,pt_BR,ru_RU,es_ES,sv_SE,tr_TR,vi_VN,hi_IN
Save the portal-ext.properties file.
Navigate to the content folder and open the Language.properties file.
A folder named content was created when you extracted the portal-impl.jar file.
Translate all the strings you want to localize from temp/test/content/Language.properties to the new language.
Rename the translated Language.properties file to Language-ext_LanguageCode.properties.native.
Run the following command on the directories that contains the Language-ext_LanguageCode.properties.native file:
native2ascii -encoding UTF-8 Language-ext_LanguageCode.properties.native Language-ext_LanguageCode.properties
Create a directory structure webspace/WEB-INF/classes/ under ZIP_ROOT/webspace-for-gfv2/var/webspace/war-workspace/customs, and copy portal-ext.properties file to it.
Create a directory structure webspace/WEB-INF/classes/content under ZIP_ROOT/webspace-for-gfv2/var/webspace/war-workspace/customs, and copy Language-ext_LanguageCode.properties.native file to it.
Change to the ZIP_ROOT/webspace-for-gfv2/var/webspace/war-workspace directory.
cd ZIP_ROOT/webspace-for-gfv2/var/webspace/war-workspace
Run ant -f synchronize.xml.
Restart theGlassFish server.
Log in to Web Space Server as the admin user.
Choose My Account from the Welcome menu.
The Control Panel is displayed.
Choose Display Settings under Miscellaneous.
The new language setting is reflected in the Language drop-down menu.
Select the language for the user and click Save.
The user interface is changed to the new language.
Generally, users don't require localization support for all languages that are supported by Web Space Server. This section describes how you can remove localization support for the languages that are not required.
Create a temporary folder. In this example, name the folder as test.
mkdir /tmp/test
Copy portal-impl.jar to the tmp folder.
portal-impl.jar contains language resource bundles for Web Space Server. This JAR file is located in the GlassFish install-dir/domains/domain1/application/j2ee-modules/webspace/WEB-INF/lib/ directory.
cd GlassFish-install-dir/domains/domain1/application/j2ee-modules
cp webspace/WEB-INF/lib/portal-impl.jar /tmp/test
Change to the tmp directory.
cd /tmp/test
Extract the portal-impl.jar file.
jar -xvf portal-impl.jar
Open portal.properties and copy the locales property from the Languages and Time Zones section.
If portal-ext.properties does exist in Web Space Server then paste the locales property into it. Otherwise, create a text file (using any text editor) and name it as portal-ext.properties, and paste the locales property into it.
Default location of portal-ext.properties is GlassFish home/applications/j2ee-modules/webspace/WEB-INF/classes/portal-ext.properties.
Edit the locales property to include only the languages that are needed.
For example, if you want to support only English, German and Spanish, remove all the unwanted locales so that the locales value looks as follows:
locales=en_US,de_DE,es_ES
Save the portal-ext.properties file.
Create a directory structure webspace/WEB-INF/classes/ under ZIP_ROOT/webspace-for-gfv2/var/webspace/war-workspace/customs, and copy the portal-ext.properties file to it.
Change to the ZIP_ROOT/webspace-for-gfv2/var/webspace/war-workspace directory.
cd ZIP_ROOT/webspace-for-gfv2/var/webspace/war-workspace
Run ant -f synchronize.xml.
Restart the GlassFish server.
The server will redeploy websynergy.war and update portal-ext.properties under applications/j2ee-modules/webspace/WEB-INF/classes.
Guest users can select their preferred browser language.
Create a temporary folder, named test.
mkdir /tmp/test
Copy portal-impl.jar to the tmp folder.
portal-impl.jar contains language resource bundles for Web Space Server. This JAR file is located in the GlassFish install-dir/domains/domain1/application/j2ee-modules/webspace/WEB-INF/lib/ directory.
cd GlassFish-install-dir/domains/domain1/application/j2ee-modules
cp webspace/WEB-INF/lib/portal-impl.jar /tmp/test
Change to the tmpdirectory.
cd /tmp/test
Extract the portal-impl.jar file.
jar -xvf portal-impl.jar
The portal.properties file will be placed in the current directory.
Open portal.properties and copy the locale.default.request property from the Languages and Time Zones section.
If portal-ext.properties does exist in Web Space Server then paste the locale.default.request property into it. Otherwise, create a text file (using any text editor) and name it as portal-ext.properties, and paste the locale.default.request property into it.
Default location of portal-ext.properties is GlassFish home/applications/j2ee-modules/webspace/WEB-INF/classes/portal-ext.properties.
Set the property to locale.default.request=true.
Save the portal-ext.properties file.
Create a directory structure webspace/WEB-INF/classes/ under ZIP_ROOT/webspace-for-gfv2/var/webspace/war-workspace/customs, and copy the portal-ext.properties file to it.
Change to the ZIP_ROOT/webspace-for-gfv2/var/webspace/war-workspacedirectory.
cd ZIP_ROOT/webspace-for-gfv2/var/webspace/war-workspace
Run ant -f synchronize.xml.
Restart the GlassFish server.
It will redeploy websynergy.war and update portal-ext.properties under applications/j2ee-modules/webspace/WEB-INF/classes. Clear browser cookies before accessing Web Space Server interface to allow the changes to take effect.
Language and display information is defined in the Language.properties, as well as various other Language_LanguageCode.properties files for foreign languages. When you extract the portal-impl.jar file, these files are placed in the content folder. Language.properties is the primary and default language definition file, but definitions in that file may be overridden by language-specific definitions. For example, the file Language_en.properties contains the English versions of most of the definitions, the file Language_fr.properties contains the French version, and so on.
Language files can further have locale-specific definitions. The Language_en_US.properties file contains English phrase variations further defined for the United States. Other languages can also have locale-specific definitions.
The hierarchy of precedence for different Language.properties files is:
Language-ext.properties takes precedence over Language.properties.
Language-specific versions take precedence over the non language-specific versions. For example, Language_en.properties takes precedence over Language.properties.
Location-specific versions take precedence over the non location-specific versions. For example, Language_en_US.properties takes precedence over Language_en.properties.
For the Language.properties file for English, Language-ext_en_US.properties has the highest precedence and the Language.properties file has the least precedence. The hierarchy is:
Language-ext_en_US.properties
Language_en_US.properties
Language-ext_en.properties
Language_en.properties
Language-ext.properties
Language.properties
You can easily change existing English and foreign languages entries in Web Space Server. Consider the example of changing the name of a portlet from Message Boards to Forums. To do this when English is the default language, you would create the Language-ext_en.properties to override the Language_en.properties file. In Language-ext_en.properties, duplicate the content in the Language_en.properties file, and replace the entry javax.portlet.title.19=Message Boards with javax.portlet.title.19=Forums. The portlet Message Boards is renamed to Forums.
You can also add new language entries for customization or for new portlets. For example, you can create an entry similar to javax.portlet.title.EXT_1=Reports to add the name of a new portlet named Reports.
You can customize the name of a ported for any language by using the Look and Feel button on the portlet. Consider the example of localizing Web Space Server to French. In this case, the name of the Admin portlet translates as Administration du portail. You might prefer to have a customized name for the Admin portlet when Web Space Server is localized to French.
Log in to the Web Space Server as the admin user.
Click the Look and Feel button on a portlet.
In this example, click the Look and Feel button on the Admin portlet.
Select the Use Custom Title option.
Select a language from the language list.
In this example, select French.
Type a title for the portlet in the selected language in the Portlet Title box.
In this example, type the name Administration.
Click Save.
For the changes to take effect, you may have to save twice: once with the Use Custom Title option deselected and again with selected. Some times the portlet name in the default language too may have changed. You need to verify this.
Choose My Account from the Welcome menu.
Choose Display Settings under Miscellaneous.
Select a language from the Language list that is the same as the language selected previously.
For example, select French.
Click Save and navigate back to the community page.
You can see the changed name of the portlet in the localized version. In this example, the name of the Admin portlet localized to French is changed from Administration du portail to Administration.