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:
authorBastien Montagne <montagne29@wanadoo.fr>2019-03-31 19:49:11 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-03-31 19:49:11 +0300
commita4869df4c9d27279b44171d12cdece8989aaf255 (patch)
tree795a0f0a092f18a2017b139c484bd07d8eb6953c /release
parent79c178b0156045a54974dea10b7cf59426c8762c (diff)
I18n messages extraction: add 'generic' handling of Tools.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/bl_i18n_utils/bl_extract_messages.py33
1 files changed, 33 insertions, 0 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 d552638850c..9ea19da2160 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -351,6 +351,35 @@ def dump_rna_messages(msgs, reports, settings, verbose=False):
process_msg(msgs, default_context, item.description, msgsrc, reports, check_ctxt_rna_tip,
settings)
+ def walk_tools_definitions(cls):
+ from bl_ui.space_toolsystem_common import ToolDef
+
+ bl_rna = cls.bl_rna
+ op_default_context = bpy.app.translations.contexts.operator_default
+
+ def process_tooldef(tool_context, tool):
+ if not isinstance(tool, ToolDef):
+ if callable(tool):
+ for t in tool(None):
+ process_tooldef(tool_context, t)
+ return
+ msgsrc = "bpy.types.{} Tools: '{}', '{}'".format(bl_rna.identifier, tool_context, tool.idname)
+ if tool.label:
+ process_msg(msgs, op_default_context, tool.label, msgsrc, reports, check_ctxt_rna, settings)
+ # Callable (function) descriptions must handle their translations themselves.
+ if tool.description and not callable(tool.description):
+ process_msg(msgs, default_context, tool.description, msgsrc, reports, check_ctxt_rna_tip, settings)
+
+ for tool_context, tools_defs in cls.tools_all():
+ for tools_group in tools_defs:
+ if tools_group is None:
+ continue
+ elif isinstance(tools_group, tuple) and not isinstance(tools_group, ToolDef):
+ for tool in tools_group:
+ process_tooldef(tool_context, tool)
+ else:
+ process_tooldef(tool_context, tools_group)
+
blacklist_rna_class = class_blacklist()
def walk_class(cls):
@@ -373,6 +402,10 @@ def dump_rna_messages(msgs, reports, settings, verbose=False):
if hasattr(bl_rna, 'bl_label') and bl_rna.bl_label:
process_msg(msgs, msgctxt, bl_rna.bl_label, msgsrc, reports, check_ctxt_rna, settings)
+ # Tools Panels definitions.
+ if hasattr(bl_rna, 'tools_all') and bl_rna.tools_all:
+ walk_tools_definitions(cls)
+
walk_properties(cls)
def walk_keymap_hierarchy(hier, msgsrc_prev):