Fix #76101: I18n: add new preference to translate reports #116804

Merged
Bastien Montagne merged 2 commits from pioverfour/blender:dp_translate_report_76101 into main 2024-01-12 13:37:41 +01:00
Member

Translation of the UI is currently split into 3 preferences:
interface, tooltips, and new data. The distinction between interface
and tooltips is currently unclear as tooltips also include a lot of
messages not displayed in the actual tooltips on mouse hover.

These include reports to the Info Editor, information in editor
headers and footers, and statuses in panels.

In order to limit the use of TIP_() to actual tooltips, this commit
introduces a new preference for this extra information: "Reports".

New translation macros are introduced: RPT_() and CTX_RPT_(), as
well as their equivalent for the Python API, pgettext_rpt_(), to be
imported as rpt_().

Existing usages of TIP_() and IFACE_() were reviewed and replaced
with RPT_() when relevant.

Translation of the UI is currently split into 3 preferences: interface, tooltips, and new data. The distinction between interface and tooltips is currently unclear as tooltips also include a lot of messages not displayed in the actual tooltips on mouse hover. These include reports to the Info Editor, information in editor headers and footers, and statuses in panels. In order to limit the use of `TIP_()` to actual tooltips, this commit introduces a new preference for this extra information: "Reports". New translation macros are introduced: `RPT_()` and `CTX_RPT_()`, as well as their equivalent for the Python API, `pgettext_rpt_()`, to be imported as `rpt_()`. Existing usages of `TIP_()` and `IFACE_()` were reviewed and replaced with `RPT_()` when relevant.
Damien Picard added the
Module
User Interface
Interest
Translations
labels 2024-01-04 22:35:42 +01:00
Bastien Montagne requested changes 2024-01-05 11:48:21 +01:00
Bastien Montagne left a comment
Owner

Generally looks good, my main disagreement here is with the decision to move some of the longer UI footer info back to interface, imho these are typical valid usecases for report.

This patch is also missing the required updates for the i18n scripts (messages extraction regexes) I think?

Generally looks good, my main disagreement here is with the decision to move some of the longer UI footer info back to `interface`, imho these are typical valid usecases for `report`. This patch is also missing the required updates for the i18n scripts (messages extraction regexes) I think?
@ -830,3 +831,3 @@
cache_info = scene.eevee.gi_cache_info
if cache_info:
col.label(text=cache_info)
col.label(text=rpt_(cache_info), translate=False)

Would not change this here, see comment later in eevee code itself.

The translation disabling tag is the only thing I would keep here.

Would not change this here, see comment later in eevee code itself. The translation disabling tag is the only thing I would keep here.
pioverfour marked this conversation as resolved
@ -260,3 +260,3 @@
SNPRINTF(eevee->light_cache_info,
TIP_("%d Ref. Cubemaps, %d Irr. Samples (%s in memory)"),
RPT_("%d Ref. Cubemaps, %d Irr. Samples (%s in memory)"),

As you are translating already the message here in one case, you should do the translation in this code in all cases. Otherwise this case will get translation code called twice (once here, once in py UI code with already translated string).

Even though the likeliness of collision is essentially null in that case, it is better (and somewhat more efficient) to be fully consistent and only handle translation at one level.

As you are translating already the message here in one case, you should do the translation in this code in all cases. Otherwise this case will get translation code called twice (once here, once in py UI code with already translated string). Even though the likeliness of collision is essentially null in that case, it is better (and somewhat more efficient) to be fully consistent and only handle translation at one level.
Author
Member

It’s not ideal, but the reason I’m doing this currently is because of the string formatting which needs to happen at this stage, otherwise the string couldn’t be translated at all. The best fix would be to expose the 3 values to the Python API so that formatting can happen on display, but I’m not sure it’s worth it.

It’s not ideal, but the reason I’m doing this currently is because of the string formatting which needs to happen at this stage, otherwise the string couldn’t be translated at all. The best fix would be to expose the 3 values to the Python API so that formatting can happen on display, but I’m not sure it’s worth it.
Author
Member

Sorry, I did not read that properly. I chose to translate on display rather than here for most strings, so that the messages is updated on language change, and isn’t stuck with what was defined on last light cache update.

I still think double translation for this specific string is slightly better than no translation update on language change, but I wouldn’t mind reverting.

Sorry, I did not read that properly. I chose to translate on display rather than here for most strings, so that the messages is updated on language change, and isn’t stuck with what was defined on last light cache update. I still think double translation for this specific string is slightly better than no translation update on language change, but I wouldn’t mind reverting.

Aaaah OK, now I understand why, and agree with the change. Think a comment here would be worth it then. :)

