Client-side language switcher
This script is hosted here - download it and use it locally to your site.
Notes
- Create a language_switch link like so:
<a href="/xx/" class="lang_switch switchto_xx">link text</a> - where 'xx' is your language code.
- There's an array in the code that holds a list of the approved language codes for your switcher
- You can specify the root for your site in the path_root variable - many websites at CERN have a /sitename/ format, for example
- Give your non-javascript users a standard link to the language root (the href)
- Assumes English is the primary language, all other languages reside in a directory with the ISO 2-character code for the language
- Check that sub-directories don't use the ISO language codes as titles
- This isn't a very 'smart' system: if there is no page at the redirect location you'll get a 404 - so be very careful to keep the directory structure for each language identical.
- You could drop a cookie to remember the user's language choice but not recommended as is problematic if you hit a 404 in a given language and you want to switch the URL manually.