Multilingual pages
So you want to create a page (website) that is accessible on different languages ? In this tutorial we will make a page available for russian and english visitors.

There are some several ways you can choose to implement this.
1.) You can make a simple gateway ('splash') page and users will have to click on the link that represents the chosen language.
2.) You can ask users to choose the language and store this information as a cookie on the browser so they only have to set the language once.
3.) You can read HTTP request data sent by the browser to find the local language preference of the client machine.
It is obvious the th
ir
d method is more convenient for the users because they don't need to do something, it is all done automatically.
So here we go to the coding. When the web server receives the HTTP request it sets value for the $HTTP_ACCEPT_LANGUAGE predefined variable. This variable contains the language set by operation system or by the user in the browser configuration settings.


All we have to do is to check the value of that variable and then output the page:
Code:
$pos = strpos($HTTP_ACCEPT_LANGUAGE, "ru");

if ($pos === false) {

include('russian_page.html" title="Phrase: html">html');

}

else{

include('english_page.html" title="Phrase: html">html');

}
Take a look at '===' symbols. It is identical check which means two value should be equal and of the same type to generate TRUE. So the code shown above will show russian version of the page if there is 'ru' substring in the HTTP_ACCEPT_LANGUAGE and it will output english page otherwise.

Unfortunately not all browsers correctly use language options but be sure that Internet Explorer (versions 4+) will do everything right. It is still recommended to include a link to switch language manually somewhere on your page. After user clicks on this link you should use cookies to store the chosen language on the client side.