update_translations.py: a gift to Yann

This commit is contained in:
Nikos Kouremenos 2005-05-31 21:38:46 +00:00
parent dc6541ff7f
commit 79252a65ca
2 changed files with 24 additions and 40 deletions

View File

@ -1,40 +0,0 @@
import os
import sys
def get_output(app, param=None):
if param:
command = app + ' ' + param
else:
command = app
try:
child_stdout = os.popen(command)
except:
print 'Plz relax, and let python do the job. Exiting.. :('
sys.exit()
output = child_stdout.readlines()
child_stdout.close()
return output
def visit(arg, dirname, names):
if dirname.find('.svn') != -1:
return
if dirname.endswith('LC_MESSAGES'):
if 'gajim.po' in names:
path_to_po = os.path.join(dirname, 'gajim.po')
param = '--statistics ' + path_to_po
print path_to_po, 'has:'
get_output('msgfmt', param) # msgfmt doesn't use stdout?!
if __name__ == '__main__':
if len(sys.argv) != 2:
print sys.argv[0], 'po_DIRECTORY'
sys.exit(0)
path_to_dir = sys.argv[1]
os.path.walk(path_to_dir, visit, None)

View File

@ -0,0 +1,24 @@
import os
import sys
def visit(arg, dirname, names):
if dirname.find('.svn') != -1:
return
if dirname.endswith('LC_MESSAGES'):
if 'gajim.po' in names:
path_to_po = os.path.join(dirname, 'gajim.po')
pos = path_to_po.find('po/') + 3 #3 = len('po/')
name = path_to_po[pos:pos+2]
os.system('msgmerge -U ../po/'+name+'/LC_MESSAGES/gajim.po ../gajim.pot')
print name, 'has now:'
os.system('msgfmt --statistics ' + path_to_po)
if __name__ == '__main__':
if os.path.basename(os.getcwd()) != 'scripts':
print 'run me with cwd: scripts'
sys.exit()
os.system('xgettext -k_ -kN_ -o gajim.pot ../src/*.py ../src/common/*.py ../src/msg.c')
path_to_dir = '../po'
os.path.walk(path_to_dir, visit, None)