diff options
author | Damien Picard <pioverfour> | 2022-10-05 18:57:46 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-10-05 18:58:50 +0300 |
commit | fd48f1b505c37e99567233de1b7eb53fb9e5cb20 (patch) | |
tree | a878e7c1015d9ede949f73121bc336c60da0cdf1 /release | |
parent | f5d67f3fdf2ddec073898bc60feeb2440f2c1b30 (diff) |
I18n: improve unit extraction regex
There were two issues with the unit extraction regex:
- it didn't take the inches, feet, arcminutes and arcseconds symbols
into accounts, which aren’t letters but ' and ";
- some units have more than one B_UNIT_DEF_* flag.
This allows extracting feet, inches, square millimeters, cubic
millimeters, arcminutes, and arcseconds.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D16144
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/bl_i18n_utils/settings.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py index a8a3ed9f4b7..95de2abc709 100644 --- a/release/scripts/modules/bl_i18n_utils/settings.py +++ b/release/scripts/modules/bl_i18n_utils/settings.py @@ -260,9 +260,9 @@ PYGETTEXT_KEYWORDS = (() + # NOTE: regex is a bit more complex than it would need too. Since the actual # identifier (`B_UNIT_DEF_`) is at the end, if it's simpler/too general it # becomes extremely slow to process some (unrelated) source files. - ((r"\{(?:(?:\s*\"[^\"',]+\"\s*,)|(?:\s*NULL\s*,)){4}\s*" + + ((r"\{(?:(?:\s*\"[^\",]+\"\s*,)|(?:\s*\"\\\"\",)|(?:\s*NULL\s*,)){4}\s*" + _msg_re + r"\s*,(?:(?:\s*\"[^\"',]+\"\s*,)|(?:\s*NULL\s*,))(?:[^,]+,){2}" - + "\s*B_UNIT_DEF_[_A-Z]+\s*\}"),) + + + "(?:\|?\s*B_UNIT_DEF_[_A-Z]+\s*)+\}"),) + tuple((r"{}\(\s*" + _msg_re + r"\s*,\s*(?:" + r"\s*,\s*)?(?:".join(_ctxt_re_gen(i) for i in range(PYGETTEXT_MAX_MULTI_CTXT)) + r")?\s*\)").format(it) |