Fix: UI: File execute operator button text is not localized #110776
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#110776
Loading…
Reference in New Issue
No description provided.
Delete Branch "cmbasnett/bdk-blender:localize-file-execute-button"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The operator "execute" button was not having it's text localized because it was just passing it a raw string and not running it through the
_IFACE
macro. This fixes the issue so that the button is always correctly localized.Before:
After:
UI: Fix bug where the file execute operator button text is not being localizedto Fix: UI: File execute operator button text is not localizedAh, nice catch. However I believe the translation should happen in
WM_operatortype_name
.The call to
RNA_struct_ui_name
there already does contextual translation, but the call to potentialot->get_name
does not. So the last line of that function should be something like:return (name && name[0]) ? CTX_IFACE_(RNA_struct_translation_context(ot->srna), name) : RNA_struct_ui_name(ot->srna);
In my case,
ot->get_name
is null for my operator, so this might actually be a separate issue entirely.This translation fails if the "Operator" context is passed through to the underlying lookup functions. The Japanese translation has a contextless translation for "Import" (インポト) that is used elsewhere such as the File -> Import menu, but not one for the "Operator" context.
I'm not too familiar with how the system is supposed to work, but I was under the impression that it might fall back to a contextless translation if no translation exists for the given context. So perhaps this is just a case of missing context translations for "Import" in Japanese specifically. I see that an "Operator" context translation exists for "Export", but not for "Import".
Well yes, indeed there seems to be nowhere where
"Import"
is defined as UI label with theOperator
context."Export"
happens to be through the 3D print utils add-on.Using the
Operator
context here is the expected thing, so if you want your own add-on to be translated, you'll have to handle it yourself (see https://wiki.blender.org/wiki/Source/Interface/Internationalization#Python_Translation_API and https://wiki.blender.org/wiki/Process/Translate_Blender#Translating_non-official_addons).Will handle to fix with
ot->get_name
case myself then, closing this PR since it's not actually addressing any issue in Blender.This is not the case, because contexts allow for disambiguation between multiple translations of a given message. If a translation falls back to an unrelated context it may result in a nonsensical message being displayed. It’s better instead to just display the untranslated one, which at least signals developers that a translation is missing.
Where is this "Import" message coming from? Is it a custom importer add-on? Because AFAICT all official importers have their buttons properly translated, whether from C++ or Python. If it is a custom Python importer, you need to register translations yourself. The translation tuple can be generated using the Manage UI Translations add-on.
EDIT: Whoops should have refreshed the page!
Pull request closed