Project WebSynergy Milestone 4 Administration Guide

Localization

WebSynergy is localized out-of-box in 22 languages , out of which Sun provides localization support for Japanese (ja) and Simplified Chinese (zh_CN). Remaining languages are community driven.

Setting User Prefered Language in WebSynergy

User can use WebSynergy in their preferred language from any of the languages supported by it. This section describes how users can change their preferred language.

ProcedureTo set User Language

  1. Login to WebSynergy as admin user.

  2. Click 'My Account' from the welcome dock, it takes you to the Control Panel.

  3. Click on the 'Display Settings' link under Miscellaneous in the right menu.

  4. Select a language from the Language drop down.

  5. Click Save.

    User interface changes to the language selected. You can repeat the above steps to change the language again in the feature.


    Note –

    You can use the same page to change the time zone and the greeting message.


Adding a new Language Support

You can add localization support for a language which is not supported by WebSynergy by default. This section provides details on how you can add localization support for a new language.

ProcedureTo add new Language Support

The WebSynergy evaluation bundle has a portal-ext.properties file in the GlassFish install-dir/domains/domain1/applications/j2ee-modules/websynergy/WEB-INF/classes. When you are using a WebSynergy bundle which is not including samples, you have to create a portal-ext.properties file. This task describes the process to create a portal-ext.properties file, and making changes to it to support localization.

  1. Create a temporary folder. In this example, name the folder as test.

    Equivalent step in the command prompt or in the terminal window of a UNIX like OS:

    mkdir /tmp/test

  2. Copy portal-impl.jar to the temp folder.

    portal-impl.jar contains language resource bundles for WebSynergy. This jar file is located under the GlassFish install-dir/domains/domain1/application/j2ee-modules/websynergy/WEB-INF/lib/ directory.

    Equivalent step in the command prompt or in the terminal window of a UNIX like OS:

    cp GlassFish install-dir/domains/domain1/application/j2ee-modules/websynergy/WEB-INF/lib/portal-impl.jar /tmp/test

  3. Change directory to temp.

    Equivalent step in the command prompt or in the terminal window of SOLARIS or any UNIX like OS:

    cd /tmp/test

  4. Extract the portal-impl.jar file.

    Equivalent step in the command prompt or in the terminal window of a UNIX like OS:

    jar -xvf portal-impl.jar

    After unjar it will have portal.properties file in the same directory.

  5. Open portal.properties and copy the locales property from the Languages and Time Zones section.

  6. if portal-ext.properties does exits in WebSynergy 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 install-dir/domains/domain1/applications/j2ee-modules/websynergy/WEB-INF/classes/portal-ext.properties.

  7. Modify the locales to add the new locale at the end. Add new locale in the format of “LanguageCode_CountryCode”.

    See the following links to find language and country codes:

    For example, if you are adding support for Hindi, you need to add hi_IN at the end of locales property as shown below:

    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
  8. Save the portal-ext.properties file.

  9. Navigate to the content folder and open the Language.properties file.


    Note –

    A folder named content is created on extracting the portal-impl.jar file using the unjar command.


  10. Translate all the strings you want to localize from temp/test/content/Language.properties to the new language.

  11. Rename the translated Langauge.properties file to Language-ext_<LanguageCode>.properties.native.

  12. Run the following commands on the directory which contains the Language-ext_<LanguageCode>.properties.native file:

    native2ascii -encoding UTF-8 Language-ext_<LanguageCode>.properties.native Language-ext_<LanguageCode>.properties

  13. Copy the portal-ext.properties file (under temp/test), and paste it to GlassFish install-dir/domains/domain1/applications/j2ee-modules/websynergy/WEB-INF/classes.

  14. Copy the Language-ext_<LanguageCode>.properties.native file (under temp/test/content) and the Language-ext_<LanguageCode>.properties files (under temp/test/content), and paste them to GlassFish install-dir/domains/domain1/applications/j2ee-modules/websynergy/WEB-INF/classes/content.

  15. Restart GlassFish server.

ProcedureTo Verify the Localization of the Interface

  1. Log in to WebSynergy as admin user.

  2. Click on My Account from the welcome dock, it takes you to the Control Panel.

  3. Click on the Display Settings link under Miscellaneous.

    The new language setting is reflected in the Language drop-down menu.

  4. Select the language for the user and click Save.

    The user interface is changed to the new language.

Removing Localization Support for Unwanted Languages

Generally, users don't require localization support for all the languages which are supported by WebSynergy. This section describes how you can remove localization support for the languages which are not required.

ProcedureTo Remove Localization Support for Unwanted Languages

Overwrite the locales property of portal.properties to remove unwanted languages. You need to make sure that the portal-ext.properties file is placed at GlassFish install-dir/domains/domain1/applications/j2ee-modules/websynergy/WEB-INF/classes.

  1. Create a temporary folder. In this example, name the folder as test.

    Equivalent step in the command prompt or in the terminal window of a UNIX like OS:

    mkdir /tmp/test

  2. Copy portal-impl.jar to the temp folder.

    portal-impl.jar contains language resource bundles for WebSynergy. This jar file is located under the GlassFish install-dir/domains/domain1/application/j2ee-modules/websynergy/WEB-INF/lib/ directory.

    Equivalent step in the command prompt or in the terminal window of a UNIX like OS:

    cp GlassFish install-dir/domains/domain1/application/j2ee-modules/websynergy/WEB-INF/lib/portal-impl.jar /tmp/test

  3. Change directory to temp.

    Equivalent step in the command prompt or in the terminal window of SOLARIS or any UNIX like OS:

    cd /tmp/test

  4. Extract the portal-impl.jar file.

    Equivalent step in the command prompt or in the terminal window of a UNIX like OS:

    jar -xvf portal-impl.jar

    After unjar it will have portal.properties file in the same directory.

  5. Open portal.properties and copy the locales property from the Languages and Time Zones section.

  6. if portal-ext.properties does exits in WebSynergy 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 install-dir/domains/domain1/applications/j2ee-modules/websynergy/WEB-INF/classes/portal-ext.properties.

  7. Edit the locales property to include only the languages which 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 below:

    locales=en_US,de_DE,es_ES
  8. Save the portal-ext.properties file.

  9. Copy the portal-ext.properties file (under temp/test), and paste it to GlassFish install-dir/domains/domain1/applications/j2ee-modules/websynergy/WEB-INF/classes.

  10. Restart the GlassFish server.

