From cc40d9f565f08e440d02be7adc126657d99db305 Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Mon, 1 Jul 2024 22:35:58 +0200 Subject: [PATCH] I18n: Fix translations for NLA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Do not translate a label containing the name of the active NLA action. - Translate default action name when created by inserting a keyframe. - Translate "" and other default NLA strip names. - Translate "" 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 --- scripts/startup/bl_ui/space_dopesheet.py | 2 +- source/blender/animrig/intern/animdata.cc | 4 +++- source/blender/blenkernel/intern/nla.cc | 8 ++++---- source/blender/editors/animation/anim_channels_defines.cc | 2 +- source/blender/editors/space_nla/nla_draw.cc | 4 +++- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/scripts/startup/bl_ui/space_dopesheet.py b/scripts/startup/bl_ui/space_dopesheet.py index 7faed64af56..6d94fb81d9c 100644 --- a/scripts/startup/bl_ui/space_dopesheet.py +++ b/scripts/startup/bl_ui/space_dopesheet.py @@ -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") diff --git a/source/blender/animrig/intern/animdata.cc b/source/blender/animrig/intern/animdata.cc index 3ec2162378e..f4bd1c26178 100644 --- a/source/blender/animrig/intern/animdata.cc +++ b/source/blender/animrig/intern/animdata.cc @@ -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); diff --git a/source/blender/blenkernel/intern/nla.cc b/source/blender/blenkernel/intern/nla.cc index 078575873a5..12cc27e2387 100644 --- a/source/blender/blenkernel/intern/nla.cc +++ b/source/blender/blenkernel/intern/nla.cc @@ -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) : ("")); + STRNCPY(strip->name, (strip->act) ? (strip->act->id.name + 2) : DATA_("")); 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; } } diff --git a/source/blender/editors/animation/anim_channels_defines.cc b/source/blender/editors/animation/anim_channels_defines.cc index ea61c3b2944..cfa45ac9430 100644 --- a/source/blender/editors/animation/anim_channels_defines.cc +++ b/source/blender/editors/animation/anim_channels_defines.cc @@ -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, "", ANIM_CHAN_NAME_SIZE); + BLI_strncpy(name, IFACE_(""), ANIM_CHAN_NAME_SIZE); } } } diff --git a/source/blender/editors/space_nla/nla_draw.cc b/source/blender/editors/space_nla/nla_draw.cc index 907e43dfb0c..344ac64ce66 100644 --- a/source/blender/editors/space_nla/nla_draw.cc +++ b/source/blender/editors/space_nla/nla_draw.cc @@ -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);