【发布时间】:2011-07-11 00:43:57
【问题描述】:
我使用的是 CentOS 5.5 Linux(没有 X)、PHP 5.3 和 Drupal 7.0。
我网站的核心语言是俄语(不是英语)!
我创建了一个 game.info 和以下 game.module,它们为首页生成 3 个块:
function game_block_info() {
return array(
'game_main' => array(
'info' => t('Set FlashVars and show the flash game.'),
'cache' => DRUPAL_NO_CACHE,
),
'game_winner' => array(
'info' => t('Show the winner of the last week.'),
'cache' => DRUPAL_NO_CACHE,
),
'game_leader' => array(
'info' => t('Show the leader of the current week.'),
'cache' => DRUPAL_NO_CACHE,
);
}
function game_block_view($block_name = '') {
global $user;
if ($block_name == 'game_main') {
if (user_is_logged_in()) {
$content = t('User is logged in.');
} else {
$content = t('User is an anonymous user.');
}
drupal_set_message("<pre>$output</pre>\n");
return array(
'subject' => t('Main Game'),
'content' => $content,
);
} else if ($block_name == 'game_winner') {
....
} else if ($block_name == 'game_leader') {
....
}
}
它工作正常,但我需要所有字符串都是俄语,并且不想将它们硬编码到我的 game.module 文件中。
我是否需要创建名为 game.po 的第三个文件并将其添加到 game.info 中?
如何创建 .po 文件?如果可能的话,我更喜欢对该文件进行简单的编辑,不要使用晦涩的工具。
我也试过一个工具:
# xgettext -n game/game.module --keyword=t
xgettext: warning: file `game/game.module' extension `module' is unknown; will try C
game/game.module:87: warning: unterminated character constant
game/game.module:100: warning: unterminated character constant
【问题讨论】:
标签: drupal localization internationalization gettext drupal-7