不使用 Locale模块本地化Drupal

众所周知,在Drupal中要本地化,需要首先开启Locale模块,然后添加中文语言支持,再将中文包导入。其实还有一个很隐秘的地方可以放置翻译字符 串,它在settings.php中。看下面的代码:
/**
* String overrides:
*
* To override specific strings on your site with or without enabling locale
* module, add an entry to this list. This functionality allows you to change
* a small number of your site's default English language interface strings.
*
* Remove the leading hash signs to enable.
*/
# $conf['locale_custom_strings_en'] = array(
# 'forum' => 'Discussion board',
# '@count min' => '@count minutes',
# );
如果你只需要翻译Drupal网站中的少部分字符串,那么就不需要开启Locale模块,再导入翻译包那样费劲了。在 settings.php中,可以添加一些翻译字符串,Drupal在显示字符串时,会首先用这里面的字符串去进行替换。这样会省去很大一部分的资源消 耗。比如:
$conf['locale_custom_strings_zh-hans'] = array(
'forum' => '讨论组',
'@count min' => '@count 分钟',
);
有 两点需要注意:
  1. 要翻译中文,需要使用locale_custom_strings_zh-hans
  2. 要将 settings.php存为utf-8格式
via:http://doctor-fang.blogspot.com/2009/04/localedrupal.html