Advertisement
Guest User

Fetch and compile zh_CN locale for Sugar Glucose

a guest
Mar 16th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. #!/usr/bin/env python2
  2.  
  3. import os.path
  4. import subprocess
  5.  
  6.  
  7. ZIP_FILE = "sugar-locale.zip"
  8.  
  9. def download():
  10.     subprocess.call([ "wget",
  11.                       "http://translate.sugarlabs.org/zh_CN/glucose/export/zip",
  12.                       "-O", "sugar-locale.zip" ])
  13.    
  14. def unpack():
  15.     subprocess.call([ "unzip", ZIP_FILE ])
  16.    
  17. def compile_po():
  18.     for po in os.listdir('.'):
  19.         if not po.endswith(".po"):
  20.             continue
  21.    
  22.         mo = po.replace(".po", ".mo")
  23.         subprocess.call([ "msgfmt", "-o", mo, po ])
  24.  
  25.    
  26. if __name__ == '__main__':
  27.     download()
  28.  
  29.     unpack()
  30.  
  31.     compile_po()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement