the PHPNuke (Portal software used all over the world, http://phpnuke.org/)
code uses selectable including of php files containing define statements;

in a directory call language (usually) there are files named lang-xxxx.php
where xxxx is the name of the language;

the current language selection is stored in each users session such that;

$lang = $_SESSION["lang"];                                      // ie; $lang
= "english"
include_once("language/lang-".$lang.".php");            // ie;
"language/lang-english.php"

The included files contain define statements (defines are global constants
and can't be accidentally updated by your code, I believe)

define("_INPUTUSERID","Input User ID");
define("_PASSWORD","Password");

the french included file (language/lang-french.php) might look like;

define("_INPUTUSERID","Eenpoot OOsair ahDee");
define("_PASSWORD","Paas voord");                       // ok, so I flunked
french

You get the idea; then you need to go thru each html form and change every
instance of text that appears on the form to a reference to one of these
global values;

echo "<table><tr><td><font class=content>"._INPUTUSERID."<br>"
    ."<input type=text name=fuser></font></td></tr>\n"
    ."<tr><td><font class=content>"._PASSWORD."<br>"
    ."<input type=password name=fpswd></font></td></tr></table>;

Using the features of the language instead of a db access, means that the
only time it takes to setup for each language is the time it takes to load
and process the source include.  I suspect this may be faster, has anyone
timed other approaches?

Note that this does not translate the data stored in your database, nor does
it translate things coming from other sources such as directories,
filenames, etc.  When you provide both french and english input forms, you
are likely to have some data stored in your database in french and some in
english, potentially resulting in english forms with french data (and visa
versa) on your website.

hope this helps, 

Warren Vail


-----Original Message-----
From: julien dufourcq [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 05, 2004 12:24 PM
To: [EMAIL PROTECTED]
Subject: [PHP] multilingual website


hi,

i'm looking here for some help with the design of a multilingual website.
Everything in that website needs to change from a language to an other.

I've made search on the web to find some examples but i couldn't find very 
interesting things about how to manage that, using php.
What's best ?
- Use a database and make a querry for each text i have to put on my pages?
- Use an xml file for each language and parse it to get my text?
- Use a .php file with a variable for each item i have on my website?

Or is there an other possibility?

Thanks for your help.

Julien
[EMAIL PROTECTED]

_________________________________________________________________
MSN Search, le moteur de recherche qui pense comme vous !  
http://search.msn.fr

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to