14.6.2 Defining Text Messages for Errors
Define Text Messages for translatable errors your pages and PL/SQL can share.
To make user-visible error messages in your business logic translatable, create
shared component Text Messages for each one.
As shown below, each has a:
- Static ID (e.g.
TEAM_MEMBER_NOT_FOUND), - language code (e.g.
en), and - text that can include named
substitution tokens (e.g.
%name).
Figure 14-16 Shared Component Text Messages Define Translatable Error Messages
Your app pages and process messages access a string using this substitution syntax:
&{TEAM_MEMBER_NOT_FOUND}.In PL/SQL code, GET_MESSAGE in the APEX_LANG package gets a string by its static ID in the user's language. If the message includes named tokens, pass an APEX_T_VARCHAR2 string list with each token name followed by its string value.
l_message := apex_lang.get_message(
p_name => 'TEAM_MEMBER_NOT_FOUND',
p_params => apex_t_varchar2('name',l_team_member.name));Parent topic: Enforcing Business Logic in REST APIs
