[geeklog-users] Automatic language

geeklog-users-admin at lists.geeklog.net geeklog-users-admin at lists.geeklog.net
Mon Sep 29 20:02:30 EDT 2003


Hallo - it's me again!

-----Original Message-----

>I would like to have my geeklog page automatically set to
>the language that is set up in the browser. How can I
>achieve this? Is there a plugin or something? Did someone
>write a language block? Sometimes it can be very bad to get
>the browser language - like if you are in Asia in an
>Internet Cafe - then it must be possible to change the
>language on the front page.

Now I did first tests to program it myself. But ... I see the difficulty in
the fact that geeklog uses real language names but Browsers use shortcuts.
Is there a translation table somewhere?
Besides that the lines:

$languages=preg_split ('/,/',getenv('HTTP_ACCEPT_LANGUAGE'));
$languages=preg_replace ('/;.*/','',$languages);

Should lead to success.
Then something that checks through the array until it finds an existing
language file. In case there is none - use the default language configured
in config.php. Where do I put this to become proper geeklog? So far I would
put it directly in config.php or is there a better place?
Because of the above described difficulties with being abroad I would not
suggest to use it as default without a language block. If I go to an English
site I still want it to be English - even I am in Asia.
However for me it is more useful to have it in the Browser language as
people's English might be good but finding the way to "user language" is not
too easy sometimes.

Regards
Daniel




More information about the geeklog-users mailing list