mirror of
https://github.com/fergalmoran/picard.git
synced 2026-01-06 16:44:06 +00:00
Use pybabel to extract the POT file
This commit is contained in:
@@ -10,7 +10,7 @@ or fetch translations.
|
||||
|
||||
Updating the translation template after adding/removing some strings:
|
||||
|
||||
$ python po/update-pot.py
|
||||
$ pybabel extract picard -o po/picard.pot
|
||||
$ tx push -s
|
||||
|
||||
Fetching latest translations from Transifex:
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import os, shutil
|
||||
|
||||
for name in os.listdir('.'):
|
||||
if name.startswith('picard-') and name.endswith('.po'):
|
||||
newname = name[7:]
|
||||
shutil.move(name, newname)
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import os.path
|
||||
import shutil
|
||||
|
||||
sources = []
|
||||
for root, dirs, files in os.walk(os.path.join('..', 'picard')):
|
||||
for name in files:
|
||||
if name.endswith('.py'):
|
||||
sources.append(os.path.join(root, name))
|
||||
|
||||
cmd = "xgettext --copyright-holder=MusicBrainz " \
|
||||
"--msgid-bugs-address=http://tickets.musicbrainz.org/ " \
|
||||
"--add-comments=TR -L Python -d picard -o picard.pot --keyword=N_ " + \
|
||||
" ".join(sources)
|
||||
|
||||
print cmd
|
||||
os.system(cmd)
|
||||
print
|
||||
|
||||
f = file('picard.pot', 'rt')
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
f = file('picard.pot', 'wt')
|
||||
for line in lines:
|
||||
if line.startswith('#. TR: '):
|
||||
line = '#. ' + line[7:]
|
||||
f.write(line)
|
||||
f.close()
|
||||
|
||||
39
po/update.py
39
po/update.py
@@ -1,39 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import glob
|
||||
import os.path
|
||||
import shutil
|
||||
|
||||
sources = []
|
||||
for root, dirs, files in os.walk(os.path.join('..', 'picard')):
|
||||
for name in files:
|
||||
if name.endswith('.py'):
|
||||
sources.append(os.path.join(root, name))
|
||||
|
||||
cmd = "xgettext --copyright-holder=MusicBrainz " \
|
||||
"--msgid-bugs-address=http://tickets.musicbrainz.org/ " \
|
||||
"--add-comments=TR -L Python -d picard -o picard.pot --keyword=N_ " + \
|
||||
" ".join(sources)
|
||||
|
||||
print cmd
|
||||
os.system(cmd)
|
||||
print
|
||||
|
||||
f = file('picard.pot', 'rt')
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
f = file('picard.pot', 'wt')
|
||||
for line in lines:
|
||||
if line.startswith('#. TR: '):
|
||||
line = '#. ' + line[7:]
|
||||
f.write(line)
|
||||
f.close()
|
||||
|
||||
for po in glob.glob("*.po"):
|
||||
cmd = "msgmerge %s picard.pot -o new.%s" % (po, po)
|
||||
print cmd
|
||||
if os.system(cmd) == 0:
|
||||
print "new.%s.po --> %s" % (po, po)
|
||||
shutil.move("new.%s" % po, po)
|
||||
os.system("msgfmt --statistics -c -v -o %s %s" % (os.devnull, po))
|
||||
print
|
||||
Reference in New Issue
Block a user