In an APEX 24.2 app, I have a language selector on the Global Page. When a user switches languages, a Dynamic Action runs that sets the new language as the user’s preference, changes the session language with apex_util.set_session_lang(:P0_LANG);
, and then reloads the page (I tried both a submit and location.reload
).
Next, I want all messages shown to the user to appear in the selected language. For that, I created some Text Messages in Shared Components.
From PL/SQL processes, everything works as expected: the user sees messages in Spanish, switches to English, and from that point on, everything appears in English. Perfect.
The problem arises when I display messages from JavaScript or Dynamic Actions. The sequence is:
- The default language is Spanish.
- The user clicks a button that only runs JavaScript, showing a message with
apex.message
and apex.lang.getMessage
. The message correctly appears in Spanish.
- The user changes the language to English.
- The user clicks the same button again, but the message still appears in Spanish.
- The user presses F5 to reload the page.
- The user clicks the button again, and now the message appears in English.
I can’t figure out what’s causing this behavior. Can someone help me resolve it?