|
Posted by Rik on 05/22/06 01:48
Pugi! wrote:
> How do you make a multilingual website ?
> I once made one for a small non profit organisation (english-dutch)
> and used simple if-statement : if cookie or link specifies english
> then show english text else show dutch text. The texts were stored in
> the page itself (when small) or in include files or database when
> larger.
>
> There are other alternatives that would also work with more languages
> without having to change the code:
> twodimensional array for short text (labels, links, ...), include
> files, xml, database.
>
> What's a good approach?
Hmm, I don't know what the best approach would be, I'd be tempted to indeed
use $text[key_of_text][language]. Offcourse, when using a database only,
this isn't necessary as your query offcourse would only select the desired
language. What I wouldn't do is mixing them up as you indicate, choose a
method (others probably can tell you more about which one), and stick to it.
It will really save you a lot of time later on.
Not a great help there, actually I'm just posting to point you to
$_SERVER['HTTP_ACCEPT_LANGUAGE']. As long as users have set their browsers
correctly, an you use this value, they will see the site in their desired
language if existing. Only when they have misconfigured their browsers or
their browsers don't support this you can give the option to use
links/cookies/etc. You could even expand this in a script to display a
certain text in the second (third, fourth...) language of choice if a
translation in their firest (second etc..) choice doesn't exist. For
example, my choices in this matter: en,nl;q=0.9,de;q=0.8, meaning I prefer
english, then dutch, then german.
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|