[Bf-blender-cvs] [8b485e72260] master: I18n: ignore user-installed add-ons when extracting bl_info

Damien Picard noreply at git.blender.org
Thu Oct 6 10:28:38 CEST 2022


Commit: 8b485e72260fa1903e6cfe82fdabe9bf45e90886
Author: Damien Picard
Date:   Thu Oct 6 10:28:18 2022 +0200
Branches: master
https://developer.blender.org/rB8b485e72260fa1903e6cfe82fdabe9bf45e90886

I18n: ignore user-installed add-ons when extracting bl_info

Since add-on info was made translatable in D15747, user-installed
add-ons could also get their info extracted. This led to having
different messages depending on the environment of the Blender doing
the I18n messages update.

Reviewed By: mont29

Differential Revision: https://developer.blender.org/D15963

===================================================================

M	release/scripts/modules/bl_i18n_utils/bl_extract_messages.py

===================================================================

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 21ca38bff20..18a41d86322 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -978,17 +978,30 @@ def dump_messages(do_messages, do_checks, settings):
     # Get strings from addons' bl_info.
     import addon_utils
     for module in addon_utils.modules():
-        if module.bl_info['support'] != 'OFFICIAL':
+        # Only process official add-ons, i.e. those marked as 'OFFICIAL' and
+        # existing in the system add-ons directory (not user-installed ones).
+        if (module.bl_info['support'] != 'OFFICIAL'
+                or not bpy.path.is_subdir(module.__file__, bpy.utils.system_resource('SCRIPTS'))):
             continue
         dump_addon_bl_info(msgs, reports, module, settings)
 
     # Get strings from addons' categories.
+    system_categories = set()
+    for module in addon_utils.modules():
+        if bpy.path.is_subdir(module.__file__, bpy.utils.system_resource('SCRIPTS')):
+            system_categories.add(module.bl_info['category'])
     for uid, label, tip in bpy.types.WindowManager.addon_filter.keywords['items'](
             bpy.context.window_manager,
             bpy.context,
     ):
-        process_msg(msgs, settings.DEFAULT_CONTEXT, label, "Add-ons' categories", reports, None, settings)
-        if tip:
+        if label in system_categories:
+            # Only process add-on if it a system one (i.e shipped with Blender). Also,
+            # we do want to translate official categories, even if they have no official add-ons,
+            # hence the different test than below.
+            process_msg(msgs, settings.DEFAULT_CONTEXT, label, "Add-ons' categories", reports, None, settings)
+        elif tip:
+            # Only special categories get a tip (All and User).
+            process_msg(msgs, settings.DEFAULT_CONTEXT, label, "Add-ons' categories", reports, None, settings)
             process_msg(msgs, settings.DEFAULT_CONTEXT, tip, "Add-ons' categories", reports, None, settings)
 
     # Get strings specific to translations' menu.



More information about the Bf-blender-cvs mailing list