fix: Python 3 issue on re (#13230)
Python 3 interprets string literals as Unicode strings, and therefore \s and \g are treated as escaped Unicode characters. Fix: Declare RegEx pattern as a raw string instead by prepending r
This commit is contained in:
parent
ad5778275d
commit
e8d79030f7
1 changed files with 1 additions and 1 deletions
|
|
@ -650,7 +650,7 @@ def write_csv_file(path, app_messages, lang_dict):
|
||||||
|
|
||||||
t = lang_dict.get(message, '')
|
t = lang_dict.get(message, '')
|
||||||
# strip whitespaces
|
# strip whitespaces
|
||||||
translated_string = re.sub('{\s?([0-9]+)\s?}', "{\g<1>}", t)
|
translated_string = re.sub(r'{\s?([0-9]+)\s?}', r"{\g<1>}", t)
|
||||||
if translated_string:
|
if translated_string:
|
||||||
w.writerow([message, translated_string, context])
|
w.writerow([message, translated_string, context])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue