[ale] Can I identify the country of origin?

Matt Smith msmith at risklabs.com
Wed Sep 25 11:44:43 EDT 2002


If Jim's guess of what it his boss wants is right, isn't the user's
preference what's important?  I live in the US, but there are plenty of
people here who don't speak English.  Their preference for what language of
page to be displayed might be Spanish, or Italian, among tons of others.

The way apache does it built in is to simply append a suffix to the filename
requested based on a language-to-suffix mapping in the httpd.conf file.  You
just have separate files for each language you choose to support.  If you
don't want to provide a separate file for every chinese dialect, then just
map them all to the same file and let the user deal with it.

This isn't a programatical solution - it's just using the built in features.

>From my httpd.conf:

AddLanguage da .dk
AddLanguage nl .nl
AddLanguage en .en
AddLanguage et .ee
AddLanguage fr .fr
AddLanguage de .de
AddLanguage el .el


--Matt




-----Original Message-----
From: Jim [mailto:jcphil at mindspring.com]
To: ale at ale.org
Sent: Wednesday, September 25, 2002 11:29 AM
To: Matt Smith; 'jwl at sgi.com'; Ale
Subject: Re: [ale] Can I identify the country of origin?


On Wednesday 25 September 2002 11:05 am, Matt Smith wrote:
> If I'm not mistaken, Apache already has this functionality.  It's not
based
> on the IP's country of origin, but the language settings of the browser
> which are sent with the request.
>
> If you've ever noticed the default homepage(s) that come with Apache,
> there's one for basically many languages, and apache will auto-select the
> page and display it automatically.  I'd provide a good link, but I can't
> get to apache.org right now for some reason. :/
>
> I would go down that path before trying to roll your own.  (Assuming
you're
> using Apache, of course)
>
> If you're not using apache, you can analyze your server logs using
> webalizer and it does a rough estimation of country of origin - it even
> generates a pretty pie chart. :)
>
>
> --Matt

I am looking at my documentation for Apache now. There are three fields in
the 
header being sent by the browser that relate to locale:

Accept-Language
Accept-Encoding
Accept-Charset

This can get complicated fast, due to the messy way we use ASCII to render 
non-Roman characters. For Russian--which I use often--Apache uses no less 
than seven different encodings. Some of these may also render Ukrainian and 
Byelorussian. But if you peg everything on,say, the Accept-Language header, 
that only tells you the user's preference, not the country 
he lives in.


----- 
Confidential Information 

The information in this e-mail message (including any attachments) is
privileged and confidential information intended only for the use of the
individual or entity named above.  If the reader of this message is not the
intended recipient, you are hereby notified that any dissemination,
distribution, or copying of this communication is strictly prohibited.

---
This message has been sent through the ALE general discussion list.
See http://www.ale.org/mailing-lists.shtml for more info. Problems should be 
sent to listmaster at ale dot org.






More information about the Ale mailing list