Project

General

Profile

DO NOT EDIT HERE! This page is about to be deleted. The content is now maintained in Translations.

Introduction

FWD provides translation support for the 4GL legacy application.

Applications translated with OpenEdge Translation Manager can be converted and executed using all the translation data implemented using the OE Translation Manager. This process is fully automated if the translation database is kept up to date with the legacy sources.

The use of Translation Manager is not a requirement, legacy applications can be trnaslated after they are converted.

FWD implements gettext, the proven and widely used internationalization and localization (I18N and L10N) system. The biggest advantage of gettext is its ability to separate writing code from the work of text translation. The typical workflow of translations in gettext applications is as follows:

  • write code, enclose translatable literals in translation methods
  • create a set of .po files from the sources, a grep-like tool is used to extract the translatable literals
  • add translations to the *.po entries, as needed
  • generate resource bundles from the translated *.po files
  • deploy the resource bundles, which hold the translations for runtime usage, in the application

The FWD I18N workflow utilizes some of the tools from the GNU gettext package. GNU gettext is the most commonly used implementation of gettext. It is available for all the most commonly used OS platforms, including Windows and Linux.

Requirements

FWD v4

This feature was added in #3817 and the changes are complete as of branch 3821c revision 13125. This is first available to the public as FWD v4.

GNU gettext

Installation is as follows:

Ubuntu Windows
sudo apt-get update -y
sudo apt-get install -y gettext
Download the correct binary package from https://mlocati.github.io/articles/gettext-iconv-windows.html and run the downloaded executable. Make sure the installed executables are on the system PATH.

Standard Project Layout

The details below may reference the standard project layout as can be seen in Hotel_GUI_Demo_Application.

Converting a Translated Project

To convert an existing 4GL application translated with OpenEdge Translation Manager perform the following steps:

  • export the translations from Translation Manager (TM)
  • configure and convert the legacy application
  • run the legacy application

Exporting Translations from TM

TM has the capability to export the translation data. However the current release of TM, which is hosted on Github (https://github.com/gquerret/adetran), has some limitations and doesn't export all the required information. We extended the Github hosted TM and patched this limitation. To export the translation data download the improved TM from https://proj.goldencode.com/attachments/download/13052/adetran-master%20_extended_export.zip (TODO: provide a public location), build the project and launch the built Translation Manager. The next steps in the running TM instance are:

  • Switch to the Data tab.
  • File -> Export...
  • In the Export dialog select the UTF-8 code page and export.
  • Repeat the export for all the target languages.

Configuring and Converting the Legacy Application

During conversion the translatable literals are identified and matched with the translation data exported from TM in the previous step. The result will be a set of *.po files (one for each external procedure - *.w and *.p files, or one for each class file). These files will be converted to resource bundles and deployed with the converted legacy application.

Proceed as follows:

1. Add the following parameters in <project_root>/cfg/p2j.cfg.xml: i18n-enable, tm-translations, text-expansion.

Example:

       <parameter name="i18n-enable"      value="true" />
       <parameter name="tm-translations"  value="./translations_fr.csv,./translations_de.csv,./translations_cs.csv" />
       <parameter name="text-expansion"   value="100" />

The parameter tm-translations holds the translation data exported from TM in the previous step.

text-expansion is the percentage value of how much the translatable literals will be expanded to accommodate longer length target languages. This value has the same meaning as the "Growth Table" percentage field in the TM "Compile" dialog (used for building translated procedures). You may omit this if you don't use text expansion.

2. Convert the application as usual.

3. After conversion the directory <project root>/translations will contain *.po files with all the translatable strings encountered in the converted sources and the matched translations.

4. Inspect the conversion log. Look for the messages "Failed to resolve TM translation for", these indicate a match in the exported TM data was not found for a translatable literal in the legacy sources.

5. Translate all the unmatched literals by editing the corresponding *.po files.

6. Generate resource bundles. Execute <project_root>/p2j/tools/i18n/gen-bundles.sh. This will generate Java resource bundles from the *.po files and output them in <project root>/build/classes.

7. Execute ant jar to pack the resource bundles in the project jar file.

8. Execute ant deploy.prepare to deploy the project jar.

Running the Converted Application

With all the resource bundles deployed in the previous step, it is time to fire them up. There are two ways to let the runtime know what the effective target language should be. The 4GL code can assign the CURRENT-LANGUAGE session attribute or by adding the configuration parameter currentLanguage in directory.xml. The runtime inspects the following directory paths when searching for currentLanguage: /server/<serverID>/runtime/<account_or_group>/<id>, /server/<serverID>/runtime/default/<id>, /server/default/runtime/<account_or_group>/<id>, /server/default/runtime/default/<id>.

The values assigned to CURRENT-LANGUAGE or currentLanguage directory parameter are those originally used in the legacy application and as such exported in the translation data from Translation Manager.

If you assigned text-expansion in p2j.cfg.xml before conversion, also assign the same value in text-expansion directory attribute. Put it in one of the locations stated above for currentLanguage.

Converting an Untranslated 4GL Project

To convert a 4GL application that has no existing translations, perform the following steps:

  • configure and convert the legacy application
  • translate the texts identified during conversion
  • deploy the translated data and run the legacy application

Configuring and Converting the Legacy Application

During conversion the translatable literals are identified and output in a set of *.po files (one for each external procedure - *.w and *.p files, or one for each class file). These files will be converted to resource bundles and deployed with the converted legacy application.

Proceed as follows:

  • Add the following parameters in <project_root>/p2j/cfg/p2j.cfg.xml: i18n-enable, text-expansion.
    Example:
           <parameter name="i18n-enable"      value="true" />
           <parameter name="text-expansion"   value="100" />
    

text-expansion is the percentage value of how much the translatable literals will be expanded to accommodate more talkative target languages. This value has the same meaning as the "Growth Table" percentage field in the TM "Compile" dialog (used for building translated procedures). You may omit this if you don't use text expansion.

  • Convert the application as usual.

Translating the Texts Identified During Conversion

After conversion the directory <project root>/translations will contain *.po files with all the translatable strings encountered in the converted sources. There will be one *.po file per external procedure. Create n sets of the *.po files (where n is the number of target languages) by copying the original *.po files. The naming of the resulting translated *.po files is important. The name of the file must include the target language name. It is in the form <procedure_base_file_name>_<target_language>.po. For example, if you end up with the .po file myprocedure.po after conversion, you will need to create two copies in the same dir myprocedure_Czech.po and myprocedure_German.po if your target languages are Czech and German. Note that Czech and German will also be the values your application will assign to CURRENT-LANGUAGE and currentLanguage directory parameter when setting the effective target language.

Translate the texts in the *.po copies made above.

Deploying the Translations and Running the Converted Application

  • Generate resource bundles. Execute <project_root>/p2j/tools/i18n/gen-bundles.sh. This will generate Java resource bundles from the *.po files in <project_root>/translations and output them in <project root>/build/classes.
  • Execute ant jar to pack the resource bundles in the project jar file.
  • Execute ant deploy.prepare to deploy the project jar.
  • Follow the section Running the Converted Application.