Webmaster Forum  

Go Back   Webmaster Forum > Website Design Forum > Website Design Forum
User Name
Password
Register FAQ Members List Calendar Transactions Store Search Today's Posts Mark Forums Read


multilingual web site

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-05-2005, 13:20
italks
Member


Join Date: Oct 2005
Posts: 51
Trader Rating: (0)
Points: 0 (Donate)
5 F$/Referral Refer Friends
italks is on a distinguished road
Default multilingual web site

Can be helpful sometimes.

If you're looking to code a multilingue website, this is a technique i used in many solutions, specially for text that is inside a php code.


<?php
/**
* index.php
* multilingual website
* lang/index.fr.php French translation
* lang/index.en.php English translation
*
* @author Hatem <hatem@php.net>
* @version 1.1.0 27 février 2002
*/

/**
* Detect and include language
*/
session_start();

if(!isset($lang)) {
$lang = getenv('HTTP_ACCEPT_LANGUAGE');
$lang_default = "en";
}

if (is_file("lang/index.$lang.php"))
{
$_SESSION["lang"] = $lang;
include("lang/index.$lang.php");
} else {
$_SESSION["lang"] = $lang_default;
include("lang/index.$lang_default.php");
}


/**
* Then code your website here
*/
echo _HELLO_;

echo "\n"._INFO_;
?>

<?php
/**
* lang/index.en.php
*/
define("_HELLO_", "Hello");
define("_INFO_", "This web site support english and french");

?>

<?php
/**
* lang/index.fr.php
*/
define("_HELLO_", "Salut");
define("_INFO_", "Ce site web supporte l'anglais et le français");
?>
italks is offline
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Resources : | Advertise at FHF | itextLink.com| Reseller Hosting| TextDot| iNamePros| Any Webmaster| Web Host| Dep3| cheap low cost web hosting reviews|


All times are GMT -4. The time now is 13:30.


Powered by: vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.