# bocktranslate with varialbles in javascript

**URL:** <https://forum.djangoproject.com/t/bocktranslate-with-varialbles-in-javascript/15581>\
**Category:** Using Django\
**Created:** [August 24, 2022, 6:33am UTC](https://forum.djangoproject.com/t/bocktranslate-with-varialbles-in-javascript/15581 "2022-08-24T06:33:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Santtu1980](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/santtu1980/32/9813_2.png) [@Santtu1980](https://forum.djangoproject.com/u/Santtu1980)\
**Post date:** [August 24, 2022, 6:33am UTC](https://forum.djangoproject.com/t/bocktranslate-with-varialbles-in-javascript/15581/1 "2022-08-24T06:33:57Z")

</div>

Hi all. I’m newbie in this forum. Hopefully someone helps.

Translations works ok on template, but I need translate some strings with variables on jQuery-part. So I have:

```auto
let foo = "Hip hip hooray";
console.log(foo);
let text = "{% blocktranslate with this=foo %}Show me the {{ this }}!{% endblocktranslate %}";

```

Console prints “Hip hip hooray” so the variable works.  
makemessages creates msgid where the “{{ this }}” part is replaced with “%(this)s”. And on abowe row there is “python-format” text.

If I put quotes around the “foo” then the “this” part of the translation has been replaced by foo text. So the blocktranslate “with” works.

What I have to do to make variables work on javascript text parts?
