Merge new translations when updating the .pot.

This commit is contained in:
Marco Pesenti Gritti 2007-06-26 10:43:49 +02:00
parent f85142bdc4
commit 2b463a2013

View File

@ -190,20 +190,29 @@ def cmd_genpot(bundle_name, manifest):
for file_name in file_list: for file_name in file_list:
if file_name.endswith('.py'): if file_name.endswith('.py'):
python_files.append(file_name) python_files.append(file_name)
service_name = Bundle(_get_source_path()).get_service_name()
args = ["xgettext", "--language=Python", "--keyword=_", pot_file = os.path.join('po', '%s.pot' % bundle_name)
"--output=po/%s.pot" % bundle_name] args = [ 'xgettext', '--language=Python',
'--keyword=_', '--output=%s' % pot_file ]
args += python_files args += python_files
retcode = subprocess.call(args) retcode = subprocess.call(args)
if retcode: if retcode:
print 'ERROR - xgettext failed with return code %i.' % retcode print 'ERROR - xgettext failed with return code %i.' % retcode
po_regex = re.compile("po/.*\.po$")
for file_name in _get_file_list(manifest):
if po_regex.match(file_name):
args = [ 'msgmerge', '-U', file_name, pot_file ]
retcode = subprocess.call(args)
if retcode:
print 'ERROR - msgmerge failed with return code %i.' % retcode
def cmd_genmo(bundle_name, manifest): def cmd_genmo(bundle_name, manifest):
source_path = _get_source_path() source_path = _get_source_path()
po_regex = re.compile("po/(.*)\.po$") po_regex = re.compile("po/(.*)\.po$")
file_list = _get_file_list(manifest) for file_name in _get_file_list(manifest):
for file_name in file_list:
match = po_regex.match(file_name) match = po_regex.match(file_name)
if match: if match:
lang = match.group(1) lang = match.group(1)