RE: bilingual websites

Eric,

You can get the Java locale of your system or the locale set by a locale
constructor.  Browsers have Accept-Language and Accept-Charset strings.
These are RFC 3066 http://www.ietf.org/rfc/rfc3066.txt language strings of
acceptable languages and characters sets.

You find the first matching language with the highest quality "q=" value.  I
have some C code that will parse the accept language string in xIUA.
http://www.xnetinc.com/xiua/  Look for the xiua_AcceptLanguage code.  It
uses nested strtok_r loops and provides a strtok_r function for systems like
Windows that do not have them.

Be aware that browsers do not always have the accept set properly.  Some
time users have them set to the installation default or are using internet
cafes where it may be set to the last user's preferences.  Therefore you
have to have a way of passing locale info froe each page.  I prefer storing
each language in a separate directory with is subdirectories.  This way you
use accept-language to get them to a localized home page and then can chose
an alternate language at any time.  This approach make links easier to
maintain because pages from one language usually link to other pages of the
same language.  When you get a new page you can parse the RFC 3066
language-sublanguage (Usually language/country) and use that as a locale for
all your processing.  xIUA even has some sample Apache server code to modify
mod_mime processing to pickup language from the URI instead of having to add
a language tag to all your pages.

Carl
  -----Original Message-----
  From: www-international-request@w3.org
[mailto:www-international-request@w3.org]On Behalf Of Eric Kreiser
  Sent: Monday, October 29, 2001 6:25 AM
  To: 'Williams Christopher GT/IT'; www-international@w3.org
  Subject: RE: bilingual websites


  What technology are you using for your site.

  I am using JAVA Servlets, and yes, you can ask the HTTPRequest for either
the current default locale for the browser (getLocale()) or an enumeration
of locale choices set in the browser(getLocales()).
    -----Original Message-----
    From: Williams Christopher GT/IT
[mailto:ChristopherWilliams@gwynedd.gov.uk]
    Sent: Monday, October 29, 2001 7:01 AM
    To: www-international@w3.org
    Subject: bilingual websites


    Hi,

    We have a website that uses a simple "language menu" that allows the
user to select a language which will then load a new page in that language.

    My question is, can the server automatically send out a page in the
language set in the user's browser preferences.

    I hope this is appropriate for this list.

    Thanks,

    Chris


    ps. We use IIS

Received on Monday, 29 October 2001 11:35:22 UTC