Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-02-22 20:29:52 +0300
committerBastien Montagne <bastien@blender.org>2021-02-22 20:32:49 +0300
commit32073993a8fcd235a5c7a2022dcdd7aef8a49687 (patch)
tree41517c1d245871063c487df677d157cd6fb640fc
parent46bdf6d59fc6ee003a575bbcc56516aea03169e7 (diff)
i18n messages extraction script: fix handling of C unicode-escapes.
rB1f5647c07d15 introduced for the first time a unicode escape in strings to be translated, directly extracted from C-code itself. This revealed that this case was not properly handled by current code, for now we work around using `raw_unicode_escape` encoding/decoding of python.
-rw-r--r--release/scripts/modules/bl_i18n_utils/bl_extract_messages.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
index 9e59a245cc4..180f9f0a01c 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -735,7 +735,9 @@ def dump_src_messages(msgs, reports, settings):
_clean_str = re.compile(settings.str_clean_re).finditer
def clean_str(s):
- return "".join(m.group("clean") for m in _clean_str(s))
+ # The encode/decode to/from 'raw_unicode_escape' allows to transform the C-type unicode hexadecimal escapes
+ # (like '\u2715' for the '×' symbol) back into a proper unicode character.
+ return "".join(m.group("clean") for m in _clean_str(s)).encode('raw_unicode_escape').decode('raw_unicode_escape')
def dump_src_file(path, rel_path, msgs, reports, settings):
def process_entry(_msgctxt, _msgid):