This namespace is used for text and message localization related functions of Oracle Application Express.
Functions
(static) addMessages(pMessages)
Add messages for use by apex.lang.getMessage and the format functions. Can be called multiple times. Additional messages are merged. It is generally not necessary to call this function, because it is automatically called with all the application text messages that have Used in JavaScript set to Yes.
Parameters:
Name | Type | Description |
---|---|---|
pMessages |
Object | An object whose properties are message keys, and the values are localized message text. |
Example
apex.lang.addMessages( {
APPLY_BUTTON_LABEL: "Apply"
} );
(static) clearMessages()
Remove all messages. This method is rarely needed. Many Oracle Application Express components rely on client-side messages, so if you clear the messages you need to add any needed messages again.
Example
apex.lang.clearMessages();
(static) format(pPattern, …pValues) → {string}
Formats a message. Same as apex.lang.formatMessage except the message pattern is given directly. It is already localized or isn't supposed to be. It is not a key. The replacement arguments are HTML escaped.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pPattern |
string | The message pattern. | |
pValues |
* |
<repeatable> |
Any number of replacement values, one for each message parameter %0 to %9. Non string arguments are converted to strings. |
Returns:
- Type
- string
Example
apex.lang.format( "Total cost: $%0", orderTotal );
(static) formatMessage(pKey, …pValues) → {string}
Format a message. Parameters in the message, %0 to %9, are replaced with the corresponding function argument. Use %% to include a single %. The replacement arguments are HTML escaped.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pKey |
string | The message key. The key is used to lookup the localized message text as if with getMessage. | |
pValues |
* |
<repeatable> |
Any number of replacement values, one for each message parameter %0 to %9. Non string arguments are converted to strings. |
Returns:
- Type
- string
Example
apex.lang.formatMessage( "PROCESS_STATUS", progress );
(static) formatMessageNoEscape(pKey, …pValues) → {string}
Same as apex.lang.formatMessage except the replacement arguments are not HTML escaped. They must be known to be safe or will be used in a context that is safe.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pKey |
string | The message key. The key is used to lookup the localized message text as if with getMessage. | |
pValues |
* |
<repeatable> |
Any number of replacement values, one for each message parameter %0 to %9. Non string arguments are converted to strings. |
Returns:
- Type
- string
Example
apex.lang.formatMessageNoEscape( "CONFIRM", inputValue );
(static) formatNoEscape(pPattern, …pValues) → {string}
Same as apex.lang.format, except the replacement arguments are not HTML escaped. They must be known to be safe or are used in a context that is safe.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
pPattern |
string | The message pattern. | |
pValues |
* |
<repeatable> |
Any number of replacement values, one for each message parameter %0 to %9. Non string arguments are converted to strings. |
Returns:
- Type
- string
Example
apex.lang.formatNoEscape( "You entered %0", inputValue );
(static) getMessage(pKey) → {string}
Return the message associated with the given key. The key is looked up in the messages added with apex.lang.addMessages.
Parameters:
Name | Type | Description |
---|---|---|
pKey |
string | The message key. |
Returns:
- Type
- string
Example
apex.lang.getMessage( "OK_BTN_LABEL" );
(static) hasMessage(pKey) → {boolean}
Return true if pKey exists in the messages added with apex.lang.addMessages.
Parameters:
Name | Type | Description |
---|---|---|
pKey |
string | The message key. |
Returns:
- Type
- boolean
Example
if ( apex.lang.hasMessage( "EXTRA_MESSAGE" ) ) {
text += apex.lang.getMessage( "EXTRA_MESSAGE" );
}