473,549 Members | 2,889 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to detect client language?

Is there an easy way to detect the local language settings of a client
browser or system?

I want to for example determine if the users browser or system is set to
English, French, or Italian and display a message in the appropriate
language.
--
Christopher J. Fynn


Jul 20 '05 #1
5 27362
Hi there ...
Chris Fynn wrote:
Is there an easy way to detect the local language settings of a client
browser or system?

I want to for example determine if the users browser or system is set to
English, French, or Italian and display a message in the appropriate
language.


Seems like there was a thread on about this topic about a month or so
ago; maybe a little longer. Seems like the solution revolved around
examining the HTTP_ACCEPT_LAN GUAGE environment variable at the server.
Maybe google for "check HTTP_ACCEPT_LAN GUAGE" and see if that doesn't
find it.

Regards,
Stephen

Jul 20 '05 #2
Hallo

IE has a navigator property which is
navigator.syste mLanguage
and also
navigator.userL anguage
it returns intenrational codes for nationalities: exaple 'it' for Italy.
NS6 has a
navigator.langu age
property which returns a slightly different value: for english it returns
en-US

if you want you can open with different browsers the following file I made:

http://www.unitedscripters.com/hotvamps/browsers.html

upon loading it will list all the properties for each object in a select
menu (starts with the window object of course), upon selection it will
unfold the selected object too (if it is an object). In the second half of
the file you can provide yourself objects, such as "navigator" and click
"Populate" - on both sections you'll see properties, data type, and values
as well. You can check with all the browsers you prefer. I think that can be
helpful to inspect a great deal of properties we webmasters are not always
familiar with or we didn't even know they existed.
You can also check DOM objects as they get unfolded. To reset, reload the
page.

I have not checked with NS4 though - ok I do it now...
yeah it has
navigator.langu age
too and for it reports "en" for english.
You can check by
var
language=(navig ator["language"])?navigator["language"]:navigator["userLangua
ge"];

allow for a value "undefined" for browsers that don't fall in either scope.
ciao
Alberto Vallini
http://www.unitedscripters.com/

"Chris Fynn" <remove%20chris _fynn%20@%20hot mail.%20com%20. remove> ha scritto
nel messaggio news:bn******** **@titan.btinte rnet.com...
Is there an easy way to detect the local language settings of a client
browser or system?

I want to for example determine if the users browser or system is set to
English, French, or Italian and display a message in the appropriate
language.
--
Christopher J. Fynn

Jul 20 '05 #3
Chris Fynn wrote:
I want to for example determine if the users browser or system is set to
English, French, or Italian and display a message in the appropriate
language.
Your request is based on the false assumption that a French, working in
the UK with the French language pack of the English browser and French
keyboard layout on a system with an English-UK locale, is not interested
in the Italian version of the site. Use server-side Content Negotiation
along with language links (without flags!) and let your visitors decide
what they want to see.
--
Christopher J. Fynn


Please read the OE-FAQ and repair your b0rken signature separator.
It is required to be `-- ' (dash-dash-space) to work but you will
not accomplish this with OE alone (since it removes trailing spaces
on post).
PointedEars
Jul 20 '05 #4
Chris Fynn hu kiteb:
Is there an easy way to detect the local language settings of a client
browser or system?

I want to for example determine if the users browser or system is
set to English, French, or Italian and display a message in the
appropriate language.


No thank you. I have to work with Japanese windows (local market means
English windows is ludicrously expensive, and will disable some
essential software I use), but where possible, I prefer an English
interface. Please, DON'T autodetect this. Ask the user.

Oh, and don't use flags when you ask the user ;)
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #5
JRS: In article <3F************ **@PointedEars. de>, seen in
news:comp.lang. javascript, Thomas 'PointedEars' Lahn
<Po*********@we b.de> posted at Sun, 23 Nov 2003 22:41:45 :-
Please read the OE-FAQ and repair your b0rken signature separator.
It is required to be `-- ' (dash-dash-space) to work but you will


The word is "broken"; use of Merkin slang is discourteous to those who
are trying to learn good English.

To be a SigSep, dash-dash-space must be the only thing on the line.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
436
by: Gouri | last post by:
How fo you detect whether the client machine has a modem attached to it with VB.NET or C#
8
2377
by: Brent | last post by:
Does anyone know the best way to detect and track a visitors screen resolution. I know the javascript to detect the users resolution but I am a bit confused on the best way to track and save this. Should I save it to a database or is it easier to save it to a text file?
3
4131
by: TJS | last post by:
trying to detect status of the checkbox to produce an alert can someone guide me to a fix on this? <input id="badcustomers" type="checkbox" checked name="badcustomers" >............... <script language ="javascript"> var part1, part2, part3, isNN; function setVariables() { if (navigator.appName == "Netscape") { isNN = true;...
6
5211
by: hb | last post by:
Hi, Would you please tell me how to detect if the client's browser is closed? I need such event to trigger a database modification. Thank you hb
5
3019
by: RC | last post by:
how to detect file is completely downloaded from client by following code? <%@ Page language="C#" debug="true" %> <script language="C#" runat="server"> private void Page_Load(object sender, System.EventArgs e) { Response.ContentType="application/zip"; Response.AppendHeader("Content-Disposition","attachment; filename=myzipfile.zip");...
8
3010
by: BJ | last post by:
Problem: How can I code up a client side process to detect if the network is available? Synopsis: I am writing ASP.NET input forms for a Panasonic Tuff book. The users will be walking around the plant with a wireless connection. There are some pockets of non-connectivity. I've been tasked with disabling the submit button on the form if...
2
3708
by: Kam | last post by:
I am using SQL Server 2000 Analysis services and Office Web Components to display the information. when the user first time access the web site, he/she did to add it into the trusted site list, Otherwise, the user is required to ignore some warming message. Does anyone know how to detect the current site is in the trusted site list? If...
7
2639
by: Peter | last post by:
Hello I have an UTF string, how can i detect what language it is? thanks from Peter (cmk128@hotmail.com)
1
4667
by: s3raph | last post by:
Hi, I'm having trouble detecting the client machine connection lost when the client physically pushes the power or restart button on their computer. Using the code from Plater in the following thread: http://bytes.com/topic/net/answers/828133-c-net-detecting-socket-closed I have managed to detect disconnect by the client when the client...
0
7484
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7755
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7997
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7842
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6091
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5400
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5124
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
798
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.