You are here

Drupal专业开发指南 第18章 便携式对象文件

g089h515r806 的头像
Submitted by g089h515r806 on 星期二, 2009-08-25 16:14

 

导出我们的English-custom翻译所生成的文件,它的前面几行如下所示:
 
# English-custom translation of Drupal 6
# Copyright (c) 2007 drupalusername <me@example.com>
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2008-05-09 12:46-0500\n"
"PO-Revision-Date: 2008-05-09 12:46-0500\n"
"Last-Translator: drupalusername <me@example.com>\n"
"Language-Team: English-custom <me@example.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
 
#: /example.com/?q=admin/build/translate/search
msgid "Search"
msgstr "Search now"
 
#: /example.com/?q=node/add/blog
msgid "blog"
msgstr "journal"
 
#: /example.com/?q=admin/build/modules/list/confirm
msgid "Blog entry"
msgstr "Journal entry"
 
#: /example.com/?q=admin/build/translate/search
msgid ""
"A <em>blog entry</em> is a single post to an online journal, or "
"<em>blog</em>."
msgstr "A <em>journal entry</em> is a single post to an online journal."
...
 
    .po文件包含两部分,头部为一些元数据,后面跟着翻译了的字符串。每个字符串包含3部分:1个注释,说明了字符串第一次出现的位置;一个msgid,表示原始字符串;一个msgstr,表示翻译了的字符串。关于.po文件格式的更全面的描述,参看http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files
    使用“管理➤站点构建➤翻译界面”中的导入标签,现在就可以将en-US.po文件导入到另一个Drupal站点中了(该站点也启用了本地模块)。
 

老葛的Drupal培训班 Think in Drupal

Drupal版本: