seo

PHP Language Detection

Posted by on 15 Oct 2011 at 2:56 am

There is a very simple method to detect what language the users web browser is using. The following code: //session variable ensures it’s available //throughout current session $_SESSION['lang'] = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); echo $_SESSION['lang']; Will give you the correct two letter ISO code for the language the browser is using.

ISO Language codes

Posted by on 15 Oct 2011 at 2:51 am

The ISO language code can be used to declare the language of a Web page (or a portion of a Web page) or identify the default browser language. Language ISO Code Abkhazian ab Afar aa Afrikaans af Albanian sq Amharic am Arabic ar Aragonese an Armenian hy Assamese as Aymara ay Azerbaijani az Bashkir ba [...]