Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable default translation values in Django?

Some Tags give me translated Words without setting up the *.po file.

{% trans "groups" %}
{% trans "users" %}

Unfortunately they won't be overridden when creating the *.po file and running:

django-admin.py compilemessages

So how do I get rid of the default translations ? I would prefer a solution on project level, because I don't want to modify Django core files.

like image 910
JasonTS Avatar asked Dec 29 '25 01:12

JasonTS


1 Answers

There are several ways to override it

  • set your locale path in LOCALE_PATHS in settings file, this gives your translations higher priority.
  • change the msgid to be different from those used by Django. Then provide translations for languages which will be used. The msgid could be anything plus base string as long as its unique and translator-friendly, for example a namespace prefix: {% trans "my:groups" %}
  • Contextual markers for Django1.3+ , then it looks like {% trans "groups" context "my" %}
like image 186
okm Avatar answered Dec 31 '25 14:12

okm



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!