- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2017 02:06 AM
Hi,
Looking at the OOB Widget "HTML", I can see in the Options Schema that the HTML field is added as a translated HTML field - but switching language and trying to add a translation changes the original version of the HTML instead of adding a translation. It's not showing any translation.
Options Schema:
[{
"name": "html",
"label": "HTML",
"type": "translated_html",
"default_value": " <b>hello</b>"
}]
Creating a new translated HTML field is letting me translate the HTML but when I cloned the HTML widget and changed the references to match the new field - again, the translation won't show up. My question is: how do i show the translated contents of an HTML field? The google searches i've done suggest that this should "just work"... but it doesn't.
New widget HTML:
<div>
<div ng-if="!c.options.u_html" class="panel panel-default">
<div class="panel-body">
<b>${HTML Widget}</b><br>
${Ctrl + Click > Options to set HTML content}
</div>
</div>
<div ng-if="c.options.u_html" ng-bind-html="c.u_html"></div>
</div>
New widget Client controller:
function ($scope, $sce) {
var c = this;
c.u_html = $sce.trustAsHtml(c.options.u_html);
$scope.$watch('c.options.u_html',function(){
c.u_html = $sce.trustAsHtml(c.options.u_html);
})
}
Thanks in advance for suggestions/ideas/solutions!
BR /Miriam
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2017 12:50 AM
Hi Anita,
A simpler way to translate the HTML would be to user ServiceNow's built-in message functionality.
In many places in ServiceNow you show a translated message by using dollar curly brackets ${ your text here }. So instead of trying to translate text in the HTML option (which doesn't work because it is stored in a JSON field) you wrap your text in dollar curly brackets, and translate it through System Localization > Messages.
For example, if you have a very simple HTML code today, that you entered in your "HTML" widget instance:
<p>Welcome</p>
<p>Add your comment</p>
You would translate it by using the same widget instance and just change the code to:
<p>${Welcome}</p>
<p>${Add your comment}</p>
And then make sure there are translations in System Localization > Messages for each separate message:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2018 09:01 AM
Hi ,
Could you please inform me where to find the local message in system localization :
Ex message in fr : bla bla bla I do'nt arrive to reach it in the Back end
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2018 10:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2018 11:29 PM
Hi Miriam,
I have some issue with displaying unauthorized message on portal if some user is accessing the catalog for which he is not group authorized.
I have written code on server side and its working fine if I am commenting below code on client controller:
$scope.data.sc_cat_item.description = $sce.trustAsHtml($scope.data.sc_cat_item.description);
I would appreciate if you could please explain what the above code line is doing and what will be the impact if I comment this?
Thanks in advance!!
Regards,
Danish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2018 11:44 AM
Hello,
I had the issue, that the translated texts did not show up in the widgets.
I was able to solve this issue by clearing the cache (with "cache.do"), before reviewing the widget in the browser.
Just type "cache.do" and hit return, in the backend "filter navigator" to clear the cache and retry to review the widget.
That helped each time for me, to check, if the translations worked correctly.
Let me know, if this works for you too, please.
I tried this with KINGSTON PATCH 9.
Regards
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2019 11:02 PM
Thanks Dirk, your solution worked for me 🙂
Best Regard,
Indira Priya Darsini M.