39.10 MESSAGE Function
Use this function to translate text strings (or messages) generated from PL/SQL stored procedures, functions, triggers, packaged procedures, and functions.
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;
Parameters
Parameter | Description |
---|---|
p_name |
Name of the message as defined in Text Messages under Shared Components of your application in Oracle APEX. |
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, APEX uses the current language for the user as defined in the See also Specifying the Primary Language for an Application in Oracle APEX App Builder User’s Guide. |
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 APEX such as packages called from a database job. |
Example
The following example assumes you have defined a message called GREETING_MSG
in your application in English as Good morning %0
and in German as Guten Tag %1
. The following example demonstrates how to invoke this message from PL/SQL:
BEGIN
--
-- Print the greeting
--
HTP.P(APEX_LANG.MESSAGE('GREETING_MSG', V('APP_USER')));
END;
How the p_lang
attribute is defined depends on how the APEX engine derives the Application Primary Language. For example, if you are running the application in German and the previous call is made to the APEX_LANG.MESSAGE
API, the APEX engine first looks for a message called GREETING_MSG
with a LANG_CODE
of de
. If it does not find anything, then it is reverted to the Application Primary Language
attribute. If it still does not find anything, the APEX engine looks for a message by this name with a language code of en
.
Parent topic: APEX_LANG