PHP User Agent Language Detection

This script detects your system language as reported by the requesting user agent. It uses the PHP $_SERVER["HTTP_ACCEPT_LANGUAGE"] method. Please note: the script will only be able to determine the languages sent by the user agent visiting the site; the actual system language[s] is as far as we know not accessible to this type of detection.

The script returns a two dimensional array of values. Each language has the following returned:

  1. Full language id – example: ‘en-us’
  2. Primary language id – example: ‘en’
  3. Full language string – example: ‘English (United States)
  4. Primary language string – example: ‘English’

Since some systems have many languages installed, the script returns an array of those languages, the first array in that series is the primary language, the second the secondary, and so on.

Download :

http://cid-446dea32ef7318f7.skydrive.live.com/self.aspx/.Public/php|_language|_detection.php

Leave a Reply