函数_()实际上是gettext模组的 ugettext方法别名。将程序中出现的字符串输出改为 _()调用。例如,在模板文件中:
<tr>
<th>Account</th>
<th>Repository</th>
<th>Modules</th>
</tr>
修改为
<tr>
<th>${_("Account")}</th>
<th>${_("Repository")}</th>
<th>${_("Modules")}</th>
</tr>
控制器代码中:
def get_auth_path(self, repos=None, type=None, path=None):
..
msg += 'id[0]="%s";' % '...'
msg += 'name[0]="%s";\n' % "Please choose..."
修改为:
def get_auth_path(self, repos=None, type=None, path=None):
..
msg += 'id[0]="%s";' % '...'
msg += 'name[0]="%s";\n' % _("Please choose...")
Copyright © 2006 WorldHello 开放文档之源 计划 |