Hamakor / pycon-israel

updates to Symposion for PyCon Israel
1 stars 5 forks source link

Set locale according to prefix in language-prefixed pages #1

Closed shaib closed 6 years ago

shaib commented 6 years ago

We have pages with language prefix, like /en/code-of-conduct/ and /he/code-of-conduct/ but if a user enters one of them with the wrong language chosen (through session or browser preferences) then they may get a mixed page -- Hebrew content in a LTR page with english menu and sidebar, or vice versa.

If the URL has a language prefix, we need to make sure the indicated language is active.

See https://docs.djangoproject.com/en/2.0/topics/http/middleware/ for Django Middleware, the right component for handling this See https://docs.djangoproject.com/en/2.0/ref/middleware/#module-django.middleware.locale for the Django built-in language-selecting middleware

Thanks @AmitAronovitch for noticing

AmitAronovitch commented 6 years ago

done with @shaib