Why i can't make keys to see in the front?

I made two blocks, an HTML and a RAW.

When i add html code in the back with a key:

<button id="generateIdeas"></button>

<script>

document.getElementById("generateIdeas").innerText =

'__bm_ai_generate_business_ideas__';

</script>

The code disseaper by saving.

I tried everything, and Chatgpt say that is not normal, why it's not possible to add html and keys???

What i do wrong?

And yes, i added in Polyglot a key, bm_ai_generate_business_ideas and also __bm_ai_generate_business_ideas__ i tried.

I still see this:image_transcoder.php?o=sys_images_editor&h=3021&dpx=1&t=1772900309

  • 12
  • More
Attachments
Replies (1)
    • Hello @Busimatch !

      The usual pages in UNA should call the constructions like

      $this->_oTemplate->addJsTranslation(array('_sys_grid_search'));
      

      for calling of the translations in the dynamic JavaScript code. So it's impossible to use it for the custom pages and blocks. But you may use the following solution.

      Create 2 blocks: 1 with the lang type (for the text) and 1 as the RAW (for the script). For the lang block you need to choose the "Content" variant for the Block Layout* parameter. And in the RAW block you may use the JQuery selectors like in the next example

      <script>
      	alert(_t($(".bx-page-lang-container").text()));
      </script>
      

      to take the proper key value. The .bx-page-lang-container CSS class may be hidden on the page or you may remove it with JS code too.

      Login or Join to comment.