I have a django 1.6 site with i18n working. I can change the frontend language with a select box in the top of the template, but I don't know if there is a django app or trick to change the admin language, because it seems to store somewhere in session variable, and it keeps the first language I have used in the frontend.
To change the admin site header text, login page, and the HTML title tag of our bookstore's instead, add the following code in urls.py . The site_header changes the Django administration text which appears on the login page and the admin site. The site_title changes the text added to the <title> of every admin page.
To do so, you will have to change the project's settings.py . Find the TEMPLATES section and modify accordingly. To override the default template you first need to access the template you want to modify from the django/contrib/admin/templates/admin directory.
To login to the site, open the /admin URL (e.g. http://127.0.0.1:8000/admin ) and enter your new superuser userid and password credentials (you'll be redirected to the login page, and then back to the /admin URL after you've entered your details).
In your settings.py just add 'django.middleware.locale.LocaleMiddleware'
to your MIDDLEWARE_CLASSES
setting, making sure it appears after 'django.contrib.sessions.middleware.SessionMiddleware'
.
You can create /en/admin
, /fr/admin/
and so on using i18n_patterns
:
urlpatterns += i18n_patterns(
url(r'^admin/', include(admin.site.urls)),
)
(For Django <= 1.7, you must specify a prefix, use i18n_patterns('', ... )
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With