469,946 Members | 1,982 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,946 developers. It's quick & easy.

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 2263
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Erwin Moller | last post: by
115 posts views Thread by Mark Shelor | last post: by
3 posts views Thread by gg | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.