Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    Nottingham, UK
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Detect regional settings

    Hi All,

    Is there any way of detecting regional settings using PHP, ASP, JSP? What I want to do is when someone enters the website, this bit of script which would detect the regional settings - and direct the user to the appropriate site.

    I.e User has UK set on regional settings, enters site, script is executed on index page, all currencies are displayed in GBP.

    I.e User has US set on regional settings, enters site, script is executed on index page, all currencies are displayed in USD.

    Is this possible?

    If anyone has any suggestions or ideas to help with the above please let me know.

    Thanks in advance
    Sarah
    You are not a human being having a spiritual experience, your a spiritual
    being having a human experience.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The language can be taken from $_SERVER['HTTP_ACCEPT_LANGUAGE'], maybe also from $_SERVER['HTTP_USER_AGENT']. Put that through a switch statement to initialize the settings for your user's visit.

    But: These HTTP headers are not required to be sent by the client. That means that you can't rely on these variables in every situation, client settings or proxies might filter them out. Additionally, user's might use a client with different language settings than the rest of their OS.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •