utils/wl_trs_translate.py
Avoid deeply nested control flow statements. Open
Open
for lang, trs in TRS_LANGS.items():
# Language names
if tr == lang:
tr = trs[0]
# Encoding names
Avoid deeply nested control flow statements. Open
Open
if any((text in tr for text in [])):
# Flag translation as unfinished to be reviewed manually
unfinished = True
Avoid deeply nested control flow statements. Open
Open
if tr_raw != tr:
# Do not replace parentheses in file type filters
if element_src.text not in TRS_FILE_TYPES:
# Parentheses
tr = re.sub(r'\s*\(', r'(', tr)
Avoid deeply nested control flow statements. Open
Open
for encoding, trs in TRS_ENCODINGS.items():
if encoding in tr:
tr = tr.replace(encoding, trs[0])
break
Avoid deeply nested control flow statements. Open
Open
for item, trs in TRS_MISC.items():
if tr == item:
tr = trs[0]
break
Avoid deeply nested control flow statements. Open
Open
for file_type, trs in TRS_FILE_TYPES.items():
if tr == file_type:
tr = trs[0]
break
Avoid deeply nested control flow statements. Open
Open
for util, trs in TRS_NLP_UTILS.items():
# Only replace language util names after language names or at the end of text
if f' - {util}' in tr or tr.endswith(util):
if f' - {util}' in tr:
tr = tr.replace(f' - {util}', f' - {trs[0]}', 1)