PHP Get browser Language
You can get the language of your visitor in this way:
This will give you the 2letter language code, ie: en for english and fr for french .
In fact $_SERVER['HTTP_ACCEPT_LANGUAGE'] will get all language the user prefer to use, in order. So substr() will give you the first choice, you can also get the second choice, the third ...
Having the language of your visitor will let you display custom page depending on his language, for example if someone's language is french, you will have $lang="fr" , then you can redirect him to www.yoursite.com/fr/ or yoursite.com/?lang=fr to show him your website in french, or show him things related to french language, whatever your website is about.
9 comments:
-
-
Thanks for that useful info.
- June 1, 2012 at 11:19 PM
- Unknown said...
-
Our PHP Developers have excellent skills in content management system (CMS), collaborative networking systems, shopping carts, testing, implementations, portals and most important online business application development.
- September 12, 2012 at 3:21 AM
- LOL elo boost said...
-
Amazing because typical! This can be my personal very first time commenting however I've been subsequent your site for a long time: )#) adore the appearance upon EACH from the felines encounters; )#) extremely adorable hair styles, as well.
League of Legends boost
Cheap Fifa 14 Ultimate Team Coins - March 29, 2014 at 12:31 AM
-
-
Thanks for this, I have used it as a base for determining a users location and language to show different information to those in the US then those in other countries. You can see it at http://www.brandonorndorff.com/scripts/php/how-to-find-website-visitor-location-and-language/
- October 29, 2015 at 5:23 PM
- Unknown said...
-
Hey Nice blog,Thanks for sharing this blog.!!!
Best Summer training in lucknow
Best Php training in lucknow
Summer training in lucknow
Summer training Company in lucknow - April 26, 2017 at 2:12 AM
- Unknown said...
-
Really incredible and interesting article. Keep the good work. I really appreciate your effort on putting such thoughts in the post. Thanks for sharing with us. Latest php jobs in hyderabad
- May 30, 2017 at 2:56 AM
- JAHAN said...
-
This is so helpful I will definitely use this and I will happily link your site. I was having such a hard time figuring this privacy stuff out until I found your site. Thanks.
- July 25, 2017 at 5:36 AM
- Ancy merina said...
- This comment has been removed by the author.
- March 18, 2018 at 10:06 PM
- jefrin said...
-
Very nice to read the blog
blue prism training in chennai - January 22, 2019 at 12:37 AM
Search With Google
Categories
- 1-General (3)
- 2-Getting started (4)
- 3-Strings (10)
- 4-Server config (1)
- 5-Best scripts (7)
- email (4)
- files (6)
- Forms (3)
- If statements (3)
- Loop statements (2)
- Mysql (2)
- Server variables (3)
- Sessions (1)
- Tutorials-planet.com (1)
- web hosting (1)
- You need a programmer ? (1)
Links to visit !
Blog Archive
-
▼
2010
(12)
-
▼
January
(10)
- String Capitalization Functions: strtoupper-strtol...
- PHP For Loop
- PHP Validate Email Address: Email Validator
- PHP Random code Generator
- PHP Get browser Language
- PHP $_REQUEST
- PHP send mail SMTP authentification
- ob_start - save php output to a string - The PHP o...
- PHP send HTML email, The complete php mail sending...
- PHP mail() - send email with php
-
▼
January
(10)