Automatically choosing between different languages for your site
Create your different language files. I recommend naming them like this:
Just remember that HTML markup (i.e. <STRONG>) is always in English, but stuff like the text inside <IMG ALT=""> can be in your language.
Create a .htvl file (For example, Info.htvl) with contents like this:
URI: Info.en.html Content-type: text/html Content-language: en URI: Info.fr.html Content-type: text/html Content-language: en URI: Info.de.html Content-type: text/html Content-language: en URI: Info.es.html Content-type: text/html Content-language: en URI: Info.eo.html Content-type: text/html; charset=utf-8 Content-language: eo
NOTE: Language codes are defined in RFC 2068, section 3.10 (page 28 or so). Make sure that the code is correct. They will usually be either a two letter code or a two letter code, a dash, and a two letter country abbreviation if you are using different dialects.
Create a .htaccess file with this line and only this line in it. It must be uploaded to the directory you plan to put the other files. (If you work in Windows, you'll have to upload this file with a different name, and then rename it on mission.net.)
AddHandler type-map htvl
Upload to the server, and make sure your link is always to the .htvl file, and never to the individual file.
To test this out, check for this registry key in Windows 95 (and probably NT)versions of IE (I know this works in 4.0. For earlier versions, your mileage may vary.) and change it to the language code you'd like to test out.
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\International "AcceptLanguage"="en-us"
(Just for a side note, en-us means the us variant of English. Foreign language installations may say something completely different. "en-gb" is British English. And yes, you can use the "subdivision codes" in your htvl files, if you wish.)
I have a file at https://www.mission.net/new-york/utica/developers/lang/negotiation_test.var that tests this capability out. It has English and Esperanto variants.(Change AcceptLanguage to "eo; q=1.0, en; q=0.9" to try this. You should get a message saying you got the Esperanto version (in English, sorry).
And no, I don't know how Netscape sets the language to accept, so don't ask me.
Page Author: Curtis Jewell - Send Feedback|
Last Updated: Thu Sep 5 11:39:49 2002