On 26/06/12 18:48, Denny Vrandečić wrote:
Hi all,
we are trying to let users switch their language - whether they are logged in or not - through a language selector. This can be either the ULS, which is progressing impressively, or just a list of languages in the sidebar, or anything else. After selecting it, the page is rerendered using the uselang parameter.
Now the problem: the uselang parameter is not sticky. When I move to another page, it is lost.
We tried to change the linker in order to add the uselang parameter every time -- but it only works in the content, not in the sidebar and actionlinks.
We could put the language into a cookie, as the ULS currently does, but this means that the squid caches won't work, afaik.
You are going to fragment the caches whether you use a parameter or a cookie. IMHO the cookie option is a cleaner one (I think that would also allow to make a single purge).
We could take the output just before it is send to the browser and regex-substitute all the links in order to add the uselang parameter every... OK, half joking. Only half.
Some wikis have a javascript which does exactly that, adding a userlang parameter the moment you click a link. Much better than a string regex :)
Another solution could be to put the language into the path, i.e. the pretty URL /wiki/San_Franicisco does get rewritten to /w/index.php?title=San_Francisco as of now, but change that to /hr/San_Francisco rewritten to /w/index.php/San_Francisco?uselang=hr
(or /w/index.php/Special:UseLang/hr/San:Franciso with an Alias if this is more pleasing)
I like having the structure of languages-as-folders but you would need to send a purge to every language variation of a page...
I think this is based on an idea of Brion during the Hackathon.
So switching the user language amounts to change the URL.
Any comments on this?
Cheers, Denny