How to translate varables in curly braces ${}

For python varibles in html files, the varibles of jinjia format can be translated, such as {{ to_be_translated }} can be changed to {{ _(to_be_translated) }} if you want the contents in curly brackets to make the python variables be able to translate. But for js files, such as ${ to_be_translated } cannot be translated.

@jiangangwu for js use __(“Hello”)

Here I mean for variables not for strings.

@jiangangwu same thing __(variable)

It doesn’t work.

For example, I want to tranlate the block titles of workspace, such as “Your Shortcuts”, “Report & Masters”, and so on. I need the change the file:


In line No. 111,

tag.innerHTML = <span class="h${this._settings.default_size}"><b>${text}</b></span>;

I modify ${text} to ${__(text)}, and then bench migrate and bench build.

But it doesn’t work.

The reason is ${text} is javascript variable, the “” cannot read the string value in ${text}.