2010-02-24 79 views

回答

2

对不起,重新打开这个线程,如果有人土地在这里寻找一种方式来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']); 
    } 

}