...

View Full Version : Advice on adding multi language support



graham23s
08-30-2007, 12:00 AM
Hi Guys,

someone has asked me if i can convert a site i did into a multi language one, well a few other languages lol, i never did the site with that in mind so ill need to re-do a fair bit i reckon.

i'm wondering what you guys would suggest would be a way to go about it.

thanks for any input guys

Graham

Inigoesdr
08-30-2007, 01:30 AM
Depends on how big the site is, and how you want to be able to edit the phrases. You could store the language phrases in a file or database, and reference them in the script. If you aren't going to be changing them often or if the site isn't very big it's probably best to use a file to store them.


// lang.en.php
$lang = array();
$lang['register'] = 'Register';
//etc

graham23s
08-30-2007, 10:50 AM
Hi Mate,


$lang = array();
$lang['register'] = 'Register';



its not a very big site to be honest so that looks good, how would i make the switch between languages? plus for the other words would i:


$lang = array();
$lang['register'] = 'Register';
$lang['login'] = 'Login';


etc

thanks mate

Graham

Inigoesdr
08-30-2007, 03:44 PM
You would make individual files for each language. lang.en.php, lang.es.php, etc. When people select a language you set it in a cookie or session and decide which file to use from that. Yes, that's how you add the other words.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum