Steps for application internationalization

Follow these steps to internationalize your application.

  1. Identify the current character set used in your sources and make sure the application locale (LANG/LC_ALL) is set correctly.
  2. In .4gl sources, add a % prefix to the strings that must be localized (translated). For parameterized messages, replace concatenated strings by a SFMT() usage with %n placeholders for variable message parts.
  3. In .per sources LAYOUT section, replace hard-coded form elements like text labels with static LABEL form items and define the TEXT attributes with a % prefix in the ATTRIBUTES section.
  4. In XML resources, add <LStr /> elements under the elements where text attributes must be localized.
  5. Extract the strings from the .4gl sources with fglcomp -m and use fglform -m for .per sources.
  6. Organize the generated .str source string files (identify duplicated strings and put them in a common file).
  7. At this point, the string identifiers (on the left) are the same as the string texts (on the right). These string identifiers can be used as is, or can be changed to clear ASCII identifiers such as "customer.list.title". Using simple identifiers allows you to distinguish strings depending on the context and use ASCII encoding for your sources. Keeping string identifiers with the original text requires no source changes (except adding the % prefix), but makes sources dependent to a locale: If you want to support multiple languages, you must use UTF-8 in sources and at runtime.
  8. When using simple ASCII identifiers, replace original strings with the new string identifiers. Strings to be replaced can be located by their % prefix. You can, for example, use a script with an utility like the sed UNIX™ command to read the .str files and apply the changes automatically.
  9. Recompile the .4gl and .per sources (when using simple ASCII strings identifiers, sources are expected to be full ASCII now).
  10. Compile the .str files in the locale used by these files,
  11. Setup FGLPROFILE fglrun.localization.* entries, to let fglrun find the string resource files.
  12. Run your programs to check whether the application displays the text properly.
  13. Copy the existing .str files, and translate the string text into another language (make sure the locale is correct).
  14. Compile the new .str files, and copy the .42s files into another distribution directory, defined with the FGLRESOURCEPATH environment variable.
  15. Run your programs again, to check that texts and labels of the other language are displayed.
  16. Next changes to the .per and .4gl source files are done in the ASCII locale, and .str string files must be edited with their specific locale.