This is a discussion on Newbie asks about multi-lingual website strategies within the PHP General forums, part of the PHP Programming Forums category; tedd wrote: > At 11:05 PM +0100 11/27/07, Jochem Maas wrote: >> tedd wrote: >> &...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
tedd wrote:
> At 11:05 PM +0100 11/27/07, Jochem Maas wrote: >> tedd wrote: >> >> > If it were me, I wouldn't use any problematic browser detects schemes >>> (they don't work) or any of that high-thought stuff -- it's beyond me. >> >> whether it's beyond you or not only you can judge, but I disagree that >> it's >> problematic. I should note that I recommend using browser language >> preference >> detection (as per my previous post) as a means to initially select a >> [hopefully] >> suitable language BUT that this should be done in addition to offer >> the user >> an explicit mechanism for language selection. > > My "beyond me" statement was meant in jest, but browser sniffing is > notorious for being inaccurate and the practice is highly controversial. > > http://en.wikipedia.org/wiki/Browser_sniffing Sorry Tedd, but I'm not sure where the browser sniffing stuff came in. IE and FF both offer a UI to input the user's preferred language, it's an HTTP standard thing and nothign to do with user agents string parsing. It uses the Accept-Language header sent with http requests to detect the language. It's quite standard but problems usually crop up in e.g. Australia and the UK where a lot of people leave the default en-US language when en-GB or en-AU would be better. Again it's not infallible but it's a fairly good starting point. Another approach would be to use a geoip database and try and look up the users IP address but, if anything, I'd say that is even less accurate than the above. Col |
|
|||
|
Colin Guthrie wrote:
> tedd wrote: .... > > Sorry Tedd, but I'm not sure where the browser sniffing stuff came in. > IE and FF both offer a UI to input the user's preferred language, it's > an HTTP standard thing and nothign to do with user agents string > parsing. It uses the Accept-Language header sent with http requests to > detect the language. It's quite standard but problems usually crop up in > e.g. Australia and the UK where a lot of people leave the default en-US > language when en-GB or en-AU would be better. Again it's not infallible > but it's a fairly good starting point. ditto. with regard to 'en-GB' and the like - that's easy enough to match. (the snippet I offered gave one one to do this) secondly I don't consider it my problem if the user has there preferred language set to swahili when they don't even speak that language (besides which my site probably won't be offering swahili anyway). > > Another approach would be to use a geoip database and try and look up > the users IP address but, if anything, I'd say that is even less > accurate than the above. > > Col > |
|
|||
|
At 12:56 AM +0100 11/28/07, Jochem Maas wrote:
>Colin Guthrie wrote: >> tedd wrote: > >... > > > > > Sorry Tedd, but I'm not sure where the browser sniffing stuff came in. >> IE and FF both offer a UI to input the user's preferred language, it's >> an HTTP standard thing and nothign to do with user agents string >> parsing. It uses the Accept-Language header sent with http requests to >> detect the language. It's quite standard but problems usually crop up in >> e.g. Australia and the UK where a lot of people leave the default en-US >> language when en-GB or en-AU would be better. Again it's not infallible >> but it's a fairly good starting point. > >ditto. So, sniffing the browser to determine language isn't the same as browser sniffing -- OK. Sorry, my bad. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com |
|
|||
|
tedd wrote:
> At 12:56 AM +0100 11/28/07, Jochem Maas wrote: >> Colin Guthrie wrote: >>> tedd wrote: >> >> ... >> >> > >> > Sorry Tedd, but I'm not sure where the browser sniffing stuff came in. >>> IE and FF both offer a UI to input the user's preferred language, it's >>> an HTTP standard thing and nothign to do with user agents string >>> parsing. It uses the Accept-Language header sent with http requests to >>> detect the language. It's quite standard but problems usually crop >>> up in >>> e.g. Australia and the UK where a lot of people leave the default en-US >>> language when en-GB or en-AU would be better. Again it's not infallible >>> but it's a fairly good starting point. >> >> ditto. > > So, sniffing the browser to determine language isn't the same as browser > sniffing -- OK. there is no sniffing of the browser - merely a case of parsing the contents of the Accept-Language header if the browser sent it along with the request regardless of what browser is being used. there is no reason to assume that anyone would want to spoof the Accept-Language header to contain something that doesn't correspond with what the user wants ... why set japanese as a preferred language if you don't speak it? and if they do do that and end up getting a site in japanese then really that is the users problem not the site developers. it not the same as ouput different content/layout/etc based on the UserAgent string - which is known to be spoofed in order to combat idiot developers attempts to force people to use certain browser (for whatever reason) I mean, we don't assume that the requested URL is not what the user really wanted? e.g. user requests example.com/foo.php but we know that it's likely to be spoofed so we'll help out and server them example.com/bar.php ??? besides which I did state that using Accept-Language header to determine a [probable] suitable language should be done in addition to offering the user an explicit language selection mechanism. lastly I think using GEO-IP services to determine location and thereby an implied language is worthless in general - I can be sitting anywhere on the planet and still want to view content in Dutch, not to mention things like global corporate gateways, anonymous proxies, etc, etc. The exception to this could be when the website in question is specifically offering localised data (e.g. find me a restaurant/garage/whatever in Rotterdam) > > Sorry, my bad. no need for the sarcasm Tedd, seems we have differing opinions on this - although my gut feeling is that your hung up on something that's not strictly relevant in this situation. :-) |
|
|||
|
tedd wrote:
> At 12:56 AM +0100 11/28/07, Jochem Maas wrote: >> Colin Guthrie wrote: >>> tedd wrote: >> >> ... >> >> > >> > Sorry Tedd, but I'm not sure where the browser sniffing stuff came in. >>> IE and FF both offer a UI to input the user's preferred language, it's >>> an HTTP standard thing and nothign to do with user agents string >>> parsing. It uses the Accept-Language header sent with http requests to >>> detect the language. It's quite standard but problems usually crop >>> up in >>> e.g. Australia and the UK where a lot of people leave the default en-US >>> language when en-GB or en-AU would be better. Again it's not infallible >>> but it's a fairly good starting point. >> >> ditto. > > So, sniffing the browser to determine language isn't the same as browser > sniffing -- OK. > > Sorry, my bad. lol. If you define this as "sniffing" tedd, then I by that token you'd have to define the "GET / HTTP/1.1 \n Host: www.mysite.com" bit as sniffing too ;) Col |
|
|||
|
At 3:01 PM +0100 11/28/07, Jochem Maas wrote:
>tedd wrote: > > So, sniffing the browser to determine language isn't the same as browser >> sniffing -- OK. > >there is no sniffing of the browser - merely a case of parsing the contents of >the Accept-Language header if the browser sent it along with the >request regardless >of what browser is being used. > >there is no reason to assume that anyone would want to spoof the >Accept-Language header >to contain something that doesn't correspond with what the user >wants ... why set japanese >as a preferred language if you don't speak it? and if they do do >that and end up getting a >site in japanese then really that is the users problem not the site >developers. > >it not the same as ouput different content/layout/etc based on the >UserAgent string - >which is known to be spoofed in order to combat idiot developers >attempts to force >people to use certain browser (for whatever reason) > >I mean, we don't assume that the requested URL is not what the user >really wanted? >e.g. user requests example.com/foo.php but we know that it's likely >to be spoofed so >we'll help out and server them example.com/bar.php ??? > >besides which I did state that using Accept-Language header to >determine a [probable] >suitable language should be done in addition to offering the user an >explicit language >selection mechanism. > >lastly I think using GEO-IP services to determine location and >thereby an implied >language is worthless in general - I can be sitting anywhere on the >planet and still want >to view content in Dutch, not to mention things like global >corporate gateways, anonymous >proxies, etc, etc. The exception to this could be when the website >in question is specifically >offering localised data (e.g. find me a restaurant/garage/whatever >in Rotterdam) Thanks for the explanation -- I didn't realize most of that. > > Sorry, my bad. > >no need for the sarcasm Tedd, seems we have differing opinions on >this - although my gut >feeling is that your hung up on something that's not strictly >relevant in this situation. > >:-) Jochem: This just hasn't been my week -- everyone (long story) thinks I'm being sarcastic when I'm not. The "Sorry, my bad" means "I apologize, my mistake." How can that be taken as sarcasm? As for being "hung-up" -- again, I'm clueless. I mistakenly thought that anything obtained from the browser was subject to suspicion as is any outside data. But apparently you can "trust" (I realize within certain limits) some things provided by the browser -- that's news to me. Boy, I got to work on my communication skills because everyone can't be wrong, right? Again, thanks for your explanation -- and that's not being sarcastic. I'm just trying to communicate without offending/annoying anyone. Maybe I should end every line with a smiley? :-) Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com |
|
|||
|
Dear Tedd, Dear List,
tedd wrote: > As for being "hung-up" -- again, I'm clueless. I mistakenly thought that > anything obtained from the browser was subject to suspicion as is any > outside data. But apparently you can "trust" (I realize within certain > limits) some things provided by the browser -- that's news to me. You are right. Being suspicious with data coming from the browser is a pretty good reflex. But, as long as you use the accept-language header only for detecting the user's native language, you do not risk a lot. In the worst case, your will set your site's language to something that is not the user's native language. In that case, you only need to allow him to change this setting manually. You can base yourself on information provided by the browser, but as you say, I believe that we should not rely completely on it. This is why allowing the user to change his language, in your case, becomes important. It's always a balance between risk and usability. Hope this helps, Jean-Michel |
|
|||
|
tedd wrote:
> At 3:01 PM +0100 11/28/07, Jochem Maas wrote: .... > Jochem: > > This just hasn't been my week -- everyone (long story) thinks I'm being > sarcastic when I'm not. ouch! > > The "Sorry, my bad" means "I apologize, my mistake." How can that be > taken as sarcasm? guess it's down to my input filters ;-) not to worry, no feelings were hurt in the process. > > As for being "hung-up" -- again, I'm clueless. I mistakenly thought that > anything obtained from the browser was subject to suspicion as is any > outside data. But apparently you can "trust" (I realize within certain > limits) some things provided by the browser -- that's news to me. your right about the trust issue but I don't think trust is the point in this case. looking at what the browser offered as accepted languages is merely a way of trying to be helpful - you still have to parse the relevant header in a safe way. > > Boy, I got to work on my communication skills because everyone can't be > wrong, right? let's be positive, next week it will be better! > > Again, thanks for your explanation -- and that's not being sarcastic. > I'm just trying to communicate without offending/annoying anyone. Maybe > I should end every line with a smiley? :-) dunno about that smiley, it might become annoying ;-) > > Cheers, > > tedd > |
|
|||
|
Jean-Michel Philippon-Nadeau wrote:
> Dear Tedd, Dear List, > > tedd wrote: >> As for being "hung-up" -- again, I'm clueless. I mistakenly thought >> that anything obtained from the browser was subject to suspicion as is >> any outside data. But apparently you can "trust" (I realize within >> certain limits) some things provided by the browser -- that's news to me. > > You are right. Being suspicious with data coming from the browser is a > pretty good reflex. But, as long as you use the accept-language header > only for detecting the user's native language, you do not risk a lot. In > the worst case, your will set your site's language to something that is > not the user's native language. In that case, you only need to allow him > to change this setting manually. > > You can base yourself on information provided by the browser, but as you > say, I believe that we should not rely completely on it. This is why > allowing the user to change his language, in your case, becomes important. yes! that's what I was trying to say :-) > > It's always a balance between risk and usability. > > Hope this helps, > > > Jean-Michel > |