Skip to content

Commit 56f6936

Browse files
committed
Merge #13374: utils and libraries: checking for bitcoin address in translations
85f0135 utils: checking for bitcoin addresses in translations (Max Kaplan) Pull request description: Closes #13363 Tree-SHA512: 8509b4ab004139942c847b93d7b44096a13df8e429dd05459b430a1cf7eaef16c4906ab9dc854f4e635312e1ebb064cfab1bad97fec914c7e926c83ad45cc99b
2 parents 121cbaa + 85f0135 commit 56f6936

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

contrib/devtools/update-translations.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
LOCALE_DIR = 'src/qt/locale'
3131
# Minimum number of messages for translation to be considered at all
3232
MIN_NUM_MESSAGES = 10
33+
# Regexp to check for Bitcoin addresses
34+
ADDRESS_REGEXP = re.compile('([13]|bc1)[a-zA-Z0-9]{30,}')
3335

3436
def check_at_repository_root():
3537
if not os.path.exists('.git'):
@@ -122,6 +124,12 @@ def escape_cdata(text):
122124
text = text.replace('"', '"')
123125
return text
124126

127+
def contains_bitcoin_addr(text, errors):
128+
if text != None and ADDRESS_REGEXP.search(text) != None:
129+
errors.append('Translation "%s" contains a bitcoin address. This will be removed.' % (text))
130+
return True
131+
return False
132+
125133
def postprocess_translations(reduce_diff_hacks=False):
126134
print('Checking and postprocessing...')
127135

@@ -160,7 +168,7 @@ def postprocess_translations(reduce_diff_hacks=False):
160168
if translation is None:
161169
continue
162170
errors = []
163-
valid = check_format_specifiers(source, translation, errors, numerus)
171+
valid = check_format_specifiers(source, translation, errors, numerus) and not contains_bitcoin_addr(translation, errors)
164172

165173
for error in errors:
166174
print('%s: %s' % (filename, error))

0 commit comments

Comments
 (0)