Using the Strings Table for Language-Sensitive Text in Reports

The PeopleTools Strings table (STRINGS_TBL) stores text strings used for language-sensitive labels and other text for PS/nVision and SQR reports. This avoids hard-coding labels into the report files themselves. The use of strings rather than hard-coded text in reports enables translators to translate the report layout in the database without editing the report’s code itself. This enables you to run a single copy of a report in multiple languages while avoiding the duplication of code and report logic.

The Strings table stores string text of three different string types:

  • A short field description (RFT Short).

  • A long field description (RFT Long). Only strings of this type can have translated values.

  • A free-form text string (Text).

The Strings table is keyed by PROGRAM_ID plus the STRING_ID, which enables you to classify strings into groups that are used in similar reports. PROGRAM_ID can refer to a specific SQR or PS/nVision report name, or it can be a mnemonic for a group of common strings that are shared between reports. For RFT Short or RFT Long, the STRING_ID is the field name (validated against the PSDBFIELD or PSDBFIELDLANG table).

For example, PS/nVision string variables include the string ID and the program ID as follows:

%.StringID,ProgramID%

The following example shows the Use Display view for the STRINGS_TBL record definition in Application Designer with PROGRAM_ID and STRING_ID identified as the key fields:

Image: STRINGS_TBL record definition

This example illustrates the fields and controls on the STRINGS_TBL record definition.

STRINGS_TBL record definition

If the language of the requested report is a non-base language and only if the requested string is a long field description type, the system returns the translated string from the related-language table (STRINGS_LNG_TBL) if a translation is available. If no translation exists, the base language string is returned.

The return of language-sensitive string data follows this sequence as shown in the following diagram:

  1. The system locates a string definition in the base language Strings table by using the program ID and string ID.

    The text string stored in the base language Strings table can be a short or long field description or a free-form text string that is not associated with a field.

  2. The system determines the string type: short, long, or text.

  3. If the string type is short or text, the system returns the string text directly from the base language Strings table.

  4. The system determines the language of the report request.

    Note: If the value is unspecified, the system uses the user’s current language preference setting.

  5. If the language is the system’s base language, the system returns the string value from the base language Strings table.

  6. If the language of the report is a non-base language, the system looks in the related-language table (STRINGS_LNG_TBL) for a row with the program ID, string ID, and correct language code.

  7. If an appropriate row exists in the related-language table, the system returns the translation.

  8. If no translation exists in the related-language table, the system returns the string from the base language table.

Image: Return of language-sensitive string data

This diagram illustrates the return of language sensitive string data

Return of language-sensitive string data