1. Overview

This document talks about how to use the APEX_LANG.MESSAGE API & also teach how can we define a message for each desired language.

2. Technologies and Tools Used

The following technology has been used to achieve Custom requirements.

  • Oracle Apex

3. Use Case

Assume that there is a requirement to translate the messages or string returned from PL/SQL stored procedures, functions, triggers, packaged procedures, and functions.

4. Architecture 

Following steps explains in detail,

 Syntax:

APEX_LANG.MESSAGE (

p_name            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_lang            IN VARCHAR2 DEFAULT NULL,

p_application_id  IN NUMBER   DEFAULT NULL)

RETURN VARCHAR2;

Parameter & Description

p_name                 : Name of the message as defined in Text Messages under Shared Components of your application in Oracle Application Express.

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

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

p_application_id : Used to specify the application ID within the current workspace that owns the translated message you wish to return. Useful when coding packages that might be called outside of the scope of Oracle Application Express such as packages called from a database job.

Step 1:

Define Message Shared Componants > Globalization > Text Messages

Text-messages

Define-messages

Step 2:

How to use APEX_LANG.MESSAGE ?

1.Plain String

Select apex_lang.message(p_name=>’TEXT_MESSAGE’) from dual;

2.Specific language

Select apex_lang.message(p_name=>’TEXT_MESSAGE’, p_lang=>’hi’) from dual;

3.With Substitution

Select apex_lang.message(‘MESSAGE_WITH_SUBSTITUTION’, V(‘APP_USER’)) from dual;

4.Test in Command Prompt

Select apex_lang.message(‘MESSAGE_WITH_SUBSTITUTION’,’Ashish ‘, p_application_id =>128 ) from dual;

Here Application id is 128 where i have created the Messages.

Recent Posts

Start typing and press Enter to search