473,385 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ServerVariables & Language Preferences Support

I'm messing around with the Request.UserLanguages and the
Request.ServerVariables("HTTP_ACCEPT_LANGUAGE"); to see
how similar or dissimilar they may be.

I observe and conclude that both get their value from the Accept-Language
key stored in the header of the response. To test this hypothesis I
reconfigure IE Language Preferences which by default (for me)
is English (United States)[en-us].

I include a Spanish (Mexico)[es-mx] Language Preference and
use the Language Preferences tool to move the Spanish selection
to the top of the Language Preferences list.

I load a page with a couple of Response.Write statements and see the
following written to the page...

HTTP_ACCEPT_LANGUAGE: es-mx,en-us;q=0.5
User Language 0: es-mx
User Language 1: en-us;q=0.5

So, I ask myself what the heck is this q=0.5 name=value pair?

I go back to Language Preferences and feel like a freedom fighter
so I add Arabic(Iraq)[ar-iq] and this is what is written to the page...

HTTP_ACCEPT_LANGUAGE: es-mx,en-us;q=0.7,ar-iq;q=0.3
User Language 0: es-mx
User Language 1: en-us;q=0.7
User Language 2: ar-iq;q=0.3

So, now I'm asking, "what the heck does this q sh!t mean and why the
inconsistent values?"

--
<%= Clinton Gallagher
A/E/C Consulting, Web Design, e-Commerce Software Development
Wauwatosa, Milwaukee County, Wisconsin USA
NET csgallagher@ REMOVETHISTEXT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
Nov 18 '05 #1
3 2392
Interesting. Here's what my version of IE is sending:

HTTP_ACCEPT_LANGUAGE:en-us,en-ca;q=0.7,fr-ca;q=0.3

Is it inconsistent? Anyway, I'll ask around to see what the q stuff is all
about.

Ken
"clintonG" <csgallagher@RE************@metromilwaukee.com> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
I'm messing around with the Request.UserLanguages and the
Request.ServerVariables("HTTP_ACCEPT_LANGUAGE"); to see
how similar or dissimilar they may be.

I observe and conclude that both get their value from the Accept-Language
key stored in the header of the response. To test this hypothesis I
reconfigure IE Language Preferences which by default (for me)
is English (United States)[en-us].

I include a Spanish (Mexico)[es-mx] Language Preference and
use the Language Preferences tool to move the Spanish selection
to the top of the Language Preferences list.

I load a page with a couple of Response.Write statements and see the
following written to the page...

HTTP_ACCEPT_LANGUAGE: es-mx,en-us;q=0.5
User Language 0: es-mx
User Language 1: en-us;q=0.5

So, I ask myself what the heck is this q=0.5 name=value pair?

I go back to Language Preferences and feel like a freedom fighter
so I add Arabic(Iraq)[ar-iq] and this is what is written to the page...

HTTP_ACCEPT_LANGUAGE: es-mx,en-us;q=0.7,ar-iq;q=0.3
User Language 0: es-mx
User Language 1: en-us;q=0.7
User Language 2: ar-iq;q=0.3

So, now I'm asking, "what the heck does this q sh!t mean and why the
inconsistent values?"

--
<%= Clinton Gallagher
A/E/C Consulting, Web Design, e-Commerce Software Development
Wauwatosa, Milwaukee County, Wisconsin USA
NET csgallagher@ REMOVETHISTEXT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/


Nov 18 '05 #2
Here's the explanation that I got from a fellow MVP regarding the "q" part:

Quality - indicates a level of your preference for a particular choice.
A number between 0.0 and 1.0, 0.0 being "never want to use this". If the
server has content in multiple languages that your Accept-Language
header also lists, the server should choose the one with the highest q
number. See RFC2616 for more details:

http://www.faqs.org/rfcs/rfc2616.html
"clintonG" <csgallagher@RE************@metromilwaukee.com> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
I'm messing around with the Request.UserLanguages and the
Request.ServerVariables("HTTP_ACCEPT_LANGUAGE"); to see
how similar or dissimilar they may be.

I observe and conclude that both get their value from the Accept-Language
key stored in the header of the response. To test this hypothesis I
reconfigure IE Language Preferences which by default (for me)
is English (United States)[en-us].

I include a Spanish (Mexico)[es-mx] Language Preference and
use the Language Preferences tool to move the Spanish selection
to the top of the Language Preferences list.

I load a page with a couple of Response.Write statements and see the
following written to the page...

HTTP_ACCEPT_LANGUAGE: es-mx,en-us;q=0.5
User Language 0: es-mx
User Language 1: en-us;q=0.5

So, I ask myself what the heck is this q=0.5 name=value pair?

I go back to Language Preferences and feel like a freedom fighter
so I add Arabic(Iraq)[ar-iq] and this is what is written to the page...

HTTP_ACCEPT_LANGUAGE: es-mx,en-us;q=0.7,ar-iq;q=0.3
User Language 0: es-mx
User Language 1: en-us;q=0.7
User Language 2: ar-iq;q=0.3

