Browse Source

extract QML translation strings, convert to gettext and combine with

rest of template
Sander van Grieken 3 years ago
parent
commit
000a3de571
  1. 26
      contrib/pull_locale

26
contrib/pull_locale

@ -25,10 +25,34 @@ print("Found {} files to translate".format(len(files.splitlines())))
# Generate fresh translation template # Generate fresh translation template
if not os.path.exists('electrum/locale'): if not os.path.exists('electrum/locale'):
os.mkdir('electrum/locale') os.mkdir('electrum/locale')
cmd = 'xgettext -s --from-code UTF-8 --language Python --no-wrap -f app.fil --output=electrum/locale/messages.pot' cmd = 'xgettext -s --from-code UTF-8 --language Python --no-wrap -f app.fil --output=messages.pot'
print('Generate template') print('Generate template')
os.system(cmd) os.system(cmd)
# add QML translations
cmd = "find electrum/gui/qml -type f -name '*.qml'"
files = subprocess.check_output(cmd, shell=True)
with open("qml.lst", "wb") as f:
f.write(files)
print("Found {} QML files to translate".format(len(files.splitlines())))
cmd = "lupdate @qml.lst -ts qml.ts"
print('Collecting strings')
os.system(cmd)
cmd = "lconvert -of po -o qml.pot qml.ts"
print('Convert to gettext')
os.system(cmd)
cmd = "msgcat -u -o electrum/locale/messages.pot messages.pot qml.pot"
print('Generate template')
os.system(cmd)
os.chdir('electrum') os.chdir('electrum')
crowdin_identifier = 'electrum' crowdin_identifier = 'electrum'

Loading…
Cancel
Save