Aaaah OK, now I understand why, and agree with the change. Think a comment here would be worth it then. :)
pioverfour marked this conversation as resolved
@ -6541,3 +6540,1 @@
WM_window_cursor_keymap_status_get(win, i, 0));
const char *msg_drag = CTX_TIP_(BLT_I18NCONTEXT_OPERATOR_DEFAULT,
WM_window_cursor_keymap_status_get(win, i, 1));
const char *msg = CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT,

I do not agree with this change, to me these strings are rather reports than labels?

I do not agree with this change, to me these strings are rather reports than labels?
Author
Member

I agree, I was testing various things but would have switched this and other messages to reports, as discussed in the issue. This is still WIP! ;)

I agree, I was testing various things but would have switched this and other messages to reports, as discussed in the issue. This is still WIP! ;)
pioverfour marked this conversation as resolved
@ -560,3 +560,3 @@
if (obedit) {
if (BKE_keyblock_from_object(obedit)) {
*ofs += BLI_strncpy_rlen(info + *ofs, TIP_("(Key) "), len - *ofs);
*ofs += BLI_strncpy_rlen(info + *ofs, IFACE_("(Key) "), len - *ofs);

Here as well, I'd rather consider these strings as reports than labels.

Here as well, I'd rather consider these strings as reports than labels.
pioverfour marked this conversation as resolved
@ -1324,3 +1324,3 @@
USER_TR_TOOLTIPS = (1 << 0),
USER_TR_IFACE = (1 << 1),
USER_TR_UNUSED_2 = (1 << 2), /* cleared */
USER_TR_REPORTS = (1 << 2), /* cleared */

Well... this is not cleared anymore in current code.

Well... this is not cleared anymore in current code.
pioverfour marked this conversation as resolved

@blender-bot build

@blender-bot build
Damien Picard changed title from WIP: Fix #76101: I18n: add new preference to translate reports to Fix #76101: I18n: add new preference to translate reports 2024-01-10 09:53:12 +01:00
Author
Member

@mont29 I went over the existing translations. It’s possible I missed some still, but I don’t think many. I noticed a few things needing fixing, which I’ll submit separately.

Do you want me to rebase this to split the changes to macros into their own commit?

@mont29 I went over the existing translations. It’s possible I missed some still, but I don’t think many. I noticed a few things needing fixing, which I’ll submit separately. Do you want me to rebase this to split the changes to macros into their own commit?
Bastien Montagne approved these changes 2024-01-10 17:31:29 +01:00
Bastien Montagne left a comment
Owner

LGTM.

Only quickly checked all the changes for the usages of the new 'reports' translations, generally looks fine, this we can always refine further in the future anyway.

But would indeed rather have the core changes committed separately from the updates to iface/tip/rpt usages, to reduce the verbosity of the 'riskier' commit and make things either to investigate in case of later issues.

LGTM. Only quickly checked all the changes for the usages of the new 'reports' translations, generally looks fine, this we can always refine further in the future anyway. But would indeed rather have the core changes committed separately from the updates to iface/tip/rpt usages, to reduce the verbosity of the 'riskier' commit and make things either to investigate in case of later issues.
Damien Picard force-pushed dp_translate_report_76101 from a49d0ee3b3 to 5ee180910f 2024-01-11 23:33:27 +01:00 Compare
Author
Member

Should be all right now, the first commit contains only the core changes.

Should be all right now, the first commit contains only the core changes.
Bastien Montagne approved these changes 2024-01-12 11:19:20 +01:00

@blender-bot build

@blender-bot build
Bastien Montagne merged commit 3bd41cf9bc into main 2024-01-12 13:37:41 +01:00
Bastien Montagne deleted branch dp_translate_report_76101 2024-01-12 13:37:43 +01:00
First-time contributor

Now the Reports checkbox translates all messages in the Status Bar.
Status Bar 1.png

Because of this, there are two problems:

  1. Interface inconsistency. The same operations looks different (in two languages) in the Status Bar and other places (menu, search, settings, ...)
  2. Due to the fact that the translation of terminology is not standardized. Translation of terms in different sources (books, websites, manuals) may differ. Also, many users do not know how various terms are translated into their own language. Therefore, English terminology is mainly used.

Therefore, translating operations in the Status Bar does not help, but can be more confusing.

I propose translate the names of operations when Interface is enabled,
and translate the actions inside the operation when Report is enabled:
Status Bar 2.png

Now the `Reports` checkbox translates all messages in the Status Bar. ![Status Bar 1.png](/attachments/c7358730-f102-4e81-af16-cf01f9518b1a) Because of this, there are two problems: 1. Interface inconsistency. The same operations looks different (in two languages) in the Status Bar and other places (menu, search, settings, ...) 2. Due to the fact that the translation of terminology is not standardized. Translation of terms in different sources (books, websites, manuals) may differ. Also, many users do not know how various terms are translated into their own language. Therefore, English terminology is mainly used. Therefore, translating operations in the Status Bar does not help, but can be more confusing. I propose translate the names of operations when `Interface` is enabled, and translate the actions inside the operation when `Report` is enabled: ![Status Bar 2.png](/attachments/29eefa4e-5265-4dda-ad88-d3a47c778078)
Author
Member

Hi, thanks for the input. I’m not saying the situation is perfect but I don’t understand your proposition well. You mention three different areas:

  1. the operations displayed all the time (Select, Rotate View, Call Menu)
  2. the operations displayed when a modal operator is running (Confirm, Cancel, X Axis, etc.).
  3. the statistics to the right of the status bar (Verts, Edges, etc.)

What I understand is you suggest translating 1 and 3 through Interface, and 2 through Reports, is that correct?

But in my mind 1 and 2 are pretty much similar, shouldn’t they use the same translation setting?

My opinion would go slightly towards translating 1 and 2 (all operations) through Interface, and 3 through reports. I think the statistics are closer to being reports, and the available operations are kind of in the middle.

Hi, thanks for the input. I’m not saying the situation is perfect but I don’t understand your proposition well. You mention three different areas: 1. the operations displayed all the time (Select, Rotate View, Call Menu) 2. the operations displayed when a modal operator is running (Confirm, Cancel, X Axis, etc.). 3. the statistics to the right of the status bar (Verts, Edges, etc.) What I understand is you suggest translating 1 and 3 through Interface, and 2 through Reports, is that correct? But in my mind 1 and 2 are pretty much similar, shouldn’t they use the same translation setting? My opinion would go slightly towards translating 1 and 2 (all operations) through Interface, and 3 through reports. I think the statistics are closer to being reports, and the available operations are kind of in the middle.
First-time contributor

What I understand is you suggest translating 1 and 3 through Interface, and 2 through Reports, is that correct?

That's right.

But in my mind 1 and 2 are pretty much similar, shouldn’t they use the same translation setting?

For interface consistency, 1 should be translated when the Interface is enabled.

If you think that 2 should be the same as 1, you can do the same, I don't mind.
At the moment, I don't see any problems with this being translated as Reports or Interface.

... and 3 through reports. I think the statistics are closer to being reports, and the available operations are kind of in the middle.

Words in statistics are basic terms (Vertices, Edges, Faces, ...), there is no need to translate them because all users understand them.
These terms are also used elsewhere in the interface and I think that for interface consistency, statistics should also be translated when Interface is enabled:
Statistics.png

Another place where it might be worth changing the translation from Reports to Interface:
The text in the upper left corner:
Upper Left.png

> What I understand is you suggest translating 1 and 3 through Interface, and 2 through Reports, is that correct? That's right. > But in my mind 1 and 2 are pretty much similar, shouldn’t they use the same translation setting? For interface consistency, 1 should be translated when the `Interface` is enabled. If you think that 2 should be the same as 1, you can do the same, I don't mind. At the moment, I don't see any problems with this being translated as `Reports` or `Interface`. > ... and 3 through reports. I think the statistics are closer to being reports, and the available operations are kind of in the middle. Words in statistics are basic terms (Vertices, Edges, Faces, ...), there is no need to translate them because all users understand them. These terms are also used elsewhere in the interface and I think that for interface consistency, statistics should also be translated when `Interface` is enabled: ![Statistics.png](/attachments/901b5a24-437f-49d2-8797-c1a1b5c37207) Another place where it might be worth changing the translation from `Reports` to `Interface`: The text in the upper left corner: ![Upper Left.png](/attachments/b627c202-43b7-4021-b0cb-41f849f28d2b)
Author
Member

Understood. Honestly I wouldn’t mind this change. I’ll wait for @mont29 ’s input since he’s the one who decided on the interface / tip split originally.

Understood. Honestly I wouldn’t mind this change. I’ll wait for @mont29 ’s input since he’s the one who decided on the interface / tip split originally.

The proposed change make sense to me. Even though these are 'technically' reports, practically I think it makes more sense to match them with the rest of the interface messages indeed.

The proposed change make sense to me. Even though these are 'technically' reports, practically I think it makes more sense to match them with the rest of the interface messages indeed.
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#116804
No description provided.