[thelist] Multiple-language sites

Magnus Østergaard magnus at slackware.adsl.dk
Sat Mar 2 18:04:01 CST 2002


Katie Kearns wrote:
>
> I'm just beginning to plan a multiple-language site

These are some of the things I did on a 2 lang. site. It should scale
well I think.

> 1) One person on my team suggested reading the language from the browser --
> does this work often enough? Are there browser incompatibility issues, or
> is it unlikely that users have configured this option?

The Apache webserver will do this for you pr. default.
(http://httpd.apache.org)
To see this in action visit http://www.debian.org (change your default
language in your browser for most effect).

How this all works can be read here:
http://httpd.apache.org/docs/content-negotiation.html

Also very nice for should I serve .png or .gifs to the user. Very handy
when you change server language. Say from .html to .shtml or .php. Read;
"Cool URIs don't change" at http://www.w3.org/Provider/Style/URI.html

If you do this kind of auto language detection setup, remember to make
it possible for the user to overrule. The Way I've done this is to make
each language a subdomain.

www.example.com = browser 'guess'

en.example.com = english
fr.example.com = french

This is very important, just because the browser or ip says your are
from country xyz, does not mean the user speaks that language. Also make
sure the user can jump to the other languages from any page. Not
everyone will come via the front(splash)page.

Best of all, no JavaScript or cookies needed.

> 2) Should I make separate physical pages for each language (and have the
> nightmare of maintaining the links between all the languages) or find a way
> to have each page know all 10 languages and just display the one that the
> user wants at a time (would this take too long to load or be difficult to
> maintain?).

I think this is the easiest, else your files becomes very large to read,
and you only need ~10% so you are waisting CPU time.

> 3) Any tips for how/where to put a language selector into the interface?

I think this is a good model: http://europa.eu.int/index_ns_en.htm

Though I use a name.language.php convention, the file name being all in
English followed by the language name.

I would recommend naming all URL's in English, sure it might piss off
some people, but it makes scripting easier, plus some languages looks
ugly in URL's IMHO.

I used index.en.php index.fr.php and so on. This makes it very easy to
link to the ofter languages in header and footer. All I have to do is
cut the URL from the back, and make a switch. You can make this look for
the file, and if it is missing, it means the text has not been
translated.

I choose to have all language file in the same dir, and not separate
each in catalogs. Again, so I could eays see missing translations. (Hay,
that will almost always happen, that the files are out of sync)

> anything extravagant (and I don't have any control over the server -- just
> the ability to upload HTML pages. I'm not even sure if I can upload more
> than that.)

Arrgh, I'd say you must have control, else it won't be possible to do.


Hope this helps

--
Magnus Østergaard

"Passenger index.html, please contact gate 80"



More information about the thelist mailing list