1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #5849 -- Strip whitespace from blocktrans

Add the trimmed option to the blocktrans tag to trim any newlines and
whitespace from its content.

This allows the developer to indent the blocktrans tag without adding
new lines and whitespace to the msgid in the PO file.

Thanks to mpessas for the initial patch and Dmitri Fedortchenko for the
report.
This commit is contained in:
Bouke Haarsma
2013-11-02 20:01:17 +01:00
committed by Anssi Kääriäinen
parent 30203a0dea
commit 7a7c789d5a
8 changed files with 104 additions and 10 deletions

View File

@@ -342,6 +342,15 @@ Internationalization
still read from in 1.7. Sessions will be migrated to the new ``_language``
key as they are written.
* The :ttag:`blocktrans` now supports a ``trimmed`` option. This
option will remove newline characters from the beginning and the end of the
content of the ``{% blocktrans %}`` tag, replace any whitespace at the
beginning and end of a line and merge all lines into one using a space
character to separate them. This is quite useful for indenting the content of
a ``{% blocktrans %}`` tag without having the indentation characters end up
in the corresponding entry in the PO file, which makes the translation
process easier.
Management Commands
^^^^^^^^^^^^^^^^^^^