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:
authorDamien Picard <pioverfour>2022-10-06 11:28:18 +0300
committerBastien Montagne <bastien@blender.org>2022-10-06 11:28:18 +0300
commit8b485e72260fa1903e6cfe82fdabe9bf45e90886 (patch)
tree41e853d929063c25ac89d36c8b2e49afea21e0e9 /release
parent247af8cf5ba4e75a05e6929a4c85569503e92733 (diff)
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
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/bl_i18n_utils/bl_extract_messages.py19
1 files changed, 16 insertions, 3 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 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.