mark
mark

Reputation: 673

How to change language on the template in django-rosetta

I installed django-rosetta in my project. I created a .po and .mo files. The template I have a code that shows the text already translated in the django-rosetta (from django docs). How to create a link that will direct to each of the translated pages?

{% 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 %}

Upvotes: 0

Views: 632

Answers (0)

Related Questions