Training, Open Source computer languages

PerlPHPPythonMySQLhttpd / TomcatTclRubyJavaC and C++LinuxCSS

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Finding the language preference of a web site visitor
I can (and do) identify the country of origin of over 98% of the visitors to our web site using the maxmind database. But does that tell me what their native language is? No - it only gives me a clue.

A further clue is available from the accept-language header that's returned by browsers, and is available in PHP in the variable $_SERVER[HTTP_ACCEPT_LANGUAGE]. With this variable, your web site can check if the user has expressed a language preference (and perhaps given a second and third choice too), and you can use the information to tailor your response as appropriate.

I've put up sample source code and a working demonstration on our web site. I've also added a page reporting language statistics for our own site ... only a very short data sample on there today, but as from tomoorow it will update daily with a 24 hour report.

Some surpises ... I would expect to find most major European countries choosing their own langauges, with Swiss visitors choosing between German, Italian and English. The first tests I ran, though, gave me a series of pages called up from the USA with a first choice language of Korean. Truly, the world is a global market.
(written 2006-06-18 07:17:31)

Commentatorsays ...
Graham:A few days "in" and I've been reviewing the statistics generated by this page from out site. Although 99% of UK visitors who express a preference expressed it for English, we've also had visits from the UK looking for pages in French, German, Greek, Chinese, Swedish, Dutch and Hungarian all in the last 24 hours.

It's also very interesting to note the spread of language requests from countries such as Canada and Belgium where there are several official languages, and to see communities all around the world using the web to search for material in their own native language.
(comment added 2006-06-21 06:55:39)
Associated topics are indexed under
H112 - PHP - Further Web Page and Network Handling
A211 - Web Application Design and Deployment
G902 - Well House Consultants - Web site techniques, utility and visibility

Back to
Discounts and approved supplier lists
Previous and next
or
Horse's mouth home
Forward to
Our new .eu top level domain

Some other Articles
From cat breeder to Cobol to Perl
Splash!
King Edward VII - days of empire
Our new .eu top level domain
Finding the language preference of a web site visitor
Discounts and approved supplier lists
Perl - turning seconds into days, hours, minutes and seconds
Journey planning - Xephos v Transport Direct
Much more that the world cup
Huge data files - what happened earlier?
1638 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

© WELL HOUSE CONSULTANTS LTD., 2008: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho