translation - waf - 更新并生成翻译 pot 文件

标签 translation waf

是否有特定的 API 调用(可能未记录,此处未列出 http://docs.waf.googlecode.com/git/apidocs_16/tools/intltool.html )允许我创建和/或更新翻译模板?

或者我需要使用 native 系统工具吗?

最佳答案

我也找不到,所以我在主 wsript 文件中引入了一个选项。

opt.add_option('--update-po',                action='store_true', default=False, dest='update_po', help='Update localization files')
// ...
def shutdown(self):
    if Options.options.update_po:
        os.chdir('./po')
        try:
            try:
                size_old = os.stat (APPNAME + '.pot').st_size
            except:
                size_old = 0
            subprocess.call (['intltool-update', '-p', '-g', APPNAME])
            size_new = os.stat (APPNAME + '.pot').st_size
            if size_new <> size_old:
                Logs.info("Updated po template.")
                try:
                    command = 'intltool-update -r -g %s' % APPNAME
                    self.exec_command (command)
                    Logs.info("Updated translations.")
                except:
                    Logs.error("Failed to update translations.")
        except:
            traceback.print_exc(file=open("errlog.txt","a"))
            Logs.error("Failed to generate po template.")
            Logs.errors("Make sure intltool is installed.")
        os.chdir ('..')

不幸的是我还没有时间把它变成一个工具。在我的名单上。但您可以在这里找到完整的示例:https://bazaar.launchpad.net/~diodon-team/diodon/trunk/view/head:/wscript

关于translation - waf - 更新并生成翻译 pot 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15055337/

相关文章:

python - 字符串不会在 Django 中使用 Python 2.7 中可用的格式函数进行翻译

c - 在 waf 中,如何定义对来自另一个子目录的生成 header 的依赖

c - 将 pg_config 与 waf 一起使用

node.js - 在 ubuntu 12.04- "Project not configured (run ' waf configure' first 上安装 node.js 时出错)“

c++ - mupdf - 在链接规范中无效使用 'static'

module - 使用 waf 构建 fortran 库,安装 .mod 文件

php - 如何自动提取字符串进行翻译?

python - Django 翻译无法正常工作并显示反式标签

rotation - "Mirroring"具有处理功能的 PShape 对象(旋转/平移问题)

machine-learning - 神经网络会在不同的运行时间翻译成同一个句子吗?我可以在运行时收到很多翻译的句子吗?