Change the language of your website

Last update on October 24, 2009 06:56 AM by jak58
Published by jad05

Change the language of your website








If you have ever changed the language of a website that you have visited, you would have noticed that some websites prefer to ask you from which country you are from before changing the language and others prefer to ask you directly what language you wish to display the website. However, there is also a code that you can insert in a PHP file that will automatically detect the server that is being used by the visitor, and hence apply the changes in the language accordingly.

<?
if (!isset($Language)) {
$Language = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$Language = strtolower(substr(chop($Language[0]),0,2));
}
?>


The web master will have the choice to either redirect the visitor to another webpage that is linked to the website but that corresponds to the visitor’s needs in term of language, else, the webmaster can activate a configuration file that will translate the contents that have been displayed on the original page.

Option 1:


<? else {
header("Location: /index.php?Language=en");
} ?>

Option 2:


<?
include("language-".$Language.".inc.php");
?>
Best answers for « Change the language of your website » in :
Change language on μTorrent Show Change language on μTorrent Install μTorrent. Download the file that contains the μTorrent.lng languages. pack:http://www.utorrent.com/ Place this file in the folder utorrent.lng installation μTorrent....
Change language settings for Amarok under Ubuntu Show Change language settings for Amarok under Ubuntu Amarok is a complete audio playback running on Linux. For more information :Play MP3 files with Amarok If your are using Ubuntu:Ubuntu- Playing MP3 files with Amarok To ...
Keyboard shortcut to change language Show Keyboard shortcut to change language Issue Is there a keyboard shortcut to change language, instead of going through the language menu on the taskbar? Solution Just press Alt + SHIFT simultaneously
Changing language on uTorrent ShowChanging language on uTorrent If in any case it is needed that you want to change language on uTorrent. Download and Install uTorrent: http://www.utorrent.com/downloads Download the file that contains the language...
IPod Change Language ShowiPod Change Language In the case that you accidentally change language an iPod nano (to an unknown language), you can reset the language by following these steps: 1. Press and hold your finger on the Menu button until that time the Main...
How to access Google in your preferred language? ShowHow to access Google in your preferred language? Google is an American corporation with main activity as publishing advertising. To expand its numbers of users on a global scale, Google has extended as a multi-language website enabling you to surf...
Webmastering - Web Languages ShowIntroduction to the Web The term "web" refers to the Internet service that allows users to browse through webpages. The protocol used for this type of communication is HTTP protocol (HyperText Transfer Protocol), which explains why the URLs that...