Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

apex.lang.getMessage Fails in IG JavaScript Init Code, But Works in Console

Mohammed Mudassir23 hours ago — edited 22 hours ago

I'm experiencing a localization issue with the JavaScript Initialization Code of an Interactive Grid. My goal is to show translated alert() messages from a custom toolbar button.

My Setup:

  • APEX Version: [24.2.9]

  • I have an Interactive Grid with a custom toolbar button ("Accept").

  • I have created Text Messages in Shared Components (e.g., JS_SELECT_ONE_ROW) and provided translations for English (en), Italian (it).

  • The application language is changed by a select list (P18_LANGUAGE) that submits the page on change, setting the APPLANGUAGE session state.

  • The IG's JavaScript Initialization Code defines the button's action, which calls apex.message.alert(apex.lang.getMessage("JS_SELECT_ONE_ROW"));.

  • The Problem: When I load the page in English, the alert shows the English text (correct). When I switch the language to Italian (which submits and reloads the page), the alert still shows the English text (incorrect).

  • The Critical Clue: After the page has finished loading in Italian, if I open the browser's developer console and manually type: apex.lang.getMessage("JS_SELECT_ONE_ROW"); ...it correctly returns the Italian translation.

  • Conclusion: This proves that my Text Messages, translations, and page reload are all working correctly. The translations are being loaded onto the page.

    What I Have Already Tried (and failed):

  1. Using Hidden Page Items: I created a "Before Header" PL/SQL process to run APEX_LANG.MESSAGE and populate hidden items (P35_MSG_SELECT_ROW). I then changed the JavaScript to read from these items (apex.item("P35_MSG_SELECT_ROW").getValue()). This still showed the English text, suggesting this process also ran before the language was fully set for the session.
Comments
Post Details
Added 23 hours ago
0 comments
22 views