mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #10004 and #12320 -- Enabled the makemessages management command to collect comments for translators that start with the "Translators" keyword. Thanks for the report and patches, martinb and Claude Paroz.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14595 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -39,6 +39,22 @@ See the :doc:`reference documentation of the app </ref/contrib/staticfiles>`
|
||||
for more details or learn how to :doc:`manage static files
|
||||
</howto/static-files>`.
|
||||
|
||||
Translation comments
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If you would like to give translators hints about a translatable string, you
|
||||
can add a comment prefixed with the ``Translators`` keyword on the line
|
||||
preceding the string, e.g.::
|
||||
|
||||
def my_view(request):
|
||||
# Translators: This message appears on the home page only
|
||||
output = ugettext("Welcome to my site.")
|
||||
|
||||
The comment will appear in the resulting .po file and should also be
|
||||
displayed by most translation tools.
|
||||
|
||||
For more information, see :ref:`translator-comments`.
|
||||
|
||||
Backwards-incompatible changes in 1.3 alpha 2
|
||||
=============================================
|
||||
|
||||
|
||||
@@ -121,13 +121,17 @@ value, protect, or do nothing.
|
||||
For more information, see the :attr:`~django.db.models.ForeignKey.on_delete`
|
||||
documentation.
|
||||
|
||||
Contextual markers in translatable strings
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Contextual markers and comments for translatable strings
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
For translation strings with ambiguous meaning, you can now
|
||||
use the ``pgettext`` function to specify the context of the string.
|
||||
|
||||
For more information, see :ref:`contextual-markers`
|
||||
And if you just want to add some information for translators, you
|
||||
can also add special translator comments in the source.
|
||||
|
||||
For more information, see :ref:`contextual-markers` and
|
||||
:ref:`translator-comments`.
|
||||
|
||||
Everything else
|
||||
~~~~~~~~~~~~~~~
|
||||
|
||||
@@ -100,6 +100,30 @@ instead of positional interpolation (e.g., ``%s`` or ``%d``) whenever you
|
||||
have more than a single parameter. If you used positional interpolation,
|
||||
translations wouldn't be able to reorder placeholder text.
|
||||
|
||||
.. _translator-comments:
|
||||
|
||||
Comments for translators
|
||||
------------------------
|
||||
|
||||
.. versionadded:: 1.3
|
||||
|
||||
If you would like to give translators hints about a translatable string, you
|
||||
can add a comment prefixed with the ``Translators`` keyword on the line
|
||||
preceding the string, e.g.::
|
||||
|
||||
def my_view(request):
|
||||
# Translators: This message appears on the home page only
|
||||
output = ugettext("Welcome to my site.")
|
||||
|
||||
This also works in templates with the :ttag:`comment` tag:
|
||||
|
||||
.. code-block:: django+html
|
||||
|
||||
{% comment %}Translators: This is a text of the base template {% endcomment %}
|
||||
|
||||
The comment will then appear in the resulting .po file and should also be
|
||||
displayed by most translation tools.
|
||||
|
||||
Marking strings as no-op
|
||||
------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user