WIP: I18n: add per-label translation contexts for nodes #105690

Draft
Damien Picard wants to merge 3 commits from pioverfour/blender:dp_add_i18n_context_socket_label into blender-v3.6-release

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

3 Commits

Author SHA1 Message Date
Damien Picard 29830181ca I18n: extract messages from node sockets using custom labels
Node sockets can get their names from several places: from the node
declaration, or from special labels, mostly used in math nodes.

These labels are now translated, but they never were extracted, so
this commit adds two regex variants to extract them from the
`node_socket_label()` function, with or without a translation context.

Three messages previously untranslatable were added, from the math
node operator types.
2023-05-22 15:11:07 +02:00
Damien Picard 22ddff63e3 I18n: add translation contexts to Value socket for Color Combine node
This socket needs disambiguation, because it cannot be properly
translated to Japanese. "Value", in the context of color, is not the
same word as in the context of a numerical value, most common
elsewhere in Blender.

More details in #105113.
2023-05-22 15:11:07 +02:00
Damien Picard 538d053eed I18n: add per-label translation contexts for nodes
In order to properly translate UI messages, they sometimes need to be
disambiguated using translation contexts. Until now, node sockets
using custom labels had no way to specify contexts and a collision
occurred in at least one known instance.

This commit adds a way to declare contexts for each socket with
labels, by adding a `label_translation_context` field to the
bNodeSocket struct, as well as a `translation_context` argument to the
`node_sock_label()` function.

If no context is specified, the default null context is used.

The use of a context will enable us to fix part of #105113 in the next
commit.
2023-05-22 15:11:07 +02:00