diff options
Diffstat (limited to 'release/scripts/modules/bl_i18n_utils')
10 files changed, 50 insertions, 61 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/__init__.py b/release/scripts/modules/bl_i18n_utils/__init__.py index b07a993c12e..d4af1270369 100644 --- a/release/scripts/modules/bl_i18n_utils/__init__.py +++ b/release/scripts/modules/bl_i18n_utils/__init__.py @@ -1,5 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - """Package for translation (i18n) tools.""" 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 604a577eec9..bfc111dd3c1 100644 --- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Populate a template file (POT format currently) from Blender RNA/py/C data. # XXX: This script is meant to be used from inside Blender! # You should not directly use this script, rather use update_msg.py! @@ -805,20 +803,21 @@ def dump_src_messages(msgs, reports, settings): line += data[pos:m.start()].count('\n') msgsrc = rel_path + ":" + str(line) _msgid = d.get("msg_raw") - # First, try the "multi-contexts" stuff! - _msgctxts = tuple(d.get("ctxt_raw{}".format(i)) for i in range(settings.PYGETTEXT_MAX_MULTI_CTXT)) - if _msgctxts[0]: - for _msgctxt in _msgctxts: - if not _msgctxt: - break + if _msgid not in {'""', "''"}: + # First, try the "multi-contexts" stuff! + _msgctxts = tuple(d.get("ctxt_raw{}".format(i)) for i in range(settings.PYGETTEXT_MAX_MULTI_CTXT)) + if _msgctxts[0]: + for _msgctxt in _msgctxts: + if not _msgctxt: + break + msgctxt, msgid = process_entry(_msgctxt, _msgid) + process_msg(msgs, msgctxt, msgid, msgsrc, reports, check_ctxt_src, settings) + reports["src_messages"].append((msgctxt, msgid, msgsrc)) + else: + _msgctxt = d.get("ctxt_raw") msgctxt, msgid = process_entry(_msgctxt, _msgid) process_msg(msgs, msgctxt, msgid, msgsrc, reports, check_ctxt_src, settings) reports["src_messages"].append((msgctxt, msgid, msgsrc)) - else: - _msgctxt = d.get("ctxt_raw") - msgctxt, msgid = process_entry(_msgctxt, _msgid) - process_msg(msgs, msgctxt, msgid, msgsrc, reports, check_ctxt_src, settings) - reports["src_messages"].append((msgctxt, msgid, msgsrc)) pos = m.end() line += data[m.start():pos].count('\n') @@ -963,7 +962,12 @@ def dump_addon_messages(module_name, do_checks, settings): # and make the diff! for key in minus_msgs: if key != settings.PO_HEADER_KEY: - del msgs[key] + if key in msgs: + del msgs[key] + else: + # This should not happen, but some messages seem to have + # leaked on add-on unregister and register? + print(f"Key not found in msgs: {key}") if check_ctxt: _diff_check_ctxt(check_ctxt, minus_check_ctxt) diff --git a/release/scripts/modules/bl_i18n_utils/merge_po.py b/release/scripts/modules/bl_i18n_utils/merge_po.py index d048f8f5c42..3cc5046fe3c 100755 --- a/release/scripts/modules/bl_i18n_utils/merge_po.py +++ b/release/scripts/modules/bl_i18n_utils/merge_po.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Merge one or more .po files into the first dest one. # If a msgkey is present in more than one merged po, the one in the first file wins, unless # it’s marked as fuzzy and one later is not. diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py index 57722d06ce5..3b69f8a6bf7 100644 --- a/release/scripts/modules/bl_i18n_utils/settings.py +++ b/release/scripts/modules/bl_i18n_utils/settings.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Global settings used by all scripts in this dir. # XXX Before any use of the tools in this dir, please make a copy of this file # named "setting.py" @@ -58,7 +56,7 @@ LANGUAGES = ( (21, "Arabic (ﺔﻴﺑﺮﻌﻟﺍ)", "ar_EG"), (22, "Bulgarian (Български)", "bg_BG"), (23, "Greek (Ελληνικά)", "el_GR"), - (24, "Korean (한국 언어)", "ko_KR"), + (24, "Korean (한국어)", "ko_KR"), (25, "Nepali (नेपाली)", "ne_NP"), # Using the utf8 flipped form of Persian (فارسی). (26, "Persian (ﯽﺳﺭﺎﻓ)", "fa_IR"), @@ -250,9 +248,14 @@ PYGETTEXT_KEYWORDS = (() + tuple(("{}\\((?:[^\"',]+,){{3}}\\s*" + _msg_re + r"\s*\)").format(it) for it in ("BMO_error_raise",)) + - tuple(("{}\\((?:[^\"',]+,)\\s*" + _msg_re + r"\s*(?:\)|,)").format(it) + tuple(("{}\\((?:[^\"',]+,){{2}}\\s*" + _msg_re + r"\s*(?:\)|,)").format(it) for it in ("BKE_modifier_set_error",)) + + # This one is a tad more risky, but in practice would not expect a name/uid string parameter + # (the second one in those functions) to ever have a comma in it, so think this is fine. + tuple(("{}\\((?:[^,]+,){{2}}\\s*" + _msg_re + r"\s*(?:\)|,)").format(it) + for it in ("modifier_subpanel_register", "gpencil_modifier_subpanel_register")) + + # bUnitDef unit names. # 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 @@ -299,6 +302,7 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = { "ascii", "author", # Addons' field. :/ "bItasc", + "blender.org", "color_index is invalid", "cos(A)", "cosh(A)", @@ -314,6 +318,7 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = { "glTF 2.0 (.glb/.gltf)", "glTF Binary (.glb)", "glTF Embedded (.gltf)", + "glTF Original PBR data", "glTF Separate (.gltf + .bin + textures)", "invoke() needs to be called before execute()", "iScale", @@ -332,6 +337,7 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = { "mp3", "normal", "ogg", + "oneAPI", "p0", "px", "re", @@ -342,6 +348,8 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = { "sinh(A)", "sqrt(x*x+y*y+z*z)", "sRGB", + "sRGB display space", + "sRGB display space with Filmic view transform", "tan(A)", "tanh(A)", "utf-8", @@ -358,7 +366,9 @@ WARN_MSGID_NOT_CAPITALIZED_ALLOWED = { "all and invert unselected", "and AMD driver version 22.10 or newer", "and AMD Radeon Pro 21.Q4 driver or newer", + "and Linux driver version xx.xx.28000 or newer", "and NVIDIA driver version 470 or newer", + "and Windows driver version 101.1660 or newer", "available with", "brown fox", "can't save image while rendering", @@ -433,6 +443,7 @@ WARN_MSGID_END_POINT_ALLOWED = { "The program will now close.", "Your graphics card or driver has limited support. It may work, but with issues.", "Your graphics card or driver is not supported.", + "Invalid surface UVs on %d curves.", } PARSER_CACHE_HASH = 'sha1' diff --git a/release/scripts/modules/bl_i18n_utils/settings_user.py b/release/scripts/modules/bl_i18n_utils/settings_user.py index a7aa8a80af8..3c29a0d743a 100644 --- a/release/scripts/modules/bl_i18n_utils/settings_user.py +++ b/release/scripts/modules/bl_i18n_utils/settings_user.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import os import settings diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py index ec5465549b3..324c3ea261d 100644 --- a/release/scripts/modules/bl_i18n_utils/utils.py +++ b/release/scripts/modules/bl_i18n_utils/utils.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Some misc utilities... import collections @@ -156,7 +154,7 @@ def get_po_files_from_dir(root_dir, langs=set()): else: continue if uid in found_uids: - printf("WARNING! {} id has been found more than once! only first one has been loaded!".format(uid)) + print("WARNING! {} id has been found more than once! only first one has been loaded!".format(uid)) continue found_uids.add(uid) yield uid, po_file @@ -1242,8 +1240,8 @@ class I18n: return os.path.join(os.path.dirname(path), uid + ".po") elif kind == 'PY': if not path.endswith(".py"): - if self.src.get(self.settings.PARSER_PY_ID): - return self.src[self.settings.PARSER_PY_ID] + if os.path.isdir(path): + return os.path.join(path, "translations.py") return os.path.join(os.path.dirname(path), "translations.py") return path @@ -1394,15 +1392,15 @@ class I18n: if langs set is void, all languages found are loaded. """ default_context = self.settings.DEFAULT_CONTEXT - self.src[self.settings.PARSER_PY_ID], msgs = self.check_py_module_has_translations(src, self.settings) + self.py_file, msgs = self.check_py_module_has_translations(src, self.settings) if msgs is None: - self.src[self.settings.PARSER_PY_ID] = src + self.py_file = src msgs = () for key, (sources, gen_comments), *translations in msgs: if self.settings.PARSER_TEMPLATE_ID not in self.trans: self.trans[self.settings.PARSER_TEMPLATE_ID] = I18nMessages(self.settings.PARSER_TEMPLATE_ID, settings=self.settings) - self.src[self.settings.PARSER_TEMPLATE_ID] = self.src[self.settings.PARSER_PY_ID] + self.src[self.settings.PARSER_TEMPLATE_ID] = self.py_file if key in self.trans[self.settings.PARSER_TEMPLATE_ID].msgs: print("ERROR! key {} is defined more than once! Skipping re-definitions!") continue @@ -1418,7 +1416,7 @@ class I18n: for uid, msgstr, (is_fuzzy, user_comments) in translations: if uid not in self.trans: self.trans[uid] = I18nMessages(uid, settings=self.settings) - self.src[uid] = self.src[self.settings.PARSER_PY_ID] + self.src[uid] = self.py_file comment_lines = [self.settings.PO_COMMENT_PREFIX + c for c in user_comments] + common_comment_lines self.trans[uid].msgs[key] = I18nMessage(ctxt, [key[1]], [msgstr], comment_lines, False, is_fuzzy, settings=self.settings) @@ -1481,7 +1479,7 @@ class I18n: if langs: translations &= langs translations = [('"' + lng + '"', " " * (len(lng) + 6), self.trans[lng]) for lng in sorted(translations)] - print(k for k in keys.keys()) + print(*(k for k in keys.keys())) for key in keys.keys(): if ref.msgs[key].is_commented: continue @@ -1567,25 +1565,9 @@ class I18n: # We completely replace the text found between start and end markers... txt = _gen_py(self, langs) else: - printf("Creating python file {} containing translations.".format(dst)) + print("Creating python file {} containing translations.".format(dst)) txt = [ - "# ***** BEGIN GPL LICENSE BLOCK *****", - "#", - "# This program is free software; you can redistribute it and/or", - "# modify it under the terms of the GNU General Public License", - "# as published by the Free Software Foundation; either version 2", - "# of the License, or (at your option) any later version.", - "#", - "# This program is distributed in the hope that it will be useful,", - "# but WITHOUT ANY WARRANTY; without even the implied warranty of", - "# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", - "# GNU General Public License for more details.", - "#", - "# You should have received a copy of the GNU General Public License", - "# along with this program; if not, write to the Free Software Foundation,", - "# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.", - "#", - "# ***** END GPL LICENSE BLOCK *****", + "# SPDX-License-Identifier: GPL-2.0-or-later", "", self.settings.PARSER_PY_MARKER_BEGIN, "", diff --git a/release/scripts/modules/bl_i18n_utils/utils_cli.py b/release/scripts/modules/bl_i18n_utils/utils_cli.py index dd75ac11ac4..4b00816d132 100644 --- a/release/scripts/modules/bl_i18n_utils/utils_cli.py +++ b/release/scripts/modules/bl_i18n_utils/utils_cli.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Some useful operations from utils' I18nMessages class exposed as a CLI. import os diff --git a/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py b/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py index da4183d457c..833c46a732e 100755 --- a/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py +++ b/release/scripts/modules/bl_i18n_utils/utils_languages_menu.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Update "languages" text file used by Blender at runtime to build translations menu. diff --git a/release/scripts/modules/bl_i18n_utils/utils_rtl.py b/release/scripts/modules/bl_i18n_utils/utils_rtl.py index beec2659df8..6e3d25cfc3f 100755 --- a/release/scripts/modules/bl_i18n_utils/utils_rtl.py +++ b/release/scripts/modules/bl_i18n_utils/utils_rtl.py @@ -1,8 +1,6 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - # Pre-process right-to-left languages. # You can use it either standalone, or through import_po_from_branches or # update_trunk. diff --git a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py index f9208bbe3ee..462c954d54a 100644 --- a/release/scripts/modules/bl_i18n_utils/utils_spell_check.py +++ b/release/scripts/modules/bl_i18n_utils/utils_spell_check.py @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-or-later -# <pep8 compliant> - import enchant import os import pickle @@ -435,6 +433,7 @@ class SpellChecker: "polyline", "polylines", "probabilistically", "pulldown", "pulldowns", + "quadratically", "quantized", "quartic", "quaternion", "quaternions", @@ -503,6 +502,7 @@ class SpellChecker: "luminance", "mantaflow", "matcap", + "microfacet", "midtones", "mipmap", "mipmaps", "mip", "ngon", "ngons", @@ -510,6 +510,7 @@ class SpellChecker: "nurb", "nurbs", "perlin", "phong", + "photorealistic", "pinlight", "posterize", "qi", @@ -677,7 +678,7 @@ class SpellChecker: "ascii", "atrac", "avx", - "bsdf", + "bsdf", "bsdfs", "bssrdf", "bw", "ccd", @@ -710,14 +711,17 @@ class SpellChecker: "hdc", "hdr", "hdri", "hdris", "hh", "mm", "ss", "ff", # hh:mm:ss:ff timecode + "hpg", # Intel Xe-HPG architecture "hsv", "hsva", "hsl", "id", "ies", "ior", "itu", "jonswap", + "lfe", "lhs", "lmb", "mmb", "rmb", + "lscm", "kb", "mocap", "msgid", "msgids", |