2013-02-24 14 views

回答

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

+0

其實一個工具會很棒,也許它可以潛入到1.8.0如果你推它 – drahnr 2013-03-12 18:49:18

+0

我會看看我能做什麼。不能承諾,但我是否會找到時間。 – 2013-03-13 10:45:42