-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Alexander Todorov wrote:
Sending again. Sent to local lang list by mistake.
Hello,
can some msgmerge guru help with the following situation:
I have a RHEL5 po file with untranslated strings which are translated in F8/F9
po files for the same package. How can I grab only the translated stuff (without
the new strings) and merge them with the RHEL5 po file?
Any ideas are welcome before I sit down and start writing a script.
I don't want to copy&paste strings but I'd like to re-use the work done by
other
translators.
The following seems to work
#!/usr/bin/env python
######################################################################################
# replace all untranslated strings in old_file with their translations from new_file
######################################################################################
import sys
sys.path.append('/home/alexx/temp/polib-0.3.1')
#
http://code.google.com/p/polib/
import polib
old_file='/home/alexx/temp/anaconda/anaconda.rhel5-branch.bg.po'
new_file='/home/alexx/temp/anaconda/anaconda.f8-branch.bg.po'
save_file='/home/alexx/temp/anaconda/translated.po'
old_po = polib.pofile(old_file)
tr_po = polib.pofile(old_file)
new_po = polib.pofile(new_file)
new_entries={}
for e in new_po:
new_entries[e.msgid] = e
for u in old_po.untranslated_entries():
if new_entries.has_key(u.msgid):
tr_po[old_po.index(u)] = new_entries[u.msgid]
tr_po.save(save_file)
print "OLD: %d percent translated" % old_po.percent_translated()
print "UPD: %d percent translated" % tr_po.percent_translated()
Thanks,
Alexander.
_______________________________________________
Fedora-trans-bg mailing list
Fedora-trans-bg(a)redhat.com
https://www.redhat.com/mailman/listinfo/fedora-trans-bg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Red Hat -
http://enigmail.mozdev.org
iD8DBQFHztjEhmd3WOiFct4RCuqcAJ4x4lv9hAo9SSlp0xH6JtuzjAZH2wCgmQh7
Wd26uegsBGfrKS/zfVB95BI=
=aoAb
-----END PGP SIGNATURE-----