I want to make a language dependent UI Action Message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2022 01:55 PM
Hello!
I have this UI Action message:
gs.addInfoMessage(gs.getMessage('have_been_deleted'));
I want to make it language dependent. For example, if I change the language to GER, then the UI Action supposed to show the german version of that message above, after it runs.
Thank you,
Csaba
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2022 01:58 PM
Hello,
You can achieve this using gs.getMessage()
please replace gs.addInfoMessage with gs.getMessage() and try.
gs.getMessage()
You probably are familiar with gs.getMessage() and maybe gs.getMessageS() <-- No this is not a typo. This method is well documented. If the specified message exists in the UI Messages table [sys_ui_message] for the current language, the method returns the translated message. If the specified message does not exist for the current language, the method returns the English version of the message. In most cases, this will be sufficient.
Please dont forget accept the solution if this helps you
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2022 03:05 AM
You've certainly written your code correctly, which is the big part (this is a concept we call "externalised code", meaning the message is understood by the platform as translatable). As pointed out by another poster, you now need to add your various translations into the [sys_ui_message] table with that key "have_been_deleted", then when a user changes their language preference the system will display the appropriate language's message when they view it.
For more information, if you'd like to learn more about how Localization works in the platform, we have a full training course available here, and we have a dedicated forum on Community where I post on my blog every few weeks on various more advanced topics available here,
Many thanks,
Kind regards
Director of Globalization Deployment, Internationalization