How to translate strings in javascript written in script tags of html in django?
<p>Hi I am translating a website in hungarian, I have problems with alerts and confirm strings that i have in my templates. I am using <code>gettext('')</code> but these strings are not appearing in po files</p>

<p>my urls.py</p>

<pre><code>urlpatterns = patterns('',    
   url(r'^jsi18n/$', javascript_catalog, js_info_dict, name='javascript-catalog'),
</code></pre>

<p>I have created po file django.po by running makemessages it has all the strings marked as trans in templates and also strings from <code>*.py</code> files.
then
I have run following command </p>

<pre><code>django-admin.py makemessages -d djangojs -l hu_HU
</code></pre>

<p>its creating <code>djangojs.po</code>.</p>

<p>The strings appearing in this file are all from *.js files in my static folder.</p>

<p>But how do i have my strings used in alerts and confirms that are written in my templates.</p>

<p>here are snippets from my templates.</p>

<pre><code>&lt;script&gt;
    if($('#id_action').val()=='DEL'){
        if(confirm(gettext('Are you sure you want to delete selected author(s) ?'))){
           flag_action=true;
        }
    }
&lt;/script&gt;
</code></pre>

<p>In my template i also have something like this which is not appearing in po files either.</p>

<pre><code>&lt;li&gt;
   &lt;a onclick="if(confirm(gettext('Are you sure you want to delete the selected author?'))){filter_content({{auth.id}},'DEL');return false;}" href="javascript:void(0)"&gt;
      {% trans 'Delete' %}
   &lt;/a&gt;
&lt;/li&gt;
</code></pre>

<p>The string in gettext is not appearing in any po.</p>

<p>I have included the following in my templates</p>

<pre><code>&lt;script type="text/javascript" src="{% url 'javascript-catalog' %}"&gt;&lt;/script&gt;
</code></pre>

<blockquote>
  <p>Use this </p>
</blockquote>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var alert_var = {% blocktrans %}"Are you sure you want to delete selected author(s) ?" {% endblocktrans %};</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!-- begin snippet: js hide: false console: true babel: false --&gt;</code></pre>
</div>
</div>
</p>



<blockquote>
  <p>then use this variable where ever you need</p>
</blockquote>

javascript python django