我正在用我的 Drupal 6 内容类型尝试 i18n,并且字段值被翻译好,但不是字段标签。
有没有办法翻译这个?
很抱歉重新打开此线程,如果有人来到这里寻找为Drupal 7翻译字段标签的方法,请阅读下文。
在 Drupal 7 中,template_preprocess_field()
引入了核心功能。在我们的 template.php 文件中使用它,我们可以通过一个t()
函数传递每个字段标签。
/**
* Implements template_preprocess_field().
*/
function THEMENAME_preprocess_field(&$vars, $hook) {
// Check to make sure there's a label and it's visible.
if(isset($vars['label']) && $vars['label_hidden'] === FALSE)
{
$vars['label'] = t($vars['label']);
}
}