Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
| Show First 20 Lines • Show All 564 Lines • ▼ Show 20 Lines | def dump_py_messages_from_files(msgs, reports, files, settings): | ||||
| def _op_to_ctxt(node): | def _op_to_ctxt(node): | ||||
| # Some smart coders like things like: | # Some smart coders like things like: | ||||
| # >>> row.operator("preferences.addon_disable" if is_enabled else "preferences.addon_enable", ...) | # >>> row.operator("preferences.addon_disable" if is_enabled else "preferences.addon_enable", ...) | ||||
| # We only take first arg into account here! | # We only take first arg into account here! | ||||
| bag = extract_strings_split(node) | bag = extract_strings_split(node) | ||||
| opname, _ = bag[0] | opname, _ = bag[0] | ||||
| if not opname: | if not opname: | ||||
| return i18n_contexts.default | return i18n_contexts.operator_default | ||||
| op = bpy.ops | op = bpy.ops | ||||
| for n in opname.split('.'): | for n in opname.split('.'): | ||||
| op = getattr(op, n) | op = getattr(op, n) | ||||
| try: | try: | ||||
| return op.get_rna_type().translation_context | return op.get_rna_type().translation_context | ||||
| except Exception as e: | except Exception as e: | ||||
| default_op_context = i18n_contexts.operator_default | default_op_context = i18n_contexts.operator_default | ||||
| print("ERROR: ", str(e)) | print("ERROR: ", str(e)) | ||||
| ▲ Show 20 Lines • Show All 543 Lines • Show Last 20 Lines | |||||