2015-12-29 11:30:14 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
2019-07-27 17:09:34 +00:00
|
|
|
import os, glob, subprocess
|
2015-12-29 11:30:14 +02:00
|
|
|
|
2023-10-19 15:24:41 +03:00
|
|
|
components = ('core', 'dbus', 'gui', 'network', 'plugins', 'svg', 'test', 'uitools', 'xml')
|
2015-12-29 11:30:14 +02:00
|
|
|
cfiles = []
|
|
|
|
tfiles = []
|
|
|
|
|
|
|
|
def list_files(sdir):
|
2016-01-09 12:55:18 +02:00
|
|
|
lfiles = []
|
2015-12-29 11:30:14 +02:00
|
|
|
for root, subdirs, files in os.walk(sdir):
|
|
|
|
for sfile in files:
|
2016-01-12 23:09:40 +02:00
|
|
|
if sfile.endswith(('.cpp', '.h', '.js', '.qs', '.qml', '.ui')):
|
2016-01-09 12:55:18 +02:00
|
|
|
lfiles.append('%s/%s' % (root, sfile))
|
|
|
|
return lfiles
|
2015-12-29 11:30:14 +02:00
|
|
|
|
|
|
|
for c in components:
|
2016-01-11 17:42:52 +02:00
|
|
|
cfiles.extend(list_files('src/%s' % c))
|
2015-12-29 11:30:14 +02:00
|
|
|
|
2016-10-25 02:47:12 +00:00
|
|
|
for t in glob.glob('src/tools/*'):
|
|
|
|
tfiles.extend(list_files(t))
|
2015-12-29 11:30:14 +02:00
|
|
|
|
2020-11-27 23:38:20 +00:00
|
|
|
qtcommand = ['xgettext', '--from-code=UTF-8', '-o', 'translations/qt.pot',
|
|
|
|
'-kQT_TR_NOOP:1', '-kQT_TR_NOOP_UTF8:1',
|
|
|
|
'-kQT_TRANSLATE_NOOP:1c,2','-kQT_TRANSLATE_NOOP_UTF8:1c,2',
|
2020-11-28 19:16:51 +00:00
|
|
|
'-ktranslate:1c,2', '-ktr:1', '-ktrUtf8:1']
|
2020-11-27 23:38:20 +00:00
|
|
|
qtcommand.extend(cfiles)
|
|
|
|
subprocess.check_call(qtcommand)
|
|
|
|
|
|
|
|
qttoolscommand = ['xgettext', '--from-code=UTF-8', '-o', 'translations/qt_tools.pot',
|
|
|
|
'-kQT_TR_NOOP:1', '-kQT_TR_NOOP_UTF8:1',
|
|
|
|
'-kQT_TRANSLATE_NOOP:1c,2','-kQT_TRANSLATE_NOOP_UTF8:1c,2',
|
2020-11-28 19:16:51 +00:00
|
|
|
'-ktranslate:1c,2', '-ktr:1', '-ktrUtf8:1']
|
2020-11-27 23:38:20 +00:00
|
|
|
qttoolscommand.extend(tfiles)
|
|
|
|
subprocess.check_call(qttoolscommand)
|
|
|
|
|
|
|
|
for t in glob.glob('translations/*.po'):
|
|
|
|
potfile = 'translations/qt.pot'
|
2020-11-28 19:16:51 +00:00
|
|
|
if 'qt_tools' in t:
|
2020-11-27 23:38:20 +00:00
|
|
|
potfile = 'translations/qt_tools.pot'
|
|
|
|
subprocess.check_call(['msgmerge', '--verbose', '--update', t, potfile])
|
|
|
|
subprocess.check_call(['msgattrib', '--no-fuzzy', '--no-obsolete', t, '-o', t])
|