个人工具
登录
查看“Zope3宝典/国际化软件包”的源代码 - Ubuntu中文
页面
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“Zope3宝典/国际化软件包”的源代码
来自Ubuntu中文
←
Zope3宝典/国际化软件包
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
=== 18.5 Step V: Extracting Translatable Strings(18.5 步骤 V:提取翻译字符串) === Zope provides a very powerful extraction tool to grab all translatable text strings from Python, Page Template and ZCML files. With each translatable string, the file and line number is recorded and later added as comment in the message catalog template file.<br>Zope 提供了一个非常强大的提取工具来获取所有来自Python、页面模板、ZCML文件的可翻译文本字符串。在message目录模板文件里,就每个可翻译的字符串以注释记录了文件和行号。 After all strings were collected and duplicates merged into single entries, the tool saves the strings in a message catalog template file called <domain>.pot. This is the beginning of localization. From now on we are only concerned about using the template to create translations.<br> 收集所有的字符串并且把副本并入各自的条目,工具在名叫<domain>.pot的message目录模板文件里保存了字符串。这才是本地化的开始,从现在开始我们唯一需要关心的就是用模板创建翻译。 The extraction tool, called i18nextract.py, can be found in ZOPE3/utilities. Before executing the tool, add your Zope 3 source directory to the PYTHONPATH, so that all necessary modules are found. In bash the PYTHONPATH can be set using<br> i18nextract.py就是系统中的提取工具,您可以在ZOPE3/utilities里发现它,在运行该工具之前,为了发现所有必须的模块,把您的Zope 3 源目录加入到PYTHONPATH。具体做法如下: <pre><nowiki> 1 export PYTHONPATH=$PYTHONOATH:ZOPE3/src </nowiki></pre> To execute the tool, go to the messageboard directory and enter the following command. Make sure that you entered the absolute path for ZOPE3, since the tool does not work well with symlinks.<br> 运行工具,在messageboard目录里输入如下命令。由于该工具不能很好的以symlinks工作,因此您需要确认您输入ZOPE3的绝对路径。 <pre><nowiki> 1 python ZOPE3/utilities/i18nextract.py -d messageboard -p ./ -o ./locales </nowiki></pre> This will extract all translatable strings from the message board package and store the template file as messageboard/locales/messageboard.pot.<br> 这将从留言簿软件包中提取所有的可翻译字符串并且把messageboard/locales/messageboard.pot当作存储模板文件。 As you can see, the tool supports three options plus an help option:<br>正如您所看到的,可以通过帮助查看该工具的三个附加选项: * -h/--help - Print the help of the i18nextract.py tool on the screen and exit.<br>-h/--help - 获取帮助 * -d/--domain<domain> - This option specifies the domain, in our case messageboard, that is supposed to be extracted.<br>-d/--domain<domain> -指定域 * -p/--path<path> - The path specifies the package by path that is searched for translatable strings. In our case we just used ./, since we already were in the package.<br>-p/--path<path> - 指定路径. * -odir - This option specifies a directory, relative to the package in which to put the output translation template, which is commonly ./locales in add-on packages.<br>-odir - 指定目录 If you wish to update the Zope 3 core message catalog template file, you simply run the extraction tool without specifying any options.<br> 如果您希望更新Zope 3核心的message目录模板文件,您需要在不指定任何附加参数的情况下运行该提取工具。
返回至
Zope3宝典/国际化软件包
。