- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2023 05:47 AM
We are displaying field messages using showFieldMessage in catalog client script. But if the user preferred language is different we should display the translated version. How to achieve this requirement?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 05:29 AM - edited 11-03-2023 05:32 AM
Hi @rajaganeshs
You can try the following approach.
1. Add translations for your text in sys_ui_message.
2. In your client script try the following code.
g_form.showFieldMessage("VARIABLE_NAME", getMessage("My example message from client script"), "info");
Please mark my answer helpful and accept as solution if it helped 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 03:53 AM
Hi,
Use below code in client script
getMessage("Test Message", function(msg){
g_form.addInfoMessage(msg);
});
Navigate to System UI -> messages
Create a new entry with Key = "Test Message" //Key used in client script
Select the language
Enter the translated value in Message field and save the record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 06:28 AM
@Shruti Thanks for the answer.
The solution you provided is for formMessage. But it's good to know this approach for future use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 05:29 AM - edited 11-03-2023 05:32 AM
Hi @rajaganeshs
You can try the following approach.
1. Add translations for your text in sys_ui_message.
2. In your client script try the following code.
g_form.showFieldMessage("VARIABLE_NAME", getMessage("My example message from client script"), "info");
Please mark my answer helpful and accept as solution if it helped 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 06:29 AM