Welcome to WebmasterWorld Guest from 54.147.165.246

Forum Moderators: open

Message Too Old, No Replies

language based redirection

     

volatilegx

11:16 pm on Mar 11, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm working on adding language based cloaking to my cloaking script. I'm not sure how to tell what language the client is using... any pointers?

Macguru

11:20 pm on Mar 11, 2002 (gmt 0)

WebmasterWorld Senior Member macguru is a WebmasterWorld Top Contributor of All Time 10+ Year Member



There is no sure way of knowing. A lot of people are using a browser language version that does not match the language they are speaking.

Best thing is to let the user decide wich version he likes.

volatilegx

12:40 am on Mar 13, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I was afraid somebody was going to say that :(

jatar_k

12:42 am on Mar 13, 2002 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



haha

sorry volatile, i think macguru is probably right.

Air

5:01 am on Mar 13, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It may not be a completely lost cause, there are enough sites serving based on the language setting that IMO most people set them at least to a language they understand, otherwise they encounter sites that are not understandable by them, which forces them to revisit their language setting. So they may not entirely indicate geography but they can be served a page in a language they likely understand, it's worth a shot IMHO....

volatilegx

6:29 pm on Mar 15, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Air do you know if the language is determined by a string in the User Agent?

Air

12:47 am on Mar 16, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Below is a sampling I collected a while back Volatilegx, it's from the environment variable $ENV{'HTTP_ACCEPT_LANGUAGE'} from visitors to one of my sites.


HTTP_ACCEPT_LANGUAGE = nl-be
HTTP_ACCEPT_LANGUAGE = fr
HTTP_ACCEPT_LANGUAGE = it
HTTP_ACCEPT_LANGUAGE = en-us
HTTP_ACCEPT_LANGUAGE = en
HTTP_ACCEPT_LANGUAGE = pt
HTTP_ACCEPT_LANGUAGE = de
HTTP_ACCEPT_LANGUAGE = en-gb
HTTP_ACCEPT_LANGUAGE = es-mx
HTTP_ACCEPT_LANGUAGE = en-ca
HTTP_ACCEPT_LANGUAGE = ja
HTTP_ACCEPT_LANGUAGE = es-pe
HTTP_ACCEPT_LANGUAGE = es
HTTP_ACCEPT_LANGUAGE = lv

As you can see there's quite a mixture, there were many others, the ones above are pretty self explanatory, some I had to look up 'cause I had no idea what country the abbriviation pointed to.

Eric_Jarvis

12:40 pm on Mar 18, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



bear in mind that I currently work in 15 languages...I don't want to have to change my language settings each time I change language

many people in global organisations face the problem of using computers in a foreign country...again they may not want the site to decide what language they wish to use based on the preference of the regular user of the computer

aside from my own multilingual work, in the last few weeks other have used the workstations here to browse the web in: French, Japanese, Italian, German, Danish and Chinese

please don't assume that all web use is by a single user per computer using a single language all the time

volatilegx

8:05 pm on Mar 18, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Air, thank you, that is exactly what I was looking for!!

volatilegx

8:39 pm on Mar 21, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cool it works! If anybody is interested, the $ENV{'HTTP_ACCEPT_LANGUAGE'} is passed as a comma and semicolon delimited list...

such as

es,en-us;q=0.7,ar-lb;q=0.3

meaning a International Spanish version of a page would receive top priority to the browser, then U.S. English, then Arabic from Lenbanon. The q=0.7 thing seems to have something to do with priority, as does the list order.

I just pull the first item from the list and match it to a user defined string like "es" or "en-us" and redirect to a page also specified by the user.

volatilegx

8:41 pm on Mar 21, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's the list of codes I was able to collect:

Afrikaans = af
Albanian = sq
Arabic (Algeria) = ar-dz
Arabic (Bahrain) = ar-bh
Arabic (Egypt) = ar-eg
Arabic (Iraq) = ar-iq
Arabic (Jordan) = ar-jo
Arabic (Kuwait) = ar-kw
Arabic (Lebanon) = ar-lb
Arabic (libya) = ar-ly
Arabic (Morocco) = ar-ma
Arabic (Oman) = ar-om
Arabic (Qatar) = ar-qa
Arabic (Saudi Arabia) = ar-sa
Arabic (Syria) = ar-sy
Arabic (Tunisia) = ar-tn
Arabic (U.A.E.) = ar-ae
Arabic (Yemen) = ar-ye
Arabic = ar
Armenian = hy
Assamese = as
Azeri (Cyrillic) = az
Azeri (Latin) = az
Basque = eu
Belarusian = be
Bengali = bn
Bulgarian = bg
Catalan = ca
Chinese (China) = zh-cn
Chinese (Hong Kong SAR) = zh-hk
Chinese (Macau SAR) = zh-mo
Chinese (Singapore) = zh-sg
Chinese (Taiwan) = zh-tw
Chinese = zh
Croatian = hr
Chech = cs
Danish = da
Divehi = div
Dutch (Belgium) = nl-be
Dutch (Netherlands) = nl
English (Australia) = en-au
English (Belize) = en-bz
English (Canada) = en-ca
English (Caribbean) = en
English (Ireland) = en-ie
English (Jamaica) = en-jm
English (New Zealand) = en-nz
English (Philippines) = en-ph
English (South Africa) = en-za
English (Trinidad) = en-tt
English (United Kingdom) = en-gb
English (United States) = en-us
English (Zimbabwe) = en-zw
English = en
Estonian = et
Faeroese = fo
Farsi = fa
Finnish = fi
French (Belgium) = fr-be
French (Canada) = fr-ca
French (France) = fr
French (Luxembourg) = fr-lu
French (Monaco) = fr-mc
French (Switzerland) = fr-ch
FYRO Macedonian = mk
Gaelic = gd
Georgian = ka
German (Austria) = de-at
German (Germany) = de
German (Liechtenstein) = de-li
German (lexumbourg) = de-lu
German (Switzerland) = de-ch
Greek = el
Gujarati = gu
Hebrew = he
Hindi = hi
Hungarian = hu
Icelandic = is
Indonesian = id
Italian (Italy) = it
Italian (Switzerland) = it-ch
Japanese = ja
Kannada = kn
Kazakh = kk
Konkani = kok
Korean = ko
Kyrgyz = kz
Latvian = lv
Lithuanian = lt
Malay (Brunei) = ms
Malay (Malaysia) = ms
Malayalam = ml
Maltese = mt
Marathi = mr
Mongolian (Cyrillic) = mn
Nepali (India) = ne
Norwegian (Bokmal) = nb-no
Norwegian (Bokmal) = no
Norwegian (Nynorsk) = nn-no
Oriya = or
Polish = pl
Portuguese (Brazil) = pt-br
Portuguese (Portugal) = pt
Punjabi = pa
Rhaeto-Romanic = rm
Romanian (Moldova) = ro-md
Romanian = ro
Russian (Moldova) = ru-md
Russian = ru
Sanskrit = sa
Serbian (Cyrillic) = sr
Serbian (Latin) = sr
Slovak = sk
Slovenian = ls
Sorbian = sb
Spanish (Argentina) = es-ar
Spanish (Bolivia) = es-bo
Spanish (Chile) = es-cl
Spanish (Colombia) = es-co
Spanish (Costa Rica) = es-cr
Spanish (Dominican Republic) = es-do
Spanish (Ecuador) = es-ec
Spanish (El Salvador) = es-sv
Spanish (Guatemala) = es-gt
Spanish (Honduras) = es-hn
Spanish (International Sort) = es
Spanish (Mexico) = es-mx
Spanish (Nicaragua) = es-ni
Spanish (Panama) = es-pa
Spanish (Paraguay) = es-py
Spanish (Peru) = es-pe
Spanish (Puerto Rico) = es-pr
Spanish (Traditional Sort) = es
Spanish (United States) = es-us
Spanish (Uruguay) = es-uy
Spanish (Venezuela) = es-ve
Sutu = sx
Swahili = sw
Swedish (Finland) = sv-fi
Swedish = sv
Syriac = syr
Tamil = ta
Tatar = tt
Telugu = te
Thai = th
Tsonga = ts
Tswana = tn
Turkish = tr
Ukrainian = uk
Urdu = ur
Uzbek (Cyrillic) = uz
Uzbek (Latin) = uz
Vietnamese = vi
Xhosa = xh
Yiddish = yi
Zulu = zu

Air

2:38 am on Mar 22, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Excellent list vgx, just as an aside, for most spiders the language setting will be blank ;)

volatilegx

6:23 pm on Mar 22, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Right, Air, I'm just doing this for non-bot visitors.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month