Reputation: 536
In Django / Wagtail I can set the language of a single page. With my custom instance method {{ page.get_language }}
this language is available in the template.
But I want all dates and hard-coded texts translated in the set language. So I would like to to set LANGUAGE_CODE
with page.get_language
.
Any ideas what the best practice is?
Upvotes: 0
Views: 141
Reputation: 623
<html class="no-js" lang="{{ page.get_language }}">
and in your template {% load i18n %}
Upvotes: 1
Reputation: 25292
The django.utils.translation.activate
function selects the language to be used by Django's translation framework, in preference to the default one in LANGUAGE_CODE
- so, in this case you would use activate(page.get_language)
.
Upvotes: 0