I18n: translate Repeat Zone in the Add Node menu #110644

Merged
Bastien Montagne merged 1 commits from pioverfour/blender:dp_translate_repeat_zone into main 2023-08-01 18:07:38 +02:00
Member

The Repeat Zone operator from the Geometry nodes Add Node -> Utilities
menu was not translated because it used the "Operator" translation
context, instead of the default context.

Since the function displaying the menu item, add_repeat_zone(), is
only ever called from the Utilities menu, and the label is specified
there as "Repeat Zone", we know in advance that it will have this
name.

For the same reason, this commit also simplifies the function which
creates the menu entry for simulation zones. This function is also
only called from the Simulation menu with a specific label using the
default context, so it should also use this one.

The Repeat Zone operator from the Geometry nodes Add Node -> Utilities menu was not translated because it used the "Operator" translation context, instead of the default context. Since the function displaying the menu item, `add_repeat_zone()`, is only ever called from the Utilities menu, and the label is specified there as "Repeat Zone", we know in advance that it will have this name. For the same reason, this commit also simplifies the function which creates the menu entry for simulation zones. This function is also only called from the Simulation menu with a specific label using the default context, so it should also use this one.
Damien Picard requested review from Bastien Montagne 2023-07-31 03:51:33 +02:00

I guess the operator context is wrong because the given label is never the name of an operator, but the name of a data (the node type)?

But then, how can you be sure that the default context is always the right one here? Commit message could be a bit more explanatory here. :)

I guess the `operator` context is wrong because the given label is never the name of an operator, but the name of a data (the node type)? But then, how can you be sure that the default context is always the right one here? Commit message could be a bit more explanatory here. :)
Author
Member

I guess the operator context is wrong because the given label is never the name of an operator, but the name of a data (the node type)?

Really it’s neither the operator nor data, it’s the UI label specified from the calling menu, NODE_MT_category_GEO_UTILITIES:

        node_add_menu.add_repeat_zone(layout, label="Repeat Zone")

But then, how can you be sure that the default context is always the right one here?

This function, add_repeat_zone(), is only ever called from the utilities menu, so we know in advance that it will always be named "Repeat Zone" (and "Simulation Zone" for the Simulation menu). Of course the function could be called from somewhere else in the future, but even then a label would still likely be passed manually since there is no default value for the label argument, and then Operator would probably not be the right context.

Commit message could be a bit more explanatory here. :)

Will edit, thanks!

> I guess the `operator` context is wrong because the given label is never the name of an operator, but the name of a data (the node type)? Really it’s neither the operator nor data, it’s the UI label specified from the calling menu, `NODE_MT_category_GEO_UTILITIES`: ```python node_add_menu.add_repeat_zone(layout, label="Repeat Zone") ``` > But then, how can you be sure that the default context is always the right one here? This function, `add_repeat_zone()`, is only ever called from the utilities menu, so we know in advance that it will always be named "Repeat Zone" (and "Simulation Zone" for the Simulation menu). Of course the function could be called from somewhere else in the future, but even then a label would still likely be passed manually since there is no default value for the `label` argument, and then `Operator` would probably not be the right context. > Commit message could be a bit more explanatory here. :) Will edit, thanks!

Sounds good, can you then force-push the commit itself? that way I can fast-forward merge, instead of creating a squash commit for the PR?

Sounds good, can you then force-push the commit itself? that way I can fast-forward merge, instead of creating a squash commit for the PR?
Bastien Montagne approved these changes 2023-08-01 15:05:47 +02:00
Damien Picard force-pushed dp_translate_repeat_zone from 71864ccdfe to 93de4ccdee 2023-08-01 17:28:31 +02:00 Compare
Bastien Montagne merged commit c6118da243 into main 2023-08-01 18:07:38 +02:00
Bastien Montagne deleted branch dp_translate_repeat_zone 2023-08-01 18:07:39 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#110644
No description provided.