我正在使用 CentOS 5.5 Linux(没有 X)、PHP 5.3 和 Drupal 7.0。
我网站的核心语言是俄语(不是英语)!
我创建了一个 游戏信息 和以下 游戏模块 为首页生成 3 个 block :
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 文件中。
我需要创建名为 的第三个文件吗?游戏.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 - 如何为自定义 Drupal 7 模块生成翻译文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5231496/