1. Internationalization
Main urls.py example:
1.2. Language Cookie
By default if someone visits a page at django determines the language as follow:
- language in url
- language in cookie
- language in from browser
- LANGUAGE_CODE from settings
No if i have a German browser and visit a page that is only English and French, it will choose the language that is in LANGUAGE_CODE. If this is English but i only speak French i have to switch the language. No if after sometime i visit the page again. The page will display in English again and I have to switch again. The same is for every link that points to / will switch to English again. To fix this behavior the cms ships with a middleware:
add this to you middleware settings fix this.
The language_chooser
template tag will display a language chooser for the current page. You can modify the template in menu/language_chooser.html
or provide your own template if necessary.
Example:
1.4. page_language_url
Example:
If you add a default directive to your with a hide_unstranslated
to False
all pages will be displayed in all languages even if they are not translated yet.
If hide_untranslated is in your and you are on a page that doesn’t yet have an English translation and you view the German version then the language chooser will redirect to /
. The same goes for urls that are not handled by the cms and display a language chooser.