On Sat, May 31, 2014 at 7:50 AM, Андрей Меньков
<[email protected]> wrote:
>
> I thing the problem is in function django.utils.translation.templatize. It's
> implementation could be found in django.utils.translation.trans_real module.
>
> From docstring for it:
>
> Turns a Django template into something that is understood by xgettext. It
>     does so by translating the Django translation tags into standard gettext
>     function invocations.
>
> Function calling results:
>>> templatize(" {{ _('kfhdsajfkh') }} ")
>>> ('kfhdsajfkh')
>
>>> templatize(""" {{ _(''' abcdefg
>                             hhjkfhsdajfk
>                             fsdauyuirywer
>                        ''') }}
>
>               """)
>>>  XX XXXXX XXXXXXX
>                          XXXXXXXXXXXX
>                          XXXXXXXXXXXXX
>                      XXXX XX
>
>
> So it can be seen that templatize function marks multiline strings as not
> needed to translate.

As Russ says, it's not clear to me if the _() template construct you
are using is from Django i18n or from Jinja.

Django template tags (including trans) aren't multi-line. There is a
ongoing discussion about this.

If you use the Django blocktrans template tag, multi-line literals are
perfectly suported by templatize():

In [1]: from django.utils.translation import templatize

In [2]: templatize("""{% blocktrans %}foo
bar
baz
{% endblocktrans %}""")
Out[2]: " gettext(u'foo\\nbar\\nbaz\\n') SSS\nSSS\nSSS\n"

In [3]:

-- 
Ramiro Morales
@ramiromorales

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO7PdF8%3DrNwR%3DOxAGs7TVv8NXA6c8Q%3DA5kD71eOb2mY8mWixCA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to