Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Escape quotes in django's trans method

I'm trying to internationalize my webpages by using the {% trans "string" %} method in django.

However I get an error when I try to use quotes in the string. I've already tried to escape them with a backslash with no luck.

How can I escape something like this:

{% trans "foo's is like "foo"." %}

As I said, this doesn't work:

{% trans "foo\'s is like \"foo\"." %}

Any idea?

Thanks

like image 719
Andrea Avatar asked Dec 07 '10 07:12

Andrea


1 Answers

Use blocktrans instead.

Example
{% blocktranslate %}Just an example block to translate with {{value}} and text.{% endblocktranslate %}
like image 67
Ignacio Vazquez-Abrams Avatar answered Nov 15 '22 03:11

Ignacio Vazquez-Abrams