【问题标题】:waf - update and generate translation pot filewaf - 更新并生成翻译pot文件
【发布时间】:2013-03-13 00:31:52
【问题描述】:

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

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

【问题讨论】:

    标签: translation waf


    【解决方案1】:

    我也找不到,所以我在我的主 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

    【讨论】:

    • 其实一个工具会很棒,如果你推它,也许它仍然可以潜入1.8.0
    • 我会看看我能做什么。我不能保证我是否会找到时间。
    猜你喜欢
    • 1970-01-01
    • 2011-05-02
    • 1970-01-01
    • 1970-01-01
    • 2015-11-25
    • 2018-12-30
    • 1970-01-01
    • 1970-01-01
    • 2016-05-14
    相关资源
    最近更新 更多