Search This Blog

Tuesday, July 8, 2025

Globalization

Introduction
Using globalization in Oracle APEX allows developers to create applications that support multiple languages, regional formats, and cultural preferences. This feature enables your application to adapt dynamically based on the user’s language, number format, date format, and currency settings. Whether you're building an app for a local team or a global audience, APEX provides the tools to deliver a personalized, localized experience without duplicating logic or layouts.

 Globalization in Oracle APEX enables your application to support multiple languages, regional formats, and culturally specific settings like dates, numbers, and currencies. This ensures that users from different parts of the world can interact with the application in a way that feels natural and intuitive to them. Globalization is built into the Oracle APEX platform, making it possible to translate labels, messages, and content, as well as adapt formats dynamically based on user preferences or browser settings.

To begin using globalization, go to your APEX application and navigate to Shared Components > Globalization Attributes. Here, you can configure several key settings:

  • Primary Language: This is the default language of your application (e.g., en for English).

  • Application Language Derived From: Choose how the language is determined. Common options include:

    • User Preference: Stored in session state or retrieved from user profile

    • Browser Language: Automatically uses the browser’s default language

    • Application Item or Substitution String: You can set it dynamically with logic

You should also define the Application Language Item (e.g., P0_LANGUAGE), which can be used to let the user manually select a language. For this, create a language selector (e.g., a drop-down on the login or home page) that sets the P0_LANGUAGE item and triggers a redirect or page reload.

Next, enable Text Messages under Shared Components > Text Messages. This feature lets you define translatable content in key-value pairs. For example:

  • Name: GREETING

  • Language: en

  • Text: Welcome

Then for Spanish:

  • Name: GREETING

  • Language: es

  • Text: Bienvenido

You can reference this message anywhere in your app using the syntax:

#GREETING#

Oracle APEX will automatically display the correct version based on the current language setting.

For page and region-level translations, go to Shared Components > Language > Translate Application. Create a new language (e.g., es for Spanish), then export the XLIFF file. This file contains all translatable strings from your app (labels, button text, headings, etc.). Translate the content in the XLIFF file and re-import it to apply the translated strings. You can repeat this process for each additional language you want to support.

APEX also handles locale-specific formatting for numbers, dates, and currencies automatically. This is controlled by the Application Primary Language and the NLS settings in your Oracle database session. If needed, you can override these settings using initialization code in a Before Header process or in the Globalization Attributes section.

Example for setting NLS preferences dynamically:

BEGIN
  EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_FORMAT = ''DD-MM-YYYY''';
  EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_NUMERIC_CHARACTERS = '',.''';
END;

To provide the best user experience, always test your application with different language settings, especially for layouts, currency formats, and message displays. Also, remember that some layouts may shift depending on the length or orientation of translated strings.

Globalization in Oracle APEX lets you build one application that feels local to users around the world. With careful planning, use of text messages, translations, and NLS formatting, your application can dynamically adapt to any audience without needing multiple versions of the same app. This makes your development process more efficient and your users more satisfied.

 How to Implement Globalization in Oracle APEX

Globalization in Oracle APEX allows applications to support multiple languages, date formats, number formats, and cultural settings. This is essential for applications used in different regions, ensuring a smooth user experience regardless of the user's location and language preference.

This tutorial explains how to enable globalization, translate applications, and handle date and number formats in APEX.


Understanding Globalization in APEX

Oracle APEX provides built-in support for:

  • Application Translations – Translate application components into multiple languages.

  • Session-Based Language Switching – Change language based on user preferences.

  • Locale-Based Number and Date Formatting – Automatically adjust number and date formats based on the user’s region.

  • Multi-Language Data Storage – Store and retrieve data in multiple languages.


Steps to Implement Globalization in APEX

Step 1: Enable Globalization Settings

  1. Open Oracle APEX and navigate to your application.

  2. Go to Shared Components > Globalization Attributes.

  3. Configure the following settings: 

    • Primary Language – Choose the default language (e.g., English).

    • Automatic Time Zone – Enable automatic detection of the user’s time zone.

    • Automatic Language Detection – Allow the application to detect and apply the user's browser language.

    • Date and Number Format – Set default format masks (e.g., DD-MON-YYYY for dates).

  4. Click Apply Changes.


Step 2: Add Additional Languages

  1. Go to Shared Components > Translations.

  2. Click Create Language Mapping.

  3. Select the language you want to add (e.g., French, Spanish).

  4. Click Create to enable translation support for the new language.

Once a language is added, APEX will allow translation of application text and labels.


Step 3: Translate Application Components

  1. Go to Shared Components > Text Messages.

  2. Click Create to add a new translation key.

  3. Enter: 

    • Message Name – A unique identifier (e.g., WELCOME_TEXT).

    • Primary Language Text – Default text in the primary language.

    • Translated Text – The translated version.

  4. Save and repeat for other application messages.

For UI elements (buttons, labels, region titles):

  1. Go to Shared Components > Translation Repository.

  2. Export the XLIFF file, which contains all translatable application components.

  3. Translate the text in an external editor.

  4. Import the translated file back into APEX.


Step 4: Implement Language Switching

To allow users to switch languages dynamically:

  1. Create a Select List (LOV) with available languages.

  2. Populate the LOV using this SQL:

SELECT language_name, language_code FROM apex_application_translations;

  1. Create a Dynamic Action on the select list to update the session language:

BEGIN

    APEX_UTIL.SET_SESSION_LANG(:P_LANG);

END;

  1. Refresh the page to apply the language change.


Step 5: Manage Date and Number Formatting

APEX automatically adjusts date and number formats based on the user’s session language. However, you can override these settings manually:

  1. Go to Shared Components > Globalization Attributes.

  2. Set the desired date format mask (e.g., DD/MM/YYYY).

  3. Set decimal and thousand separators based on regional preferences.

To ensure proper formatting in SQL queries, use:

SELECT TO_CHAR(SYSDATE, 'DD-MON-YYYY', 'NLS_DATE_LANGUAGE=FRENCH') FROM dual;


Best Practices for Globalization in APEX

  • Use text messages instead of hardcoded strings to make translation easier.

  • Enable automatic language detection for a seamless user experience.

  • Test with different languages and regions to ensure consistency.

  • Use multi-language data storage to allow users to input text in various languages.

  • Apply proper format masks to ensure correct date and number display for each locale.


With these steps, you can successfully implement globalization in your APEX application, making it accessible to a worldwide audience.

Conclusion
Implementing globalization in Oracle APEX helps ensure your application is accessible, user-friendly, and relevant across different languages and regions. With built-in support for language translation, locale-sensitive formatting, and user-driven preferences, APEX gives you the flexibility to serve a global user base while maintaining a single, unified application structure.

 

No comments:

Post a Comment

How Do I Make a Faceted Search Map Page in Oracle APEX

Combining faceted search with a map region in Oracle APEX enables users to filter data visually and spatially at the same time. This design ...