How to properly add entries for computed values to the django internationalization messages file?

前端 未结 3 1736
不思量自难忘°
不思量自难忘° 2021-01-04 08:11

Django documentation states:

The caveat with using variables or computed values, as in the previous two examples, is that Django\'s translation-stri

3条回答
  •  旧时难觅i
    2021-01-04 08:29

    I ended up solving it with a similar solution suggested in @StFS answer.

    When I used pgettext('forecast type', 'some string'), then using {% trans varName %} in my template still returns "some string" instead of "New Text" for the translation.

    So I have changed the syntax in the function to gettext('some string').

    Now using {% trans varName %} would give "New Text" in my template.

提交回复
热议问题