In Oracle HTML DB you can develop applications that can run concurrently in different languages. A single Oracle database instance and Oracle HTML DB can support multiple database sessions customized to support different language.
In general, translating an Oracle HTML DB application involves the following steps:
Map primary and target application IDs
Seed and export text to a file for translation
Translate the text in the file
Apply and publish the translated file
Topics:
After you create an application, you specify a language preference on the Edit Application Attributes page. Under Globalization, you select a primary application language and select how the HTML DB engine determines the application language. You can specify to have the application language based on the user's browser language preference, an application preference, or an item preference.
When using translated applications in Oracle HTML DB, use the following rules to determine which translated version to use:
Look for an exact match between the user language preference and the language code of the translated application
Look for a truncated match. That is, see if the language and locale exist. For example, if the user language preference is en-us
and the translated version of en-us
does not exist, look for a translated application that has the language code en
Use the primary application
For example, suppose you create an application with the primary language of German, de
, and you create a translated version of the application with a language code of en-us
. Users accessing this application with a browser language of en-us
execute the English en-us
version of the application. Users accessing the application with a browser language of en-gb
view the application in the application primary language. In this example, these users see the application in German, which is the application's primary language. For this example, you should create the translated English version using language code en
to encompass all variations of en
.
Once Oracle HTML DB determines the language for an application, the HTML DB engine alters the database language for a specific page request. It then looks for a translated application in the appropriate language. If the HTML DB engine finds that language, it render the application using that definition. Otherwise, it renders the application in the base (or primary) application language.
Note that the text that displays within an application is not translated on the fly. Oracle HTML DB dynamically collects page attributes from either a base language application definition or an alternative application definition.
When you build an application in Oracle HTML DB, you define a large number of declarative attributes such as field labels, region headings, page header text, and so on. Using the steps described in this section, you can make all the application definition attributes within your application translatable.
Oracle HTML DB includes two shortcuts type that enable you to reference translatable messages:
Message - Use this shortcut to reference a translatable message at run time. Note that the name of the shortcut must match the corresponding message name. At run time, the name of the shortcut expands to the text of the translatable message for the current language.
Message with JavaScript Escaped Single Quotes - Use this shortcut to reference a shortcut inside of JavaScript literal string and reference a translatable message at run time. This shortcut defines a text string. When the shortcut is referenced, it escapes the single quotation marks required for JavaScript.
If your application includes PL/SQL regions or PL/SQL processes, you may need to translate any generated HTML or text. Within Oracle HTML DB these types of generated HTML and text are called "messages." You can define all messages and translate them on the Translatable Messages page. You can use the HTMLDB_LANG
.MESSAGE
API to translate text strings from PL/SQL stored procedures, functions, triggers, packaged procedures and functions.
Dynamic translations are used for database data that needs to be translated at run time. For example, you might use a dynamic translation to translate a list of values based on a database query. A dynamic translation consists of a "translate-from" language string, a language code, and a "translate-to" string. You can also use the HTMLDB_LANG.LANG
API to retrieve dynamic translations programmatically.
By default, page region titles are included in the generated translation file. However, you can mark a region title as not translatable.
To mark a region title as not translatable:
Navigate to the Page Definition:
Navigate to the Workspace home page.
Click the Application Builder icon.
Select an application.
Select a page.
The Page Definition appears.
On the Page Definition, select the region title.
The Edit Region page appears.
Select the exclude title from translation check box.
By default, templates in Oracle HTML DB are not translatable and therefore not included in the generated translation file. Generally, templates do not and should not contain translatable text. However, if you need to mark a template as translatable, mark the Translatable check box on the Edit Page Template page.
To identify a template as translatable:
Navigate to the Workspace home page.
Click the Application Builder icon.
Select an application.
On the Application home page, click Shared Components.
Under User Interface, select Templates.
The Templates page appears.
Locate the template you want to edit and select the template name.
Under Template Identification, select Translatable.
You can include translatable text at the application level by defining the translatable text using static substitution strings. Because application-level attributes are translated any text defined as a static substitution strings will be included in the generated translation file.