Welcome to WebmasterWorld Guest from 54.82.93.116

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

browser language recognition

how to make your website recognize browser language

     
8:06 pm on Jul 30, 2005 (gmt 0)

New User

10+ Year Member

joined:June 8, 2005
posts:37
votes: 0


i'm trying to figure out how to get my site to recognize the browser language that the customer is using when visiting the site. does anyone know of a effective way. ive decided to use the infrastructure for the site language distribution in .html form. i noticed that www.skype.com uses www.skype.com/intl/es/ for spanish www.skype.com/intl/it/ for italian and so on. i think this is a great simple approach but how do i actually get the main site. www.mysite.com to actually make the www.mysite.com/intl/es/ to start when a spanish speaking visitor arrives? Is this .htaccess?
8:29 pm on July 30, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


This could be done in .htaccess or httpd.conf by testing the HTTP Accept_Language header, or by using MultiViews (see mod_negotiation).

Another common answer to this kind of question is to let the user select the language by using links, national flag icons, national subdomains, etc. The usual comment being, "Just because the browser is set to a certain language or the ISP resolves to a certain geolocation doesn't mean the user speaks that language." If a user's ISP resolves to Canada, do they want French or English? How about Belgium, or other multilingual countries? Internet cafes and other "public computers" in large cities also come to mind.

So, the common advice is, let the user choose, then offer a cookie to save the setting if the machine is their personal machine.

Jim

8:33 pm on July 30, 2005 (gmt 0)

Senior Member from CA 

WebmasterWorld Senior Member encyclo is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 31, 2003
posts:9074
votes: 6


The basic requirement for adjusting your content to the user's preferred language is based around the fact that most browsers send an
Accept-Language
header with each request that you can parse to determine which language to serve.

You have two possible approaches (both related): the first is to use Apache Content Negotiation [httpd.apache.org] to determine the most appropriate language file to serve. The second approach is to use server-side scripting (PHP, ASP, etc.) to do the content negotiation.

Spiders and older browsers don't usually send an

Accept-Language
header, so you will need to specify a default.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members