做一个drupal项目,需要中文后台.用views bulk operation(VBO)来搭建后台内容管理.结果发现有个内容翻译汉化.无奈,只有看源码了,发现没有写在t函数里面,自然翻译不聊了.思索之后,稍作修改,即可翻译.记录如下:
function theme_views_bulk_operations_select_all_row($view, $colspan, $selection) {
$clear_selection = t('Clear selection');
$select_label = t('Select all items:');
$this_page = t('on this page only');
$all_pages = t('across all pages');
$this_page_checked = $selection['selectall'] ? '' : ' checked';
$all_pages_checked = $selection['selectall'] ? ' checked' : '';
$output = <<<EOF
{$selection['selected']}
items selected
.
$select_label
$this_page
$all_pages
EOF;
return array(array('data' => $output, 'class' => 'views-field views-field-select-all', 'colspan' => $colspan));
}
这个函数,改为如下:
function theme_views_bulk_operations_select_all_row($view, $colspan, $selection) {
$clear_selection = t('Clear selection');
$select_label = t('Select all items:');
$this_page = t('on this page only');
$all_pages = t('across all pages');
$selected_items =
t('items selected');
$this_page_checked = $selection['selectall'] ? '' : ' checked';
$all_pages_checked = $selection['selectall'] ? ' checked' : '';
$output = <<<EOF
{$selection['selected']}
{$selected_items}.
$select_label
$this_page
$all_pages
EOF;
return array(array('data' => $output, 'class' => 'views-field views-field-select-all', 'colspan' => $colspan));
} 差别在加粗部分,自己体会.哈哈