blender/scripts/modules/bl_i18n_utils
Damien Picard 2d703e9200 I18n: add label declaration to node sockets so they can be shortened
In !112591, nodes got the ability to group sockets into panels. The
labels for these sockets are automatically shortened if they begin
with the same text as their parent labels. For instance, "Transmission
Weight" will be shortened to just "Weight" because it is under the
"Transmission" panel.

While this is a good heuristic for English, it breaks down in
languages which do not have the same word order.

This commit adds a `.short_label()` callback to socket declarations so
that a shortened label can be explicitly declared.

It also adds two regexps to the translation script so that these new
fields can be extracted to the .po translation files. One extracts the
label with a translation context, the other without. Only the one
without context is currently in use.

The current automatic shortening logic is kept and will be used only
if a shortened label is not manually provided.

Fixes #112970: Node socket labels under panels are not shortened when
translated.

Pull Request: https://projects.blender.org/blender/blender/pulls/113070
2023-10-12 17:51:37 +02:00
..
__init__.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
bl_extract_messages.py Revert "UI: Input Placeholders" 2023-10-11 08:01:24 -07:00
merge_po.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
settings_user.py License Headers: Set copyright to "Blender Authors", add AUTHORS 2023-08-16 00:20:26 +10:00
settings.py I18n: add label declaration to node sockets so they can be shortened 2023-10-12 17:51:37 +02:00
utils_cli.py I18n Py Module: Update settings after move to Weblate. 2023-09-15 18:08:52 +02:00
utils_languages_menu.py Cleanup: spelling in comments 2023-09-05 11:04:27 +10:00
utils_rtl.py Cleanup: spelling in comments 2023-09-05 11:04:27 +10:00
utils_spell_check.py Cleanup: spelling in comments 2023-09-05 11:04:27 +10:00
utils.py I18N module: updates for transition to weblate. 2023-09-15 18:08:52 +02:00