Translated HTML won't show up in widget

Miriam Berg
Mega Guru

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