The best way to do it definitely is:

make several files with an array like:

file: lang.eng.inc:

        $dict = Array();
        $dict['name'] = 'Name';
        $dict['button']['red'] = 'Red Button';


file: lang.ita.inc:

        $dict = Array();
        $dict['name'] = 'il nome';
        $dict['button']['red'] = 'il bottone rosso';


file: lang.spa.inc:

        $dict = Array();
        $dict['name'] = 'nombre';
        $dict['button']['red'] = 'er botone roso';


file: lang.rus.inc:

        $dict = Array();
        $dict['name'] = 'Imya';
        $dict['button']['red'] = 'Krassnaya knopka';


file: lang.jap.inc:

        $dict = Array();
        $dict['name'] = 'Onamae';
        $dict['button']['red'] = 'Aka no battonu';



and so on... and so on...



then, in your scripts before any output (no, not a rule, just otherwise
makes few sense)...

1. ... include a config file where the language is set.
oh well, you can use any way you wish, cookies, sessions, get variables,
whatever, as long as you can set a language of preference to the script.

2. include "lang.$lang.inc";

3. In case you need something within a function or class just define
variable $dict as global.


Hare we go.
This is the less resource consuming way, all you need is to set the language
prefence correctly and work on keeping track of it.


any code?
Hmm, you could try to look into applications like phpmyadmin or Jinnie...
but the difference here is, most of these doing a little mistake - they
create a bunch of new variables for every phrase. Better do it with an
array.




Sincerely,

 Maxim Maletsky
 Founder, Chief Developer

 PHPBeginner.com (Where PHP Begins)
 [EMAIL PROTECTED]
 www.phpbeginner.com









-----Original Message-----
From: Inércia Sensorial [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 15, 2001 12:04 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Multiple languages


  Hi All,

  I want to enable multiple languages on one of my scripts, so
administrators or visitors can choose in what language they want to browse
the site. I have seen a few ways to do it, like with switch, define or
querying databases.

  But, considering performance, what is the best way to make a script with
multiple languages?

  Thanks for any ideas.


--

  Julio Nobrega.

You're asking me will my love grow, I don't know.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to