I18n: Define NO_TRANSLATION ("Do not translate") context

This new translation context is for some special cases when
translation cannot be avoided, for example in an interface where some
props are built-in (translatable) and others are
user-defined (non-translatable), but we don't know which ones in
advance.

It allows specifying explicitly that translation should not occur
for user data when building the UI.

It is a followup to !145963, in which the context was introduced as a
string literal instead of a defined context.
This commit is contained in:
Damien Picard
2025-09-23 19:54:03 +02:00
committed by Bastien Montagne
parent 13d4829b7b
commit 417792f7fe
2 changed files with 9 additions and 1 deletions

View File

@@ -301,7 +301,7 @@ class TIME_PT_keyframing_settings(TimelinePanelButtons, Panel):
self.bl_label = scene.keying_sets_all.active.bl_label
if scene.keying_sets_all.active.bl_label in scene.keying_sets:
# Do not translate, this keying set is user-defined.
self.bl_translation_context = "Do not translate"
self.bl_translation_context = i18n_contexts.no_translation
else:
# Use the keying set's translation context (default).
self.bl_translation_context = scene.keying_sets_all.active.bl_rna.translation_context

View File

@@ -90,6 +90,13 @@ blender::StringRef BLT_translate_do_new_dataname(blender::StringRef msgctxt,
* (needed in some cases, as English adjectives have no plural mark :( ). */
#define BLT_I18NCONTEXT_PLURAL "Plural"
/* Special cases when translation cannot be avoided, for example in an interface where some props
* are built-in (translatable) and others are user-defined (non-translatable), but we don't know
* which ones in advance.
* It allows specifying explicitly that translation should not occur for user data when building
* the UI. */
#define BLT_I18NCONTEXT_NO_TRANSLATION "Do not translate"
/* ID-types contexts. */
/* WARNING! Keep it in sync with ID-types in `blenkernel/intern/idtype.cc`. */
#define BLT_I18NCONTEXT_ID_ACTION "Action"
@@ -173,6 +180,7 @@ struct BLT_i18n_contexts_descriptor {
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_PLURAL, "plural"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_ACTION, "id_action"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_ARMATURE, "id_armature"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_NO_TRANSLATION, "no_translation"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_BRUSH, "id_brush"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_CACHEFILE, "id_cachefile"), \
BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_CAMERA, "id_camera"), \