2

翻訳テンプレートを作成および/または更新できる特定の API 呼び出し (文書化されていない可能性があります。ここには記載されていませんhttp://docs.waf.googlecode.com/git/apidocs_16/tools/intltool.html ) はありますか?

または、ネイティブ システム ツールを使用する必要がありますか?

4

1 に答える 1

2

どちらも見つからなかったので、メインの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

于 2013-03-12T16:31:52.453 に答える