[Fixed]-Django Translation in Overridden Form

1👍

This should work

_(u"Don't have account? <a href={URL}>Register</a>").format(URL=reverse('account_signup'))

Why .format works, actually I’ve searched for this before but I could not find a clear answer. My guess is:

  1. Some symbols can make the translation fails such as % and single quote.

  2. The translated string should use a placeholder which is satisfied in {} and %

  3. There are guidlines here http://edx.readthedocs.org/projects/edx-developer-guide/en/latest/internationalization/i18n.html that I usually follow.

Leave a comment