Oracle by Example brandingOracle Application Express 18: Translating an App (1 of 2) - Defining Translatable Text Messages

section 0Before You Begin

This 15-minute tutorial shows how you to create text messages (both in English and German) in the pre-built Create App Wizard application, which uses English as the primary language.

This is the first tutorial in Oracle Application Express 18: Translating an App Series. Read the tutorials in sequence:

Background

You translate messages when your application includes PL/SQL regions, processes, package, procedure or function. You may need to translate messages if your application:

  • Includes PL/SQL regions or PL/SQL processes, or calls a PL/SQL package, procedure, or function. If it does, you may need to translate the generated HTML.
  • Uses a language that is not one of the ten languages into which Oracle Application Express is translated. If it does, you may need to translate messages used in reports.

What Do You Need?

Accessing Your Development Environment

How you sign in and access Oracle Application Express depends upon where Oracle Application Express resides. Oracle Application Express may reside in a local on-premises Oracle Database or in a hosted environment, such as the Oracle Cloud. The sign in credentials you use to sign in differ depending upon the installation type.

  • Free Workspace: Give Oracle Application Express a test run by signing up for a free workspace. To request an evaluation workspace, go to apex.oracle.com, and click Get Started for Free.
  • Oracle Cloud: Develop and deploy applications without worrying about infrastructure, repair, and downtime. Oracle Application Express is available in Exadata Express Cloud Service and Database Cloud Service. However, you need to manually customize your databases to install and enable Oracle Application Express. To learn more, see Oracle Database Cloud Service.
  • Oracle Application Express On-premises: Install Oracle Application Express directly within any Oracle Database and then sign in to your workspace using your sign in credentials. For details on your sign in credentials, contact your administrator or see Oracle Application Express Installation Guide.
  • Oracle Application Express Pre-Built VM: Install a Pre-Built Virtual Machine (VM) which includes an Oracle Database and Oracle Application Express 18.1. To learn more, see Hands-On Labs.
    Once the VM is installed, start the VM:
    • Click the big red circle labeled Start.
    • Click the APEX shortcut, or enter the following URL: http://localhost:8080/ords/f?p=4550:1
    • When prompted to sign in, enter the sign in credentials (unless given other credentials to use):
      • Workspace: obe
      • Username: obe
      • Password: oracle

section 1Create Messages Used in PL/SQL

Text Messages can be used to build translatable text strings with variables that can be called from PL/SQL packages, procedures, and functions. If your application includes PL/SQL regions or PL/SQL processes or calls PL/SQL packages, procedures, or functions, you need to translate generated HTML as explained below:

  • Define each message on the Translatable Messages page.
  • Use the APEX_LANG.MESSAGE API to translate the messages from PL/SQL stored procedures, functions, triggers, or packaged procedures and functions.
  • Create translatable messages on the Translate Messages page.

To create messages used in PL/SQL, perform the following steps:

  1. Sign in to Oracle Application Express by entering the credentials (workspace, username, and password).
  2. In the Workspace homepage, click App Builder and open your Create App Wizard application.
  3. To define a message called Greeting_Message in your application in English and in German and invoke this message from PL/SQL in the Home page, you create a region called Translation Region. To create the Translation Region:
    • From the application, click 1 - Home.
    • home_page.png
      Description of the illustration home_page.png
    • In the Rendering tab, right-click Create App Wizard under the Breadcrumb Bar, and select Create Region.
    • create_region.png
      Description of the illustration create_region.png
    • In the Property Editor, update the following:
      • Identification: Title - Enter Hello! (here you are creating the translation Region)
      • Identification: Type - Select PL/SQL Dynamic Content
      • Source: PL/SQL Code - Enter the below given code:
      •  begin
        htp.p(apex_lang.message('GREETING_MESSAGE', V('APP_USER')));
        end;
      • Click Save.
  4. translation_region.png
    Description of the illustration translation_region.png
  5. You create translatable messages on the Translate Messages page. To define a new translation message:

section 2Specify the Primary Language - English

Globalization attributes specify how the Application Express engine determines the primary language of an application. Perform the following steps to view your application by specifying the primary language.

  1. Click the Shared Components breadcrumb.
  2. Under Globalization, click Globalization Attributes.
  3. global_attribute.png
    Description of the illustration global_attribute.png
  4. In the Globalization page, check the following:
    • Application Primary Language: Select English (United States) (en-us)
    • Application Language Derived From: Select Application Primary Language
    • Click Apply Changes.
  5. edit_global_attr.png
    Description of the illustration edit_global_attr.png
  6. Click Run Application. Enter your workspace credentials, and click Sign-in.
  7. create_app_wiz_en.png
    Description of the illustration create_app_wiz_en.png
    Notice that the application appears in English with the message text that you created in the previous section.

next stepNext Tutorial

Oracle Application Express 18: Translating an App (2 of 2) - Translating Messages and Specifying Primary language


more informationWant to Learn More?