Enabling the Guest Users to Select a Browser Language

Follow the below procedure to enable guest users to select their preferred browser language.

ProcedureTo Enable Guest Users to Select a Browser Language

Overwrite locale.default.request property in the Languages and Time Zones section of portal.properties to enable guest users to select their preferred browser language. You need to set this property value to true and put it in portal-ext.properties.

  1. Create a temporary folder. In this example, name the folder as test.

    Equivalent step in the command prompt or in the terminal window of a UNIX like OS:

    mkdir /tmp/test

  2. Copy portal-impl.jar to the temp folder.

    portal-impl.jar contains language resource bundles for WebSynergy. This jar file is located under the GlassFish install-dir/domains/domain1/application/j2ee-modules/websynergy/WEB-INF/lib/ directory.

    Equivalent step in the command prompt or in the terminal window of a UNIX like OS:

    cp GlassFish install-dir/domains/domain1/application/j2ee-modules/websynergy/WEB-INF/lib/portal-impl.jar /tmp/test

  3. Change directory to temp.

    Equivalent step in the command prompt or in the terminal window of SOLARIS or any UNIX like OS:

    cd /tmp/test

  4. Extract the portal-impl.jar file.

    Equivalent step in the command prompt or in the terminal window of a UNIX like OS:

    jar -xvf portal-impl.jar

    After unjar it will have portal.properties file in the same directory.

  5. Open portal.properties and copy the locale.default.request property from the Languages and Time Zones section.

  6. if portal-ext.properties does exits in WebSynergy 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 install-dir/domains/domain1/applications/j2ee-modules/websynergy/WEB-INF/classes/portal-ext.properties.

  7. Edit the property to set it to locale.default.request=true.

  8. Save the portal-ext.properties file.

  9. Copy the portal-ext.properties file (under temp/test), and paste it to GlassFish install-dir/domains/domain1/applications/j2ee-modules/websynergy/WEB-INF/classes.

  10. Restart the GlassFish server.


    Note –

    Clear browser cookies before accessing WebSynergy interface to allow above changes to take place.


Hierarchy of Precedence for Language.properties files

Language/display information is defined in Language.properties, as well as various other Language_<LanguageCode>.properties files for foreign languages. These files are obtained on extracting the portal-impl.jar file, and 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, etc.

Language files can further have locale specific definitions. The Language_en_US.properties file (if it exists), contains the English phrase variations further defined for the United States. Other languages can also have locale specific definitions.

Rules of Precedence

The following is the hierarchy of precedence for different Language.properties files to override each other:

  1. Language-ext.properties takes precedence over Language.properties.

  2. Language specific versions take precedence over the non language specific versions. For example, Language_en.properties takes precedence over Language.properties.

  3. 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, the following is the hierarchy of precedence, where Language-ext_en_US.properties will have the highest precedence and the Language.properties file will have the least precedence:

  1. Language-ext_en_US.properties

  2. Language_en_US.properties

  3. Language-ext_en.properties

  4. Language_en.properties

  5. Language-ext.properties

  6. Language.properties

Changing the Existing Language Entries

WebSynergy allow a easy way to change existing language entries. You can change English and foreign languages entries. Consider the example of changing the name of a portlet from Message Boards to Forums. To do this in the case when English is the default language, you need to create the Language-ext_en.properties to override the Language_en.properties file. Replicate Language-ext_en.properties with the content in the Language_en.properties file, and search and replace the entry javax.portlet.title.19=Message Boards with javax.portlet.title.19=Forums. The portlet Message Boards is renamed to Forums.

WebSynergy also allows you to add new language entries for customization or for new portlets. For example, you can make an entry similar to javax.portlet.title.EXT_1=Reports, to add the name of a new portlet named Reports.

Customizing the Name of a Portlet for a Language

Consider the example of localizing WebSynergy to French. In this case, name of the Admin portlet translates as Administration du portail. You may not find this appropriate, and may want to have a customized name for the Admin portlet when WebSynergy is localized to French. You can customize the name of a portlet for any language by using the Look and Feel button on a portlet.

ProcedureTo Customize the Name of a Portlet for a Language

  1. Login the WebSynergy as admin user.

  2. Click on the 'Look and Feel' button on a portlet.

    In this example, click on the Look and Feel button on the Admin portlet.

  3. Select the 'Use Custom Title' option.

  4. Select a language from the language list.

    In this example, select French.

  5. Type a title for the portlet in the selected language in the 'Portlet Title' box.

    In this example, specify the name of the portlet as Administration.

  6. Click Save.


    Note –

    For the changes to take effect, you may have save twice with 'Use Custom Title' option canceled and selected respectively. Some times the portlet name in the default language too may have changed. You need to verify this.


  7. Select 'My Account' from the welcome dock.

  8. Click 'Display Settings' under 'Miscellaneous'.

  9. Select a language from the 'Language' list which is the same as the language selected previously.

    In this example, select French.

  10. 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.