I18n: Fix translations for NLA

- Do not translate a label containing the name of the active NLA
  action.
- Translate default action name when created by inserting a keyframe.
- Translate "<NoAction>" and other default NLA strip names.
- Translate "<NoAction>" displayed in the UI when no action exists in
  the NLA.
- Translate the temporary meta-strip created when moving an NLA strip
  around. This uses DATA_() for consistency, even though it is not
  really user data.

Issues reported by Gabriel Gazzán.

Pull Request: https://projects.blender.org/blender/blender/pulls/124113
This commit is contained in:
Damien Picard 2024-07-01 22:35:58 +02:00 committed by Gitea
parent 78b9218c98
commit cc40d9f565
5 changed files with 12 additions and 8 deletions

@ -608,7 +608,7 @@ class DopesheetActionPanelBase:
@classmethod
def draw_generic_panel(cls, _context, layout, action):
layout.label(text=action.name, icon='ACTION')
layout.label(text=action.name, icon='ACTION', translate=False)
layout.prop(action, "use_frame_range")

@ -14,6 +14,8 @@
#include "BKE_fcurve.hh"
#include "BKE_lib_id.hh"
#include "BLT_translation.hh"
#include "BLI_listbase.h"
#include "BLI_string.h"
@ -53,7 +55,7 @@ bAction *id_action_ensure(Main *bmain, ID *id)
if (adt->action == nullptr) {
/* init action name from name of ID block */
char actname[sizeof(id->name) - 2];
SNPRINTF(actname, "%sAction", id->name + 2);
SNPRINTF(actname, DATA_("%sAction"), id->name + 2);
/* create action */
adt->action = BKE_action_add(bmain, actname);

@ -1845,16 +1845,16 @@ void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
if (strip->name[0] == 0) {
switch (strip->type) {
case NLASTRIP_TYPE_CLIP: /* act-clip */
STRNCPY(strip->name, (strip->act) ? (strip->act->id.name + 2) : ("<No Action>"));
STRNCPY(strip->name, (strip->act) ? (strip->act->id.name + 2) : DATA_("<No Action>"));
break;
case NLASTRIP_TYPE_TRANSITION: /* transition */
STRNCPY(strip->name, "Transition");
STRNCPY(strip->name, DATA_("Transition"));
break;
case NLASTRIP_TYPE_META: /* meta */
STRNCPY(strip->name, "Meta");
STRNCPY(strip->name, DATA_("Meta"));
break;
default:
STRNCPY(strip->name, "NLA Strip");
STRNCPY(strip->name, DATA_("NLA Strip"));
break;
}
}

@ -4251,7 +4251,7 @@ static void acf_nlaaction_name(bAnimListElem *ale, char *name)
BLI_strncpy(name, act->id.name + 2, ANIM_CHAN_NAME_SIZE);
}
else {
BLI_strncpy(name, "<No Action>", ANIM_CHAN_NAME_SIZE);
BLI_strncpy(name, IFACE_("<No Action>"), ANIM_CHAN_NAME_SIZE);
}
}
}

@ -21,6 +21,8 @@
#include "BLI_range.h"
#include "BLI_utildefines.h"
#include "BLT_translation.hh"
#include "BKE_action.h"
#include "BKE_fcurve.hh"
#include "BKE_nla.h"
@ -629,7 +631,7 @@ static void nla_draw_strip_text(AnimData *adt,
/* just print the name and the range */
if (strip->flag & NLASTRIP_FLAG_TEMP_META) {
str_len = BLI_snprintf_rlen(str, sizeof(str), "Temp-Meta");
str_len = BLI_snprintf_rlen(str, sizeof(str), DATA_("Temp-Meta"));
}
else {
str_len = STRNCPY_RLEN(str, strip->name);