[SOLVED] Escape quotes in django's trans method

Table of Contents

Issue

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

Solution

Use blocktrans instead.

Example
{% blocktranslate %}Just an example block to translate with {{value}} and text.{% endblocktranslate %}

Answered By – Ignacio Vazquez-Abrams

Answer Checked By – Timothy Miller (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *