I18n: Extract and disambiguate a few messages

Extract
- Cycles denoiser enum.
- Extensions user preferences UI.
- Node operator poll message from new node function.

Improve
- Split "(Enabled|Disabled) on startup, overriding the preference."
into two messages.

Disambiguate
- "Add" when describing the action of adding something should use the
  Operator context.
- "Dimensions", in noise textures.
- "Transform" as a noun, the matrix transform type of Geometry Nodes,
  as opposed to the verb to move things in space.
- "Parent" as a noun or verb (the parent of an object, to parent an
  object to another).

Some issues reported by Satoshi Yamasaki, deathblood, and Gabriel Gazzán.

Pull Request: https://projects.blender.org/blender/blender/pulls/122969
This commit is contained in:
Damien Picard
2024-06-13 12:15:55 +02:00
committed by Bastien Montagne
parent 77a69d04f2
commit f87d4e4e40
21 changed files with 106 additions and 47 deletions

View File

@@ -3,6 +3,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
import bpy
from bpy.app.translations import pgettext_tip as tip_
def node_editor_poll(cls, context):
@@ -25,8 +26,9 @@ def node_editor_poll(cls, context):
def node_space_type_poll(cls, context, types):
if context.space_data.tree_type not in types:
tree_types_str = ", ".join(t.split('NodeTree')[0].lower() for t in sorted(types))
cls.poll_message_set("Current node tree type not supported.\n"
"Should be one of " + tree_types_str + ".")
poll_message = tip_("Current node tree type not supported.\n"
"Should be one of {:s}.").format(tree_types_str)
cls.poll_message_set(poll_message)
return False
return True

View File

@@ -2650,8 +2650,8 @@ class BatchRenameAction(bpy.types.PropertyGroup):
)
# Weak, add/remove as properties.
op_add: BoolProperty(name="Add")
op_remove: BoolProperty(name="Remove")
op_add: BoolProperty(name="Add", translation_context=i18n_contexts.operator_default)
op_remove: BoolProperty(name="Remove", translation_context=i18n_contexts.operator_default)
class WM_OT_batch_rename(Operator):

View File

@@ -7,6 +7,7 @@ from bpy.types import Menu
from bl_ui import node_add_menu
from bpy.app.translations import (
pgettext_iface as iface_,
contexts as i18n_contexts,
)
@@ -352,6 +353,7 @@ class NODE_MT_category_shader_group(Menu):
class NODE_MT_shader_node_add_all(Menu):
bl_idname = "NODE_MT_shader_node_add_all"
bl_label = "Add"
bl_translation_context = i18n_contexts.operator_default
def draw(self, _context):
layout = self.layout

View File

@@ -4,6 +4,9 @@
import bpy
from bpy.types import Menu
from bpy.app.translations import (
contexts as i18n_contexts,
)
from bl_ui import node_add_menu
@@ -109,6 +112,7 @@ class NODE_MT_category_texture_group(Menu):
class NODE_MT_texture_node_add_all(Menu):
bl_idname = "NODE_MT_texture_node_add_all"
bl_label = "Add"
bl_translation_context = i18n_contexts.operator_default
def draw(self, _context):
layout = self.layout

View File

@@ -735,11 +735,11 @@ class USERPREF_PT_system_network(SystemPanel, CenterAlignMixIn, Panel):
if system.use_online_access != runtime_online_access:
row = layout.split(factor=0.4)
row.label(text="")
row.label(
text="{:s} on startup, overriding the preference.".format(
"Enabled" if runtime_online_access else "Disabled"
),
)
if runtime_online_access:
text = iface_("Enabled on startup, overriding the preference.")
else:
text = iface_("Disabled on startup, overriding the preference.")
row.label(text=text, translate=False)
class USERPREF_PT_system_memory(SystemPanel, CenterAlignMixIn, Panel):

View File

@@ -1279,7 +1279,7 @@ class VIEW3D_MT_editor_menus(Menu):
if gp_edit:
pass
elif mode_string == 'OBJECT':
layout.menu("VIEW3D_MT_add", text="Add", text_ctxt=i18n_contexts.operator_default)
layout.menu("VIEW3D_MT_add")
elif mode_string == 'EDIT_MESH':
layout.menu("VIEW3D_MT_mesh_add", text="Add", text_ctxt=i18n_contexts.operator_default)
elif mode_string == 'EDIT_CURVE':
@@ -1790,7 +1790,7 @@ class VIEW3D_MT_select_object_more_less(Menu):
layout.separator()
props = layout.operator("object.select_hierarchy", text="Parent")
props = layout.operator("object.select_hierarchy", text="Parent", text_ctxt=i18n_contexts.default)
props.extend = False
props.direction = 'PARENT'
@@ -1849,7 +1849,7 @@ class VIEW3D_MT_select_pose_more_less(Menu):
def draw(self, _context):
layout = self.layout
props = layout.operator("pose.select_hierarchy", text="Parent")
props = layout.operator("pose.select_hierarchy", text="Parent", text_ctxt=i18n_contexts.default)
props.extend = False
props.direction = 'PARENT'
@@ -2269,7 +2269,7 @@ class VIEW3D_MT_select_edit_armature(Menu):
layout.separator()
props = layout.operator("armature.select_hierarchy", text="Parent")
props = layout.operator("armature.select_hierarchy", text="Parent", text_ctxt=i18n_contexts.default)
props.extend = False
props.direction = 'PARENT'
@@ -3318,6 +3318,7 @@ class VIEW3D_MT_object_apply(Menu):
class VIEW3D_MT_object_parent(Menu):
bl_label = "Parent"
bl_translation_context = i18n_contexts.operator_default
def draw(self, _context):
from bl_ui_utils.layout import operator_context
@@ -5774,6 +5775,7 @@ class VIEW3D_MT_edit_armature_names(Menu):
class VIEW3D_MT_edit_armature_parent(Menu):
bl_label = "Parent"
bl_translation_context = i18n_contexts.operator_default
def draw(self, _context):
layout = self.layout
@@ -6183,6 +6185,7 @@ class VIEW3D_MT_edit_greasepencil_point(Menu):
class VIEW3D_MT_edit_curves_add(Menu):
bl_label = "Add"
bl_translation_context = i18n_contexts.operator_default
def draw(self, _context):
layout = self.layout