Sun GlassFish Web Space Server 10.0 Administration Guide

ProcedureTo Add New Language Support

This task describes how to create a portal-ext.properties file, and make changes to it to support localization.

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

    mkdir /tmp/test

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

  3. Change to the tmp directory.

    cd /tmp/test

  4. Extract the portal-impl.jar file.

    jar -xvf portal-impl.jar

    The portal.properties file will be placed in the current directory.

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

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

  7. Paste the locales property into the portal-ext.properties file.

  8. 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:

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

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


    Note –

    A folder named content was created when you extracted the portal-impl.jar file.


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

  12. Rename the translated Language.properties file to Language-ext_LanguageCode.properties.native.

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

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

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

  16. Change to the ZIP_ROOT/webspace-for-gfv2/var/webspace/war-workspace directory.

    cd ZIP_ROOT/webspace-for-gfv2/var/webspace/war-workspace

  17. Run ant -f synchronize.xml.

  18. Restart theGlassFish server.