Storing Localized Metadata in Language Files

Topics:

If you want to centralize localized column titles, descriptions, and prompts, and apply them to multiple Master Files, you can create a set of translation files and use the TRANS_FILE attribute in a Master File to invoke them. You can set up the files totally manually, or you can use the LNGPREP utility to prepare the files for translation.

LNGPREP Utility: Preparing Metadata Language Files

Topics:

Reference:

The LNGPREP utility extracts TITLE, DESCRIPTION, CAPTION, and PROMPT attribute values from application Master Files into specially formatted language translation files for each language you need. Once you have the contents of these language files translated, your users can run these applications in the language they select.

LNGPREP does two things. It extracts attribute values from a Master File into language files, and it inserts or updates the TRANS_FILE attribute in the Master File with a value identifying the application folder where the language files reside and a prefix used for naming the set of language files. If the Master File is part of a cluster, LNGPREP will extract translatable strings from every Master File referenced in the cluster, and will update each with the same TRANS_FILE value.

LNGPREP requires an input file listing the three-character codes of the languages you need.

The name of each language file starts with the prefix specified in the TRANS_FILE value, followed by a three-character language code, and the extension .lng.

For example, assume the language input file contains the French and Spanish language codes:

fre
spa

If the Master File specifies:

trans_file = xlate/xl_

The language translation files would be in the xlate application folder, named:

  • xl_fre.lng for French.
  • xl_spa.lng for Spanish.

Reference: The Base Language File

Each Master File must have a single base language in which the DESCRIPTION, TITLE, CAPTION, and PROMPT attributes are specified. This language does not need to be English.

LNGPREP extracts these attribute values into the base language file, whose language code, for historical reasons, is eng. In this case, eng does not mean English. It means whatever language the Master File is written in.

The base language file (prefixeng.lng) should never be hand edited. All other lng files must be hand edited by translators, to translate the string values from the base language to the appropriate language.

Translating Applications into English

Since language code eng is reserved to mean base language, you cannot use it to contain English translations of an application whose base language is not English. In those cases, use any of the other English dialect language codes, such as AME, UKE, CAE, or AUE. For example, if the base language is German, specify AME in the languages file, run LNGPREP, and it will produce prefixeng.lng and prefixame.lng files, both in German. Translate the contents of prefixame.lng into English. Leave prefixeng.lng untouched.

Reference: How Translated Master File Attributes Display

Each language file contains a line for each attribute value from a related set of Master Files. Each attribute value has a unique index number assigned to it. For example, if the Master File contains FIELDNAME=PRODUCT_CATEGORY, TITLE='Product,Category', and that TITLE happens to be the 39th translatable attribute value, LNGPREP will produce lng files all containing the line:

39 = Product,Category

Your French translator will edit prefixfre.lng, leaving the index values unchanged while translating the string values, producing, in this case,

39 = Produit,Catégorie

At run time, when the TITLE for field PRODUCT_CATEGORY needs to be displayed, if WebFOCUS is configured for LANG=FRE, WebFOCUS looks up "Product,Category" in prefixeng.lng, finds index value 39, looks up 39 in prefixfre.lng, and displays the TITLE as "Produit,Catégorie."

LNGPREP Modes

How to:

Reference:

You can run LNGPREP from the Web Console using the Prepare Translation Files option, or you can run it using syntax. In either case, you must first create a configuration file containing the three-character language codes for each translation file you need, one language code on each line. The first invocation of LNGPREP for a given Master File adds the TRANS_FILE attribute in that and all related Master Files, creates the base language file by scanning the Master Files for supported attribute values, and creates a copy of the base language file with the correct name for each additional language. Then, a translator has to translate the values in each additional language file from the base language to the correct language for that file.

On each subsequent run, LNGPREP will check for updates to the list of related Master Files and attribute values and update the files as needed. Translators will then have to translate any attribute values added to the language files.

Reference: LNGPREP Best Practice

The recommended best practice is to create an app directory solely for the purpose of containing .lng files, and use this appname and a common prefix value for all LNGPREP commands. In addition, put the languages fn.cfg file in this app folder. This will create one set of .lng files for all apps, minimizing the time and effort spent on translation.

Procedure: How to Prepare Metadata Language Files Using the Web Console

  1. Right-click a synonym, point to Metadata Management, then click Prepare Translation Files, as shown in the following image.

    The Set Translation Files page opens, as shown in the following image.

  2. Enter the following values or accept the defaults.
    Application for Translation Files

    Is the name of the application where the language files will be stored. You can click the ellipsis to select an application from the current application path. By default, it is the application where the synonym resides.

    Prefix

    Is the prefix value for the translation files for the selected synonym.

    Languages File

    Is the file containing the list of language codes for which translation files should be prepared. The file must have the extension .cfg, be stored in an application directory on the application path, and have one language code on each line. You can click the ellipsis to select the application where the languages file is stored.

  3. Click OK.

    The language files are prepared using the application, prefix, and languages configuration file you specified. A status page will open listing the language files created and the Master Files processed.

Syntax: How to Run the LNGPREP Command Using Syntax

LNGPREP FILE n_part_name LNGAPP appname LNGPREFIX prefix
        LNGFILE appname/fn

where:

n_part_name

Specifies the n-part (app1/app2...) name of a Master File.

appname

Specifies the location where .lng files will be written and updated.

prefix

Specifies the literal characters that will precede the three-character language code in the names of the .lng files.

appname/fn

Specifies the appname and filename of a user-created .cfg file containing the list of three-character language codes, one per line. For example, the following file named langretail.cfg contains language codes for American English, French, and Japanese:

ame
fre
jpn
Example: Sample LNGPREP Command

Assume the lnglist.cfg file contains the language codes fre (French) and spa (Spanish):

fre
spa

Issue the following LNGPREP command:

LNGPREP FILE weather/forecast LNGAPP xlate LNGPREFIX tq_ LNGFILE  xlate/lnglist

Alternately, you can right-click the forecast synonym, point to Metadata Management, and select Prepare Translation Files. The Set Translation File for weather/forecast.mas page opens, as shown in the following image. Enter the values shown in the following image and click OK.

The following language files will be created:

  • xlate/tq_eng.lng
  • xlate/tq_fre.lng
  • xlate/tq_spa.lng

The Master File weather/forecast.mas will be updated with the following attribute:

TRANS_FILE= xlate/tq_

Translators then have to translate the values in xlate/tq_fre.lng and xlate/tq_spa.lng.

WebFOCUS

Feedback