View Single Post
  #2 (permalink)  
Old 08-11-05, 02:01 AM
dennispopel dennispopel is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 263
Thanks: 0
Thanked 0 Times in 0 Posts
Hello,

Looks like your site will have million pages Don't worry, just store messages in one include file like

<?
$m = array(
'en' => array('welcome'=>'Welcome!'),
'es' => array('welcome'=>'Hola!'));
...
?>

and require it on every request, then just use <?=$m[$_SESSION['lang']]['welcome']?> in the pages to display localized messages.

You could also make multiple message files like en.msg or es.msg and require them based on the value of the sesison variable.

You easily cannot preload messages on the PHP startup so they stay in memory and are available for subsequent requests.
__________________
onPHP5.com - PHP5: Articles, News, Tutorials, Interviews, Software and more
Reply With Quote