Opened 17 months ago

Closed 17 months ago

Last modified 17 months ago

#22262 closed Cleanup/optimization (fixed)

Error in Translation Comments Documentation for Templates

Reported by: av@… Owned by: dekomote
Component: Documentation Version: master
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 Changed 17 months ago by bmispelon

  • Easy pickings set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Version changed from 1.6 to master

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.

comment:2 Changed 17 months ago by dekomote

  • Has patch set
  • Owner changed from nobody to dekomote
  • Status changed from new to assigned

comment:3 Changed 17 months ago by Baptiste Mispelon <bmispelon@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In 958b511a80c01ac010561c8fefe4548203700fa3:

Fixed #22262 -- Added the correct line in the last example of Translator lines

comment:4 Changed 17 months ago by Baptiste Mispelon <bmispelon@…>

In b86ff4ee82b1dddea7179d72ee3368cb8962cbc6:

[1.5.x] Fixed #22262 -- Added the correct line in the last example of Translator lines

Backport of 958b511a80c01ac010561c8fefe4548203700fa3 from master.

comment:5 Changed 17 months ago by Baptiste Mispelon <bmispelon@…>

In 141bb90b4c66cca1c4bfafe2a0e5c5777c55c61c:

[1.6.x] Fixed #22262 -- Added the correct line in the last example of Translator lines

Backport of 958b511a80c01ac010561c8fefe4548203700fa3 from master.

Note: See TracTickets for help on using tickets.
Back to Top