So, now I'm asking, "what the heck does this q sh!t mean and why the
inconsistent values?"

--
<%= Clinton Gallagher
A/E/C Consulting, Web Design, e-Commerce Software Development
Wauwatosa, Milwaukee County, Wisconsin USA
NET csgallagher@ REMOVETHISTEXT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/


Nov 18 '05 #3
Thanks Ken. Convey my appreciation to your colleague. I'll get around
to reading the RFC. Meanwhile, we know by 'general consensus' that
the language preference settings sent by the user agent are not supposed
to be reliable indicators that can be used to modify page output
(server settings over-ride the user agent) but the server-centric point of
view fails to account for the user's preferences should he or she want to
read content in pages a site operator chose to make available in
different languages regardless.

Preparing to achieve the MCAD cert I've seen two 'correct' answers
regarding how to determine preferences. The first advocates using a
DropDownList to allow the user to select their preference (Kalani,
QUE 70-315). The second advocates getting the preferences from
the request object (Transcender).

Besides thinking through my own design and implementation for a
project I am working on I'm conflicted regarding how to approach
70-315 with two opposing 'correct' answers proferred by two seemingly
equal authoritative sources.

--
<%= Clinton Gallagher
A/E/C Consulting, Web Design, e-Commerce Software Development
Wauwatosa, Milwaukee County, Wisconsin USA
NET csgallagher@ REMOVETHISTEXT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/


"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:OE**************@TK2MSFTNGP11.phx.gbl...
Here's the explanation that I got from a fellow MVP regarding the "q" part:

Quality - indicates a level of your preference for a particular choice.
A number between 0.0 and 1.0, 0.0 being "never want to use this". If the
server has content in multiple languages that your Accept-Language
header also lists, the server should choose the one with the highest q
number. See RFC2616 for more details:

http://www.faqs.org/rfcs/rfc2616.html
"clintonG" <csgallagher@RE************@metromilwaukee.com> wrote in message
news:uu**************@TK2MSFTNGP09.phx.gbl...
I'm messing around with the Request.UserLanguages and the
Request.ServerVariables("HTTP_ACCEPT_LANGUAGE"); to see
how similar or dissimilar they may be.

I observe and conclude that both get their value from the Accept-Language
key stored in the header of the response. To test this hypothesis I
reconfigure IE Language Preferences which by default (for me)
is English (United States)[en-us].

I include a Spanish (Mexico)[es-mx] Language Preference and
use the Language Preferences tool to move the Spanish selection
to the top of the Language Preferences list.

I load a page with a couple of Response.Write statements and see the
following written to the page...

HTTP_ACCEPT_LANGUAGE: es-mx,en-us;q=0.5
User Language 0: es-mx
User Language 1: en-us;q=0.5

So, I ask myself what the heck is this q=0.5 name=value pair?

I go back to Language Preferences and feel like a freedom fighter
so I add Arabic(Iraq)[ar-iq] and this is what is written to the page...

HTTP_ACCEPT_LANGUAGE: es-mx,en-us;q=0.7,ar-iq;q=0.3
User Language 0: es-mx
User Language 1: en-us;q=0.7
User Language 2: ar-iq;q=0.3

So, now I'm asking, "what the heck does this q sh!t mean and why the
inconsistent values?"

--
<%= Clinton Gallagher
A/E/C Consulting, Web Design, e-Commerce Software Development
Wauwatosa, Milwaukee County, Wisconsin USA
NET csgallagher@ REMOVETHISTEXT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

Nov 18 '05 #4

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

Similar topics

7
by: Erwin Moller | last post by:
Hi group, I am a bit cconfused with the different tags I encounter to start a script. I used to use: language="Javascript" Nowadays I use: type="text/javascript" I did see some...
115
by: Mark Shelor | last post by:
I've encountered a troublesome inconsistency in the C-language Perl extension I've written for CPAN (Digest::SHA). The problem involves the use of a static array within a performance-critical...
72
by: Paminu | last post by:
In math this expression: (a < b) && (b < c) would be described as: a < b < c But why is it that in C these two expressions evaluate to something different for the same values of a, b and...
0
by: Enzo | last post by:
Hello, I am trying to add items to the ServerVariables Collection for some custom processing. In the past this needed to be done with an ISAPI filter. I am told now that I can do this with a...
11
by: Tom | last post by:
I am planning on adding a Preferences form to my application and using the Property Grid to display the preferences to the user. What do you think would be the best way to save these preferences...
10
by: Immortalist | last post by:
Various aquisition devices that guide learning along particular pathways towards human biases. And as E.O. Wilson might say mental development appears to be genetically constrained. (1) Language...
3
by: gg | last post by:
I specify the Url element as <xsd:element name="Url"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="512"/> <xsd:pattern value="http://+"/> </xsd:restriction>...
6
by: plenty900 | last post by:
Hi folks, I've altered the PHP underlying a website to support a few languages other than English, but the Firefox version that I'm using is of course the English-language one. When I set the...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.