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
.
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:
Navigate to the Translate Application page. See "Step 1: Navigate to the Translate Application Page".
On the Translate Application page, select Optionally identify any data that needs to be dynamically translated to support SQL based lists of values.
On the Dynamic Translations page, click Create and specify the following:
In Language, select a target language
In Translate From Text, type the source text to be translated
In Translate To, type the translated text
Click Create.
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 |
---|---|
|
Text string of the primary language. This will be the value of the Translate From Text in the dynamic translation. |
...
|
Dynamic substitution value. |
|
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
.