Changeset 6317 for trunk/scripts/dev/translations.py
- Timestamp:
- 05/10/06 21:20:16 (3 years ago)
- Files:
-
- 1 modified
-
trunk/scripts/dev/translations.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/scripts/dev/translations.py
r6265 r6317 11 11 update = False 12 12 check = False 13 path_to_dir = '../../po' 13 14 14 def visit(arg, dirname, names): 15 if dirname.find('.svn') != -1: 16 return 17 if dirname.endswith('LC_MESSAGES'): 18 if 'gajim.po' in names: 19 path_to_po = os.path.join(dirname, 'gajim.po') 20 pos = path_to_po.find('po/') + 3 #3 = len('po/') 21 endpos = path_to_po.find('/', pos) 22 name = path_to_po[pos:endpos] 15 def visit(files): 16 for file in files: 17 if file.endswith('.po'): 18 path_to_po = os.path.join(path_to_dir, file) 23 19 if update: # update an existing po file) 24 os.system('msgmerge -q -U ../../po/'+name+'/LC_MESSAGES/gajim.po ../../po/gajim.pot')20 os.system('msgmerge -q -U %s %s' % (path_to_po, os.path.join(path_to_dir, 'gajim.pot'))) 25 21 if stats: 26 print name, 'has now:'22 print file[:-3], 'has now:' 27 23 os.system('msgfmt --statistics ' + path_to_po) 28 24 if check: 29 25 os.system('msgfmt -c ' + path_to_po) 30 else:31 print 'PROBLEM: cannot find gajim.po in', dirname32 26 33 27 def show_help(): … … 53 47 path_to_dir = '../../po' 54 48 49 files = os.listdir(path_to_dir) 55 50 if len(sys.argv) == 2: 56 51 if sys.argv[1].startswith('h'): … … 60 55 if param == 'stats': # stats only 61 56 stats = True 62 os.path.walk(path_to_dir, visit, None)57 visit(files) 63 58 elif param == 'update': # update only 64 59 update_pot() 65 60 update = True 66 os.path.walk(path_to_dir, visit, None) # update each po & no stats61 visit(files) 67 62 print 'Done' 68 63 elif param == 'check': 69 64 check = True 70 os.path.walk(path_to_dir, visit, None)65 visit(files) 71 66 72 67 elif len(sys.argv) == 1: # update & stats & no check … … 74 69 update = True 75 70 stats = True 76 os.path.walk(path_to_dir, visit, None)71 visit(files) 77 72 print 'Done' 78 73
