Show
Ignore:
Timestamp:
05/31/06 21:49:24 (3 years ago)
Author:
dkirov
Message:

merge r6317, r6325

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/gajim_0.10/scripts/dev/translations.py

    r6407 r6408  
    1111update = False 
    1212check = False 
     13path_to_dir = '../../po' 
    1314 
    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] 
     15def visit(files): 
     16        for file in files: 
     17                if file.endswith('.po'): 
     18                        path_to_po = os.path.join(path_to_dir, file) 
    2319                        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'))) 
    2521                        if stats: 
    26                                 print name, 'has now:' 
     22                                print file[:-3], 'has now:' 
    2723                                os.system('msgfmt --statistics ' + path_to_po) 
    2824                        if check: 
    2925                                os.system('msgfmt -c ' + path_to_po) 
    30                 else: 
    31                         print 'PROBLEM: cannot find gajim.po in', dirname 
    3226 
    3327def show_help(): 
     
    5347        path_to_dir = '../../po' 
    5448 
     49        files = os.listdir(path_to_dir) 
    5550        if len(sys.argv) == 2: 
    5651                if sys.argv[1].startswith('h'): 
     
    6055                if param == 'stats': # stats only 
    6156                        stats = True 
    62                         os.path.walk(path_to_dir, visit, None) 
     57                        visit(files) 
    6358                elif param == 'update': # update only 
    6459                        update_pot() 
    6560                        update = True 
    66                         os.path.walk(path_to_dir, visit, None) # update each po & no stats 
     61                        visit(files) 
    6762                        print 'Done' 
    6863                elif param == 'check': 
    6964                        check = True 
    70                         os.path.walk(path_to_dir, visit, None) 
     65                        visit(files) 
    7166 
    7267        elif len(sys.argv) == 1: # update & stats & no check 
     
    7469                update = True 
    7570                stats = True 
    76                 os.path.walk(path_to_dir, visit, None) 
     71                visit(files) 
    7772                print 'Done' 
    7873