I18n: add label declaration to node sockets so they can be shortened #113070
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
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
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
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
EEVEE & Viewport
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
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#113070
Loading…
Reference in New Issue
No description provided.
Delete Branch "pioverfour/blender:dp_shorten_panel_labels"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In !112591, nodes got the ability to group sockets into panels. The
labels for these sockets are automatically shortened if they begin
with the same text as their parent labels. For instance, "Transmission
Weight" will be shortened to just "Weight" because it is under the
"Transmission" panel.
While this is a good heuristic for English, it breaks down in
languages which do not have the same word order.
This commit adds a
.short_label()
callback to socket declarations sothat a shortened label can be explicitly declared.
It also adds two regexps to the translation script so that these new
fields can be extracted to the .po translation files. One extracts the
label with a translation context, the other without. Only the one
without context is currently in use.
The current automatic shortening logic is kept and will be used only
if a shortened label is not manually provided.
Fixes #112970: Node socket labels under panels are not shortened when
translated.
32e1cb4a42
tob472ef2ff8
b472ef2ff8
to12891a68d1
Change generally seems to make sense to me, although I am not happy at all with having yet another different UI string for this. And I would not use just
label
to name it, at least something likeshort_label
? With proper comment about what it is exactly and why it is needed.This also needs the Node team checking anyway.
I can understand that!
I considered this at first but figured that since there are so many different ways to label nodes already, might as well reuse one. Also there was some reluctance before about adding naming field to structs.
But I agree it would be cleaner, I’ll
change back to thatwait for more feedback.Is a new label really necessary for this? We already have socket names (which can be duplicate) vs. socket identifiers (which are unique). It's perfectly fine to use shorter socket names and then add a longer unique identifier based on the panel. I've done this in a branch recently for a new node i'm testing: code. There are multiple similar panels and the sockets inside have the same names, but the panel name is used as a prefix for unique identifiers.
If labels are needed for some reason i'd have to agree with @mont29: This probably requires yet another string variable or it will conflict with nodes that use the
bNodeSocket::label
. An example would be the Separate Color node which names its sockets based on the conversion mode (code).Design-wise i'd ask @brecht to compare this to the automatic shortening. It might be a lot of monkey work to decide which names/labels require shortening manually, and then all the translations for those.
@brecht mentioned this in !112591:
I'm not a native French speaker, but I'm not sure I agree with the way the socket names were translated even before panels were added.
For example:
What I'm getting at is that even in English, the meaning of this wording is really "Group: Item". And I'm wondering why we can't translate it as such in other languages as well? Without panels this also helps group together related properties.
If it does read really poorly, I would perhaps suggest to add a colon in the translation and have our shortening code recognize that.
You’re technically right but to me it’s also a shorthand for “Teinte [de la] spéculaire”, “Tint [of the] specular”. TBH I’d rather use the full “Teinte de la spéculaire” but the translation of this area is in progress and hasn’t been reviewed in regard to the latest Principled changes.
Thank you, I’ll try to come up with a better translation for this one!
Firstly I really believe that outside the context of the node, reversing the word order for some labels would sound very strange in French. “Vernis Rugosité” (for Coat Roughness) is unclear but it kind of sounds like it means “A coat of roughness”.
Secondly, French is still fairly similar to English so it could maybe work, but many other languages are not. Consider the example for simplified Chinese provided by @ChengduLittleA, where if I understand correctly the shortened string appears in the middle of the full string.
Some other languages may have a grammar that is even further away from English, this is not something we can anticipate.
That’s a great idea, but the issue I see with it is that this must be communicated to the translators, who won’t look at the code to know what it does. They won’t know they need to change the syntax simply based on the message they’re presented with.
We could manually add a comment in the PO files to let them know, but this kind of knowledge is easily lost. Developers in turn won’t know they need to do that when a new field is added.
I guess an additional short label is the only reliable solution then. It's not really different than the strings coming from UI layout files.
But it should be called
short_label
.This then also raises the question of what to do with user created node groups. Simplest would be to keep the automatic shortening for them.
@ -4024,3 +4024,3 @@
const char *nodeSocketLabel(const bNodeSocket *sock)
{
return (sock->label[0] != '\0') ? sock->label : sock->name;
/* Get the declaration label if possible. This is used when grouping sockets under panels, to
Putting the code here will shorten the label in the tooltip as well, which I don't think is right.
I think I fixed it but I couldn’t figure out in which cases this happens.
@ -408,4 +408,1 @@
const char *socket_translation_context = node_socket_get_translation_context(*socket);
const char *translated_socket_label = CTX_IFACE_(socket_translation_context, socket_label);
/* Shorten socket label if it begins with the panel label. */
Note that removing this code removes the shortening functionality for user created group nodes.
This looks good to me now.
@mont29 @LukasTonne any feedback on this? It would be good to get this into 4.0 as quickly as possible so translations can be added still.
This looks good to me now.
LGTM as well now.
@blender-bot build