Changeset View
Standalone View
release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
| Show First 20 Lines • Show All 971 Lines • ▼ Show 20 Lines | def dump_messages(do_messages, do_checks, settings): | ||||
| # Get strings from presets. | # Get strings from presets. | ||||
| dump_preset_messages(msgs, reports, settings) | dump_preset_messages(msgs, reports, settings) | ||||
| # Get strings from startup templates. | # Get strings from startup templates. | ||||
| dump_template_messages(msgs, reports, settings) | dump_template_messages(msgs, reports, settings) | ||||
| # Get strings from addons' bl_info. | # Get strings from addons' bl_info. | ||||
| import addon_utils | import addon_utils | ||||
| system_categories = set() | |||||
| for module in addon_utils.modules(): | for module in addon_utils.modules(): | ||||
| # Ignore add-on if it's not a system one (i.e it's user-installed). | |||||
mont29: Would add a comment here to explain a bit more, had to think a bit to understand why you did… | |||||
pioverfourAuthorUnsubmitted Done Inline ActionsI hadn’t considered that actually, I didn’t think there could be categories without add-ons! To me the issue was if an add-on developer decided to mark its support level as OFFICIAL even though it’s not issued by the BF. If the person doing the i18n update installs this add-on, we get irrelevant info. And I noticed the issue with categories below because in the same .po update there is a “MakeHuman” category which, again, doesn’t look really official. I’ll improve the comment. pioverfour: I hadn’t considered that actually, I didn’t think there could be categories without add-ons! To… | |||||
pioverfourAuthorUnsubmitted Done Inline ActionsWait a second, I got mixed up between categories and bl_info. The categories without add-ons are All and User, handled in the elif tip: block below. So maybe the comment you suggested was meant for the next block? Anyway, it was murky, I reworked the logic a bit. pioverfour: Wait a second, I got mixed up between categories and bl_info. The categories without add-ons… | |||||
| if not bpy.path.is_subdir(module.__file__, | |||||
Not Done Inline ActionsWould rephrase this that way: # Only process official add-ons, i.e. those marked as 'OFFICIAL' and # existing in the system add-ons directory (not user-installed ones). mont29: Would rephrase this that way:
```lang=python
# Only process official add-ons, i.e. those marked… | |||||
| bpy.utils.system_resource('SCRIPTS')): | |||||
| continue | |||||
| system_categories.add(module.bl_info['category']) | |||||
| # Ignore add-on if it's not an official one. | |||||
| if module.bl_info['support'] != 'OFFICIAL': | if module.bl_info['support'] != 'OFFICIAL': | ||||
| continue | continue | ||||
Not Done Inline ActionsThis can be removed now then mont29: This can be removed now then | |||||
| dump_addon_bl_info(msgs, reports, module, settings) | dump_addon_bl_info(msgs, reports, module, settings) | ||||
| # Get strings from addons' categories. | # Get strings from addons' categories. | ||||
| for uid, label, tip in bpy.types.WindowManager.addon_filter.keywords['items']( | for uid, label, tip in bpy.types.WindowManager.addon_filter.keywords['items']( | ||||
| bpy.context.window_manager, | bpy.context.window_manager, | ||||
| bpy.context, | bpy.context, | ||||
| ): | ): | ||||
| if label in system_categories: | |||||
| # Ignore add-on if it's not a system one (i.e it's user-installed). | |||||
| 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, label, "Add-ons' categories", reports, None, settings) | ||||
| if tip: | |||||
| process_msg(msgs, settings.DEFAULT_CONTEXT, tip, "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. | # Get strings specific to translations' menu. | ||||
| for lng in settings.LANGUAGES: | for lng in settings.LANGUAGES: | ||||
| process_msg(msgs, settings.DEFAULT_CONTEXT, lng[1], "Languages’ labels from bl_i18n_utils/settings.py", | process_msg(msgs, settings.DEFAULT_CONTEXT, lng[1], "Languages’ labels from bl_i18n_utils/settings.py", | ||||
| reports, None, settings) | reports, None, settings) | ||||
| for cat in settings.LANGUAGES_CATEGORIES: | for cat in settings.LANGUAGES_CATEGORIES: | ||||
| process_msg(msgs, settings.DEFAULT_CONTEXT, cat[1], | process_msg(msgs, settings.DEFAULT_CONTEXT, cat[1], | ||||
| ▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines | |||||
Would add a comment here to explain a bit more, had to think a bit to understand why you did not just use thew OFFICIAL check for this one too. Something like: