How to disable default translation values in Django?
Some tags give me word translation without setting up the * .po file.
{% trans "groups" %}
{% trans "users" %}
Unfortunately, they will not be overridden when the * .po file is created and run:
django-admin.py compilemessages
So how do I get rid of the default translations? I would prefer a project level solution because I don't want to change the main Django files.
+3
source to share
2 answers
There are several ways to override it
- set your language path to LOCALE_PATHS in the preferences file, this will give your translations a higher priority.
- Modify the file which is different from the one Django is using. Then specify the translations for the languages to be used. Msgid can be anything plus the base string as long as it is unique and translatable, such as a namespace prefix:
{% trans "my:groups" %}
- Context markers for Django1.3 + , then it looks like
{% trans "groups" context "my" %}
+5
source to share