问题
I'm trying to override the default translations of Django's admin site.
I'm using Django 1.6. My settings.py
contains:
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# ...
LANGUAGE_CODE = 'nl'
USE_I18N = True
USE_L10N = True
LOCALE_PATHS = (os.path.join(BASE_DIR, "locale"),)
I have copied the file django/contrib/admin/locale/nl/LC_MESSAGES/django.po
to my_project/locale/nl/LC_MESSAGES/django.po
and I've made some changes to it.
Next, I have run python manage.py compilemessages
and python manage.py runserver
.
When I visit localhost:8000/admin
, however, I'm still seeing Django's default admin translations. What am I doing wrong?
Edit - I found the problem:
The above description is the correct way to override app translations. I followed my own instructions and they work. The reason for my problem was that I accidentally omitted the nl
subdirectory the first time. I am a dumb person.
来源:https://stackoverflow.com/questions/20873972/how-to-override-the-django-admin-translation