I18n: write messages of the vertex group lock operator explicitly #104484
|
@ -3446,55 +3446,63 @@ static char *vertex_group_lock_description(bContext * /*C*/,
|
|||
int action = RNA_enum_get(params, "action");
|
||||
int mask = RNA_enum_get(params, "mask");
|
||||
|
||||
const char *action_str, *target_str;
|
||||
|
||||
/* NOTE: constructing the following string literals can be done in a less verbose way,
|
||||
pioverfour marked this conversation as resolved
|
||||
* however the resulting strings can't be usefully translated, (via `TIP_`). */
|
||||
switch (action) {
|
||||
case VGROUP_LOCK:
|
||||
action_str = TIP_("Lock");
|
||||
switch (mask) {
|
||||
case VGROUP_MASK_ALL:
|
||||
return BLI_strdup(TIP_("Lock all vertex groups of the active object"));
|
||||
pioverfour marked this conversation as resolved
Hans Goudey
commented
I'd suggest putting the
That would make the duplication here more manageable (and just take up less screen space!) I'd suggest putting the `return` directly in the switch cases and removing the `break` lines like
```
case VGROUP_MASK_ALL:
return BLI_strdup(TIP_("Lock all vertex groups of the active object"));
case ...:
```
That would make the duplication here more manageable (and just take up less screen space!)
Damien Picard
commented
You’re right, it’s much more legible! You’re right, it’s much more legible!
|
||||
case VGROUP_MASK_SELECTED:
|
||||
return BLI_strdup(TIP_("Lock selected vertex groups of the active object"));
|
||||
case VGROUP_MASK_UNSELECTED:
|
||||
return BLI_strdup(TIP_("Lock unselected vertex groups of the active object"));
|
||||
case VGROUP_MASK_INVERT_UNSELECTED:
|
||||
return BLI_strdup(
|
||||
TIP_("Lock selected and unlock unselected vertex groups of the active object"));
|
||||
}
|
||||
break;
|
||||
case VGROUP_UNLOCK:
|
||||
action_str = TIP_("Unlock");
|
||||
switch (mask) {
|
||||
case VGROUP_MASK_ALL:
|
||||
return BLI_strdup(TIP_("Unlock all vertex groups of the active object"));
|
||||
case VGROUP_MASK_SELECTED:
|
||||
return BLI_strdup(TIP_("Unlock selected vertex groups of the active object"));
|
||||
case VGROUP_MASK_UNSELECTED:
|
||||
return BLI_strdup(TIP_("Unlock unselected vertex groups of the active object"));
|
||||
case VGROUP_MASK_INVERT_UNSELECTED:
|
||||
return BLI_strdup(
|
||||
TIP_("Unlock selected and lock unselected vertex groups of the active object"));
|
||||
}
|
||||
break;
|
||||
case VGROUP_TOGGLE:
|
||||
action_str = TIP_("Toggle locks of");
|
||||
switch (mask) {
|
||||
case VGROUP_MASK_ALL:
|
||||
return BLI_strdup(TIP_("Toggle locks of all vertex groups of the active object"));
|
||||
case VGROUP_MASK_SELECTED:
|
||||
return BLI_strdup(TIP_("Toggle locks of selected vertex groups of the active object"));
|
||||
case VGROUP_MASK_UNSELECTED:
|
||||
return BLI_strdup(TIP_("Toggle locks of unselected vertex groups of the active object"));
|
||||
case VGROUP_MASK_INVERT_UNSELECTED:
|
||||
return BLI_strdup(TIP_(
|
||||
"Toggle locks of all and invert unselected vertex groups of the active object"));
|
||||
}
|
||||
break;
|
||||
case VGROUP_INVERT:
|
||||
action_str = TIP_("Invert locks of");
|
||||
break;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
switch (mask) {
|
||||
case VGROUP_MASK_ALL:
|
||||
target_str = TIP_("all");
|
||||
break;
|
||||
case VGROUP_MASK_SELECTED:
|
||||
target_str = TIP_("selected");
|
||||
break;
|
||||
case VGROUP_MASK_UNSELECTED:
|
||||
target_str = TIP_("unselected");
|
||||
break;
|
||||
case VGROUP_MASK_INVERT_UNSELECTED:
|
||||
switch (action) {
|
||||
case VGROUP_INVERT:
|
||||
target_str = TIP_("selected");
|
||||
break;
|
||||
case VGROUP_LOCK:
|
||||
target_str = TIP_("selected and unlock unselected");
|
||||
break;
|
||||
case VGROUP_UNLOCK:
|
||||
target_str = TIP_("selected and lock unselected");
|
||||
break;
|
||||
default:
|
||||
target_str = TIP_("all and invert unselected");
|
||||
switch (mask) {
|
||||
case VGROUP_MASK_ALL:
|
||||
return BLI_strdup(TIP_("Invert locks of all vertex groups of the active object"));
|
||||
case VGROUP_MASK_SELECTED:
|
||||
case VGROUP_MASK_INVERT_UNSELECTED:
|
||||
return BLI_strdup(TIP_("Invert locks of selected vertex groups of the active object"));
|
||||
case VGROUP_MASK_UNSELECTED:
|
||||
return BLI_strdup(TIP_("Invert locks of unselected vertex groups of the active object"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return BLI_sprintfN(TIP_("%s %s vertex groups of the active object"), action_str, target_str);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void OBJECT_OT_vertex_group_lock(wmOperatorType *ot)
|
||||
|
|
Loading…
Reference in New Issue
It would be good to include a comment, adding context to why strings are handled this way, otherwise someone who stumbles on the code might this as an opportunity to de-duplicate text.