Answer the question
In order to leave comments, you need to log in
How to force the desired language in Django 1.8?
Translated the site into Dutch.
I set everything in the settings:
USE_I18N = True
LANGUAGE_CODE = 'nl'
LANGUAGES = (
('en', 'English'),
('nl', 'Holland'),
)
LOCALE_PATHS = (
location('locale'),
)
class ForceDefaultLanguageMiddleware(object):
def process_request(self, request):
if request.META.has_key('HTTP_ACCEPT_LANGUAGE'):
del request.META['HTTP_ACCEPT_LANGUAGE']
Django determines the user's language like this (if not found, then goes further):
Looks for the django_language key in the user's session Looks in
cookies Looks
for Accept-Language in HTTP headers, and tries to find languages allowed in the application (in the LANGUAGES variable)
Uses the value of the LANGUAGE_CODE variable
Answer the question
In order to leave comments, you need to log in
Everything turned out to be much easier. It was necessary to just leave one language:
LANGUAGES = (
('nl', 'Holland'),
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question