0

我在我的项目中安装了 django-rosetta。我创建了一个 .po 和 .mo 文件。模板我有一个代码,显示已经在 django-rosetta 中翻译的文本(来自 django docs)。如何创建指向每个翻译页面的链接?

{% get_current_language as LANGUAGE_CODE %}
    <!-- Current language: {{ LANGUAGE_CODE }} -->
    <p>{% trans "Welcome to our page" %}</p>
    <p>{{ LANGUAGE_CODE }}</p>

    {% language 'pl' %}
        {% get_current_language as LANGUAGE_CODE %}
        <p>{% trans "Some text to translate" %}</p>
    {% endlanguage %}

    {% language 'en' %}
        {% get_current_language as LANGUAGE_CODE %}
        <p>{% trans "Some text to translate" %}</p>
    {% endlanguage %}

    {% language 'ru' %}
        {% get_current_language as LANGUAGE_CODE %}
        <p>{% trans "Some text to translate" %}</p>
    {% endlanguage %}
4

0 回答 0