aboutsummaryrefslogtreecommitdiff
path: root/contrib/devtools
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-12-02 14:28:35 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2015-12-02 14:28:35 +0100
commit93236c0455ded01f1af5d28f8be0801120a18ff2 (patch)
tree6db545b7080da05b404b3477c74fcf9172b05fdc /contrib/devtools
parent83f06ca937366bea5190705d1f6d7871e5bd110c (diff)
qt: Final translation update before 0.12 fork
- Add new translations (finally, after a long time) - update-translation script was not considering new translations - oops - fixed this, also remove (nearly) empty translations - Update translation process, it was still describing the old repository structure
Diffstat (limited to 'contrib/devtools')
-rwxr-xr-xcontrib/devtools/update-translations.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/contrib/devtools/update-translations.py b/contrib/devtools/update-translations.py
index f955e4a1f2..ea209eec7e 100755
--- a/contrib/devtools/update-translations.py
+++ b/contrib/devtools/update-translations.py
@@ -29,6 +29,8 @@ TX = 'tx'
SOURCE_LANG = 'bitcoin_en.ts'
# Directory with locale files
LOCALE_DIR = 'src/qt/locale'
+# Minimum number of messages for translation to be considered at all
+MIN_NUM_MESSAGES = 10
def check_at_repository_root():
if not os.path.exists('.git'):
@@ -37,7 +39,7 @@ def check_at_repository_root():
exit(1)
def fetch_all_translations():
- if subprocess.call([TX, 'pull', '-f']):
+ if subprocess.call([TX, 'pull', '-f', '-a']):
print('Error while fetching translations', file=sys.stderr)
exit(1)
@@ -166,6 +168,15 @@ def postprocess_translations(reduce_diff_hacks=False):
if translation_node.get('type') == 'unfinished':
context.remove(message)
+ # check if document is (virtually) empty, and remove it if so
+ num_messages = 0
+ for context in root.findall('context'):
+ for message in context.findall('message'):
+ num_messages += 1
+ if num_messages < MIN_NUM_MESSAGES:
+ print('Removing %s, as it contains only %i messages' % (filepath, num_messages))
+ continue
+
# write fixed-up tree
# if diff reduction requested, replace some XML to 'sanitize' to qt formatting
if reduce_diff_hacks: