summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/releases/1.9.txt3
-rw-r--r--docs/topics/i18n/translation.txt20
2 files changed, 21 insertions, 2 deletions
diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt
index 9f2dd6ccd1..b80d14f985 100644
--- a/docs/releases/1.9.txt
+++ b/docs/releases/1.9.txt
@@ -332,6 +332,9 @@ Internationalization
project and it will find all the app message files that were created by
:djadmin:`makemessages`.
+* :ttag:`blocktrans` supports assigning its output to a variable using
+ ``asvar``.
+
Management Commands
^^^^^^^^^^^^^^^^^^^
diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt
index 1ab2dae273..e19ee1220b 100644
--- a/docs/topics/i18n/translation.txt
+++ b/docs/topics/i18n/translation.txt
@@ -580,8 +580,9 @@ use the following syntax::
<title>{{ the_title }}</title>
<meta name="description" content="{{ the_title }}">
-In practice you'll use this to get strings that are used in multiple places
-or should be used as arguments for other template tags or filters::
+In practice you'll use this to get a string you can use in multiple places in a
+template or so you can use the output as an argument for other template tags or
+filters::
{% trans "starting point" as start %}
{% trans "end point" as end %}
@@ -682,6 +683,21 @@ be retrieved (and stored) beforehand::
This is a URL: {{ the_url }}
{% endblocktrans %}
+If you'd like to retrieve a translated string without displaying it, you can
+use the following syntax::
+
+ {% blocktrans asvar the_title %}The title is {{ title }}.{% endblocktrans %}
+ <title>{{ the_title }}</title>
+ <meta name="description" content="{{ the_title }}">
+
+In practice you'll use this to get a string you can use in multiple places in a
+template or so you can use the output as an argument for other template tags or
+filters.
+
+.. versionchanged:: 1.9
+
+ The ``asvar`` syntax was added.
+
``{% blocktrans %}`` also supports :ref:`contextual
markers<contextual-markers>` using the ``context`` keyword: