I18n Disambiguation: "Add" in menu labels.

This one is usually a verb/action one in menus' labels,
hence we give it the Operator default context.

Part of T43295.
This commit is contained in:
Bastien Montagne 2019-05-13 17:27:40 +02:00
parent 9ed8f8a968
commit 6ec096facf
5 changed files with 20 additions and 9 deletions

@ -19,11 +19,13 @@
# <pep8-80 compliant>
from bpy.types import Menu
from bpy.app.translations import contexts as i18n_contexts
class MASK_MT_add(Menu):
bl_idname = "MASK_MT_add"
bl_label = "Add"
bl_translation_context = i18n_contexts.operator_default
def draw(self, _context):
layout = self.layout

@ -19,6 +19,7 @@
# <pep8 compliant>
from bpy.types import Header, Menu, Panel
from bpy.app.translations import contexts as i18n_contexts
from .space_dopesheet import (
DopesheetFilterPopoverBase,
dopesheet_filter,
@ -197,6 +198,7 @@ class NLA_MT_edit(Menu):
class NLA_MT_add(Menu):
bl_label = "Add"
bl_translation_context = i18n_contexts.operator_default
def draw(self, _context):
layout = self.layout

@ -21,6 +21,7 @@ import bpy
import nodeitems_utils
from bpy.types import Header, Menu, Panel
from bpy.app.translations import pgettext_iface as iface_
from bpy.app.translations import contexts as i18n_contexts
from bl_ui.utils import PresetPanel
from .properties_grease_pencil_common import (
AnnotationDataPanel,
@ -190,6 +191,7 @@ class NODE_MT_editor_menus(Menu):
class NODE_MT_add(bpy.types.Menu):
bl_space_type = 'NODE_EDITOR'
bl_label = "Add"
bl_translation_context = i18n_contexts.operator_default
def draw(self, context):
layout = self.layout

@ -19,6 +19,7 @@
# <pep8 compliant>
import bpy
from bpy.types import Header, Menu, Panel
from bpy.app.translations import contexts as i18n_contexts
from rna_prop_ui import PropertyPanel
from .properties_grease_pencil_common import (
AnnotationDataPanel,
@ -356,6 +357,7 @@ class SEQUENCER_MT_frame(Menu):
class SEQUENCER_MT_add(Menu):
bl_label = "Add"
bl_translation_context = i18n_contexts.operator_default
def draw(self, context):

@ -33,6 +33,7 @@ from .properties_grease_pencil_common import (
)
from bpy.app.translations import contexts as i18n_contexts
class VIEW3D_HT_tool_header(Header):
bl_space_type = 'VIEW_3D'
bl_region_type = "TOOL_HEADER"
@ -693,17 +694,17 @@ class VIEW3D_MT_editor_menus(Menu):
if gp_edit:
pass
elif mode_string == 'OBJECT':
layout.menu("VIEW3D_MT_add", text="Add")
layout.menu("VIEW3D_MT_add", text="Add", text_ctxt=i18n_contexts.operator_default)
elif mode_string == 'EDIT_MESH':
layout.menu("VIEW3D_MT_mesh_add", text="Add")
layout.menu("VIEW3D_MT_mesh_add", text="Add", text_ctxt=i18n_contexts.operator_default)
elif mode_string == 'EDIT_CURVE':
layout.menu("VIEW3D_MT_curve_add", text="Add")
layout.menu("VIEW3D_MT_curve_add", text="Add", text_ctxt=i18n_contexts.operator_default)
elif mode_string == 'EDIT_SURFACE':
layout.menu("VIEW3D_MT_surface_add", text="Add")
layout.menu("VIEW3D_MT_surface_add", text="Add", text_ctxt=i18n_contexts.operator_default)
elif mode_string == 'EDIT_METABALL':
layout.menu("VIEW3D_MT_metaball_add", text="Add")
layout.menu("VIEW3D_MT_metaball_add", text="Add", text_ctxt=i18n_contexts.operator_default)
elif mode_string == 'EDIT_ARMATURE':
layout.menu("TOPBAR_MT_edit_armature_add", text="Add")
layout.menu("TOPBAR_MT_edit_armature_add", text="Add", text_ctxt=i18n_contexts.operator_default)
if gp_edit:
if obj and obj.mode == 'PAINT_GPENCIL':
@ -1866,6 +1867,7 @@ class VIEW3D_MT_metaball_add(Menu):
class TOPBAR_MT_edit_curve_add(Menu):
bl_idname = "TOPBAR_MT_edit_curve_add"
bl_label = "Add"
bl_translation_context = i18n_contexts.operator_default
def draw(self, context):
is_surf = context.active_object.type == 'SURFACE'
@ -1935,6 +1937,7 @@ class VIEW3D_MT_camera_add(Menu):
class VIEW3D_MT_add(Menu):
bl_label = "Add"
bl_translation_context = i18n_contexts.operator_default
def draw(self, context):
layout = self.layout
@ -2184,7 +2187,7 @@ class VIEW3D_MT_object_context_menu(Menu):
'''
if selected_objects_len == 0:
layout.menu("VIEW3D_MT_add", text="Add")
layout.menu("VIEW3D_MT_add", text="Add", text_ctxt=i18n_contexts.operator_default)
layout.operator("view3d.pastebuffer", text="Paste Objects", icon='PASTEDOWN')
return
@ -3321,7 +3324,7 @@ class VIEW3D_MT_edit_mesh_context_menu(Menu):
'''
# If nothing is selected
if not (selected_verts_len or selected_edges_len or selected_faces_len):
layout.menu("VIEW3D_MT_mesh_add", text="Add")
layout.menu("VIEW3D_MT_mesh_add", text="Add", text_ctxt=i18n_contexts.operator_default)
return
'''