0

I'd like my website (c#) to detect visitor's country and present the website in their local language. This is straight forward for the most part but I've run into problems for the following countries:

  • Canada
  • Switzerland
  • Taiwan

All of which have at least two languages being spoken. I was wondering if there are ways to detect the language preference for visitors from these countries. I've thought of a couple of things:

  1. Region based detection, pinpoint which region of the country are they from by capturing IP.
  2. Detect the visitor's OS language and replicate that.

If you have other ideas I'd greatly appreciate it. How does other website do this?

1 Answers1

0

It depends from framework and language (of programming) that you use.

For example in pure PHP there is variable $_SERVER with property 'HTTP_ACCEPT_LANGUAGE', example of usage in the link below:

Detect Browser Language in PHP

In Symphony you can configure translator setting parameter as '%locale%'.

http://symfony.com/doc/current/best_practices/i18n.html

A lot of information about IP and OS there are in $_SERVER.

Community
  • 1
  • 1
Daniel
  • 7,684
  • 7
  • 52
  • 76