Django 1.95 template i18n not working
<p>I am trying to translate the string from English to zh-hans</p>

<p>In the <code>settings.py</code></p>

<pre><code>LANGUAGE_CODE = 'zh-hans'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True
</code></pre>

<p>I have run the <code>python manage.py makemessages -l zh-hans</code> and  <code>python manage.py makemessages -a</code> for many times.</p>

<p>The .po file is simple as following:</p>

<pre><code>msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-07 09:53+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME &lt;EMAIL@ADDRESS&gt;\n"
"Language-Team: LANGUAGE &lt;LL@li.org&gt;\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: blog/views.py:18
msgid "author"
msgstr "ä½è"
</code></pre>

<p>In the html file:</p>

<pre><code>        &lt;div id = "info"&gt;
            &lt;p&gt;
                {% trans "author" %} : {{ blog.author }}
            &lt;/p&gt;
        &lt;/div&gt;
</code></pre>

<p>The tag returns "author" instead of Chinese characters.
Also I have tried ugettext in <code>view.py</code></p>

<pre><code>def detail(request, slug):
    blog = get_object_or_404(Post, slug=slug)
    msg = _("author")
    print(msg)
    context = {
        'blog': blog,
        'author': msg,
    }
    return render(request, 'blog/detail.html', context)
</code></pre>

<p>The msg is still "author".</p>

<p>Using </p>

<pre><code> {% get_current_language as LANGUAGE_CODE %}
 {{ LANGUAGE_CODE }}
</code></pre>

<p>The language code is zh-hans.</p>

<p>So what's going wrong here? How to show the translated string in the template? Thank you </p>

<p>It's a very silly mistake.</p>

<p>Although in the <code>setting.py</code> the Chinese language code can be set as 'zh-hans', to implement the i18n, it should be makemessages -l zh_hans instead of zh-hans.</p>

python django internationalization