#22262 closed Cleanup/optimization (fixed)
Error in Translation Comments Documentation for Templates
Reported by: | Owned by: | Dejan Noveski | |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | templates, trans tags |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
I think the final example below (at the very bottom of this ticket) is missing some text. Instead of : "#. Translators:", it should be "# Translators: This is a text of the base template #".
Thanks!
Comments for translators in templates
Just like with Python code, these notes for translators can be specified using comments, either with the comment tag:
{% comment %}Translators: View verb{% endcomment %}
{% trans "View" %}
{% comment %}Translators: Short intro blurb{% endcomment %}
<p>{% blocktrans %}A multiline translatable
literal.{% endblocktrans %}</p>
or with the {# ... #} one-line comment constructs:
{# Translators: Label of a button that triggers search #}
<button type="submit">{% trans "Go" %}</button>
{# Translators: This is a text of the base template #}
{% blocktrans %}Ambiguous translatable block of text{% endblocktrans %}
Note
Just for completeness, these are the corresponding fragments of the resulting .po file:
#. Translators: View verb
# path/to/template/file.html:10
msgid "View"
msgstr ""
#. Translators: Short intro blurb
# path/to/template/file.html:13
msgid ""
"A multiline translatable"
"literal."
msgstr ""
# ...
#. Translators: Label of a button that triggers search
# path/to/template/file.html:100
msgid "Go"
msgstr ""
#. Translators:
# path/to/template/file.html:103
msgid "Ambiguous translatable block of text"
msgstr ""
Change History (5)
comment:1 by , 11 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Version: | 1.6 → master |
comment:2 by , 11 years ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Pull request https://github.com/django/django/pull/2429
comment:3 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Hi,
Good catch, the actual comment does appear to be missing for the last example at https://docs.djangoproject.com/en/dev/topics/i18n/translation/#comments-for-translators-in-templates.
For anyone who'd like to contribute a fix, the file to edit is
docs/topics/i18n/translation.txt
.Thanks.