2009-08-22, 03:21:49
I've been looking into this, and I sort of like the way phpBB does there i18n. It seems easy enough to implement:
Have a language file that has an array with constants with their values.
then in the page itself, you just call that variable like this:
what does everyone this of this approach? I've seen a few other apps do it this way as well...
Have a language file that has an array with constants with their values.
Code:
$lang = array(
'ABOUT_USER' => 'Profile',
'ACTIVE_IN_FORUM' => 'Most active forum',
'ACTIVE_IN_TOPIC' => 'Most active topic',
'ADD_FOE' => 'Add foe',
'ADD_FRIEND' => 'Add friend',
'AFTER' => 'After',
...
then in the page itself, you just call that variable like this:
Code:
<p><?php echo $lang['ABOUT_USER'];</p>
what does everyone this of this approach? I've seen a few other apps do it this way as well...