Oracle® HTML DB
Release 2.0
  Go To Table Of Contents
Contents

Previous
Previous
Next
Next
 

Translating Data that Supports List of Values

You create a dynamic translation to translate dynamic pieces of data. For example, you might use a dynamic translation on a list of values based on a database query.

Dynamic translations differ from messages in that you query a specific string rather then a message name. You define dynamic translations on the Dynamic Translations page. You then use the HTMLDB_LANG.LANG API to return the dynamic translation string identified by the parameter p_primary_text_string.

Defining a Dynamic Translation

You define dynamic translations on the Dynamic Translations page. A dynamic translation consists of a "translate-from" language string, a language code, and a "translate-to" string.

To define a dynamic translation:

  1. Navigate to the Translate Application page. See "Step 1: Navigate to the Translate Application Page".

  2. On the Translate Application page, select Optionally identify any data that needs to be dynamically translated to support SQL based lists of values.

  3. On the Dynamic Translations page, click Create and specify the following:

    1. In Language, select a target language

    2. In Translate From Text, type the source text to be translated

    3. In Translate To, type the translated text

  4. Click Create.

HTMLDB_LANG.LANG API

Syntax

HTMLDB_LANG.LANG (
    p_primary_text_string    IN    VARCHAR2 DEFAULT NULL,
    p0                       IN    VARCHAR2 DEFAULT NULL,
    p1                       IN    VARCHAR2 DEFAULT NULL,
    p2                       IN    VARCHAR2 DEFAULT NULL,
    ...
    p9                       IN    VARCHAR2 DEFAULT NULL,
    p_primary_language       IN    VARCHAR2 DEFAULT NULL)
    RETURN VARCHAR2;

Parameters

Table 15-3 describes the parameters available in the HTMLDB_LANG.LANG.

Table 15-3 HTMLDB_LANG.LANG Parameters

Parameter Description

p_primary_string

Text string of the primary language. This will be the value of the Translate From Text in the dynamic translation.

p0

...

p9

Dynamic substitution value. p0 corresponds to 0% in the in the translation string. p1 corresponds to 1% in the in the translation string. p2 corresponds to 2% in the in the translation string and so on.

p_primary_language

Language code for the message to be retrieved. If not specified, Oracle HTML DB uses the current language for the user as defined in the Application Language Derived From attribute.

See Also: "Specifying the Primary Language for an Application"


Example

Suppose you have a table that defines all primary colors. You could define a dynamic message for each color and then apply the LANG function to the defined values in a query. For example:

SELECT HTMLDB_LANG.LANG(color)
  FROM my_colors

For example, suppose you were running the application in German andRED was a value for the color column in my_colors table. If you defined the German word for red, the previous example would return ROT.