-1

im making a website (wordpress multisite) which is supported by 2 languages for users, there 2 methods we will use it one:

-Detect language by Geo IP

-Detect Language by Internet Browser

Which is the best method to use it?

Thanks in Advance!

Mansfield
  • 14,445
  • 18
  • 76
  • 112
Ivan
  • 1,221
  • 2
  • 21
  • 43
  • Please explain your question better. When you say "Detect language", what do you mean? – Daniel Daranas Dec 20 '11 at 21:49
  • with IP you could detect region i guess... – John Riselvato Dec 20 '11 at 21:50
  • 1
    This is a kind of poll, for example: You are in China, your IP is chinese and you are going to visit my website... this content is chinese language while your Firefox or Chrome is english Language. Otherwise, Your IP is chinese and your Firefox is english, my website can detect your browser agent which is using language, then you receive my website is english language – Ivan Dec 20 '11 at 21:53

1 Answers1

5

If I were you I'd follow this list:

  1. If the user is a registered user, set the language according to his/her preferences

  2. If the user has been on the site before, using language X, use that (store the language option in a cookie).

  3. If the http header Accept-Language is present, try to make use of it (you obviously don't support all the languages in the world). In PHP you can get a hold of this value through $_SERVER['ACCEPT_LANGUAGE'].

    I have seen people make use of Accept-Charset as well, trying to narrow it down if the languages specified (in Accept-Language) can't be used, that is kind of a long shot though.

  4. Final option is to use Geo IP to try and figure out where in the world the user might be, and what language is spoken there. This is a tough one though since the official language in a country might not be the one preferably used by the end user.


As long as the user can easily change language and isn't bound to any of the above presets there shouldn't be any problem.

.. and please; try to keep track of what language a user has been using before so that he or she doesn't have to change language every time he/she visits your site.

Community
  • 1
  • 1
Filip Roséen - refp
  • 62,493
  • 20
  • 150
  • 196
  • In addition, make sure to make it easy to change languages if you don't know the language shown to you. Like little flags in the corner. – Tyler Smith Dec 20 '11 at 22:00
  • I understand, i wonder do you think about wordpress with multisite function could be a good idea? primary site is english language like www.helloworld.com and french language will be french.helloworld.com – Ivan Dec 20 '11 at 22:02
  • @Tyler Smith, i think about little flags in the corner is... kinda old news, because there some people are lazy :P – Ivan Dec 20 '11 at 22:03