【发布时间】:2009-09-12 17:29:28
【问题描述】:
在使用 PHP 制作多语言应用程序时,每个人都说gettext 是最好的方法。我只是想知道为什么?
是什么让下面这个方法比使用 gettext 效率低?
<?PHP
//Have seperate language files for each language I add, this would be english file
function lang($phrase){
static $lang = array(
'NO_PHOTO' => 'No photo\'s available',
'NEW_MEMBER' => 'This user is new'
);
return $lang[$phrase];
}
//Then in application where there is text from the site and not from users I would do something like this
echo lang('NO_PHOTO'); // No photo's available would show here
?>
【问题讨论】: