Page MenuHome

UI: make many modifier strings translatable
ClosedPublic

Authored by Damien Picard (pioverfour) on Jul 10 2022, 8:28 PM.

Details

Summary

This includes:

  • new modifier names
  • subpanel labels

It mostly uses N_ because the strings are actually translated elsewhere. The goal is simply to export the them to .po files.

Most of the new translations were reported in T43295#1105335.

Diff Detail

Repository
rB Blender

Event Timeline

Damien Picard (pioverfour) requested review of this revision.Jul 10 2022, 8:28 PM
Damien Picard (pioverfour) created this revision.
Bastien Montagne (mont29) requested changes to this revision.Jul 13 2022, 5:29 PM

Thanks for the patch, but most of those changes are not needed, or should not be needed (and requires proper fix somewhere else).

source/blender/modifiers/intern/MOD_armature.c
269

This 'name' field is internal data, should not be exposed in the UI to the user, so no need to translate it.

source/blender/modifiers/intern/MOD_array.c
511–514

This should not be needed, BKE_modifier_set_error should be handled automatically by the POT generation tool. Not sure why it fails off hands, but it needs to be properly fixed.

source/blender/modifiers/intern/MOD_nodes.cc
1724–1730

Those should remain tooltips, not be considered as regular UI labels.

This revision now requires changes to proceed.Jul 13 2022, 5:29 PM
source/blender/modifiers/intern/MOD_armature.c
269

But then there’s something I don’t understand: at which point in the code are those new data names extracted to the translation files?

In BKE_modifier.h there is this declaration:

typedef struct ModifierTypeInfo {
  /* The user visible name for this modifier */
  char name[32];

And in modifier.c:

static ModifierData *modifier_allocate_and_init(int type)
{
  const ModifierTypeInfo *mti = BKE_modifier_get_info(type);
  ModifierData *md = MEM_callocN(mti->structSize, mti->structName);

  /* NOTE: this name must be made unique later. */
  BLI_strncpy(md->name, DATA_(mti->name), sizeof(md->name));

Does it not mean that new modifiers get their names from this name property in ModifierTypeInfo? If so, they actually are exposed to the user. And their translation does happen, but the strings never get extracted to the po(t) file (I think).

Anyway, I couldn’t find how to handle the string extraction better than using the macro where they are declared :)

source/blender/modifiers/intern/MOD_array.c
511–514

Fair enough, I’m not skilled enough to investigate further!

source/blender/modifiers/intern/MOD_nodes.cc
1724–1730

Understood, I just thought it looked inconsistent when tooltip translation is disabled, since they’re not popup (which I thought all tooltips were):

source/blender/modifiers/intern/MOD_armature.c
269

Aaaaah right, they are used there as 'data' name...

Thought those were extracted automatically by the script from the RNA data, but those default names are not exposed to RNA in the end...

So you are right, we need those tags here.

source/blender/modifiers/intern/MOD_nodes.cc
1724–1730

In fact, we also consider lengthier, informative 'labels' as tooltips from translation perspective.
the idea is that, user can choose to only translate tooltips, but not labels, so that they get a UI that matches most (English) tutorials and docs, while still getting detailed info/explanation in their native language (the tooltips).
In that sense, it makes more sense to keep detailed 'labels' such as error messages or info in the 'tooltip' category.

Revert changes to BKE_modifier_set_errors and TIP_.

Damien Picard (pioverfour) marked 2 inline comments as done.

Forgot to revert one message.

source/blender/modifiers/intern/MOD_solidify.c
228–232

Those three should also be tagged then?

source/blender/modifiers/intern/MOD_solidify.c
228–232

Well there are many untagged subpanels left, probably around 60. I only did those which weren’t already in the po files from somewhere else in the code.

Should I add all of those for completeness’ sake, if the other sources are ever deleted?

source/blender/modifiers/intern/MOD_solidify.c
228–232

in fact decided to add those function (this one, and also the one for gpencil modifiers) to the automated messages extraction script , simpler and more future-proof. So you should now be able to remove manual tagging for them.

  • Remove modifier_subpanel_register() tags
  • Add two overlooked uiItemR() tags
This revision is now accepted and ready to land.Jul 15 2022, 2:11 PM