diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-06-08 16:53:49 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-06-08 16:53:53 +0200 |
commit | 56f69360dc98bd68704f19646a84d045788d199e (patch) | |
tree | dfd23b185d15a4116885a62549713dd7f590fd54 /contrib | |
parent | 121cbaacc28eeea4b04ab79233bf4d3a0c399a63 (diff) | |
parent | 85f0135eaefe3d9f696689a7e83606c579da40a8 (diff) |
Merge #13374: utils and libraries: checking for bitcoin address in translations
85f0135eaefe3d9f696689a7e83606c579da40a8 utils: checking for bitcoin addresses in translations (Max Kaplan)
Pull request description:
Closes #13363
Tree-SHA512: 8509b4ab004139942c847b93d7b44096a13df8e429dd05459b430a1cf7eaef16c4906ab9dc854f4e635312e1ebb064cfab1bad97fec914c7e926c83ad45cc99b
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/devtools/update-translations.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/contrib/devtools/update-translations.py b/contrib/devtools/update-translations.py index b36e6968bf..f0098cfcdf 100755 --- a/contrib/devtools/update-translations.py +++ b/contrib/devtools/update-translations.py @@ -30,6 +30,8 @@ SOURCE_LANG = 'bitcoin_en.ts' LOCALE_DIR = 'src/qt/locale' # Minimum number of messages for translation to be considered at all MIN_NUM_MESSAGES = 10 +# Regexp to check for Bitcoin addresses +ADDRESS_REGEXP = re.compile('([13]|bc1)[a-zA-Z0-9]{30,}') def check_at_repository_root(): if not os.path.exists('.git'): @@ -122,6 +124,12 @@ def escape_cdata(text): text = text.replace('"', '"') return text +def contains_bitcoin_addr(text, errors): + if text != None and ADDRESS_REGEXP.search(text) != None: + errors.append('Translation "%s" contains a bitcoin address. This will be removed.' % (text)) + return True + return False + def postprocess_translations(reduce_diff_hacks=False): print('Checking and postprocessing...') @@ -160,7 +168,7 @@ def postprocess_translations(reduce_diff_hacks=False): if translation is None: continue errors = [] - valid = check_format_specifiers(source, translation, errors, numerus) + valid = check_format_specifiers(source, translation, errors, numerus) and not contains_bitcoin_addr(translation, errors) for error in errors: print('%s: %s' % (filename, error)) |