The django 1.4 doc says that you can translate strings to "vars" to be used in different places, or used as arguments in tags or template filters using the following syntax:
{% trans "String" as my_translated_string %}
<h1>{{ my_translated_string }}</h1>
https://docs.djangoproject.com/en/1.4/topics/i18n/translation/#trans-template-tag
I do it this way, however a particular var never passes content. Below is my template code:
{% extends "default_layout.html" %}
{% load i18n %}
{% trans "My page title" as title %}
{% block meta_title %}{{ title }}{% endblock %}
{% block content %}
<h1>{{ title }}</h1>
{% endblock %}
Of course, the βnameβ in both cases becomes empty.
Did I miss something?
Thank.
tufla source
share