- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2023 09:38 AM
Hi all,
I have a unique situation where I'm attempting to translate our Service Portal UI for a non-OOB language, so I have to set up all translations myself. I have been successful for the most part, however there are a few pieces of the portal that use ng-templates to load the HTML, and those ng-templates aren't always visible to us as admins so ServiceNow can protect their core code. I used i18n debugging to verify the translations I'm trying to load are UI Messages, but the issue is that unless I see the HTML itself, it can be very tedious to figure out the correct formatting for dynamic messages (for example, timestamps like "36 m ago" or "2 hours from now"). Does anyone have recommendations for the best way to figure out what the UI Message key values should be in these cases besides trial and error?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2023 05:16 PM
What I do is to install a 3rd language and look up and figure out the keys with its help.
That is because - as far as I can tell - template are not localized as widgets are.
While widget Body HTML templates are processed server side, so ${ } tokens can be replaces, a template could be loaded/added using various methods of which none is processed server side, so it would be tough to replace ${ } tokens.
Most of the time what happens is that in the Server script of widgets messages are stored translated on data and the template just uses the translated (or not) message arriving from server side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2023 05:16 PM
What I do is to install a 3rd language and look up and figure out the keys with its help.
That is because - as far as I can tell - template are not localized as widgets are.
While widget Body HTML templates are processed server side, so ${ } tokens can be replaces, a template could be loaded/added using various methods of which none is processed server side, so it would be tough to replace ${ } tokens.
Most of the time what happens is that in the Server script of widgets messages are stored translated on data and the template just uses the translated (or not) message arriving from server side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2023 05:17 PM
What I tried to say there is that - as far as I can tell - no template will contain message keys.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2023 05:20 PM
Got it - so essentially ServiceNow's design pattern is the following.
Let's say we have a text "Welcome to ServiceNow" in UI.
The server script would have a line like below
c.data.welcome_message = gs.getMessage("Welcome to ServiceNow");
And the HTML script would have the following line
<span>{{c.data.welcome_message}}</span>
So as a result, in order to get the key I'd need to get the message from the server side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2023 05:21 PM
Exactly.