Translations in python scripts are missing. #80589

Closed
opened 2020-09-08 12:40:53 +02:00 by Yuezhi HUANG · 18 comments

Blender Version
Broken: master(211b6c29)

Short description of error

Some translations in menus in Blender 2.90 are missing. I checked the code and found the missing translations may be the text argument from bpy.types.UILayout.operator(). Also, compared to 2.83, these translation msgid is missing in produced *.po file.

Here is a diff file of translation between 2.83 and 2.90.
diff.diff

Here is an example:
image.png
the code behind:
image.png

I try to replace the *.mo file by it in the 2.83 version, and everything goes right.

However as a newbie, I'm not able to fix it so I put an issue for someone who would like to involve in.

Exact steps for others to reproduce the error
Just start up in another language apart from English.

**Blender Version** Broken: master(211b6c29) **Short description of error** Some translations in menus in Blender 2.90 are missing. I checked the code and found the missing translations may be the *text* argument from *bpy.types.UILayout.operator()*. Also, compared to 2.83, these translation msgid is missing in produced *.po file. Here is a diff file of translation between 2.83 and 2.90. [diff.diff](https://archive.blender.org/developer/F8854692/diff.diff) Here is an example: ![image.png](https://archive.blender.org/developer/F8854432/image.png) the code behind: ![image.png](https://archive.blender.org/developer/F8854421/image.png) I try to replace the *.mo file by it in the 2.83 version, and everything goes right. However as a newbie, I'm not able to fix it so I put an issue for someone who would like to involve in. **Exact steps for others to reproduce the error** Just start up in another language apart from English.
Author

Added subscriber: @juicyenc

Added subscriber: @juicyenc
Author

This comment was removed by @juicyenc

*This comment was removed by @juicyenc*
Author

This comment was removed by @juicyenc

*This comment was removed by @juicyenc*
Author

This comment was removed by @juicyenc

*This comment was removed by @juicyenc*
Member

Added subscribers: @mont29, @nge

Added subscribers: @mont29, @nge
Member

@mont29 Since Blender 2.90 is formally released, this should be fixed in 2.90a. Hope you can help us.

@mont29 Since Blender 2.90 is formally released, this should be fixed in 2.90a. Hope you can help us.

Added subscriber: @SatoshiYamasaki

Added subscriber: @SatoshiYamasaki

@mont29 Bastien, If you have no time, you can ask UI team to help this work. Especially, this problems seems to be caused by UI changes, so they should do it too. I think UI translation is an important part of user interface.

@mont29 Bastien, If you have no time, you can ask UI team to help this work. Especially, this problems seems to be caused by UI changes, so they should do it too. I think UI translation is an important part of user interface.

Added subscriber: @ArtyomSobolev

Added subscriber: @ArtyomSobolev
Member

Added subscriber: @Lockal

Added subscriber: @Lockal
Member

As on my computer, bl_extract_messages.py fails with

AttributeError: type object 'MeshEdge' has no attribute 'bl_rna'

Now goes strange thing. Adding these 5 lines below "import bpy" fixes this issue.

bpy.types.MeshEdge
bpy.types.MeshLoopTriangle
bpy.types.MeshPolygon
bpy.types.NodeSocket
bpy.types.NodeSocketInterface

Looks like just accessing classes (without creating instances) makes them remember their "bl_rna". Not sure, that it is exactly the same issue, that prevents extraction, but I hope it gives some ideas about root cause.

As on my computer, `bl_extract_messages.py` fails with ``` AttributeError: type object 'MeshEdge' has no attribute 'bl_rna' ``` Now goes strange thing. Adding these 5 lines below "import bpy" fixes this issue. ``` bpy.types.MeshEdge bpy.types.MeshLoopTriangle bpy.types.MeshPolygon bpy.types.NodeSocket bpy.types.NodeSocketInterface ``` Looks like just accessing classes (without creating instances) makes them remember their "bl_rna". Not sure, that it is exactly the same issue, that prevents extraction, but I hope it gives some ideas about root cause.

Closed as duplicate of #66844

Closed as duplicate of #66844
Member

Changed status from 'Duplicate' to: 'Needs Triage'

Changed status from 'Duplicate' to: 'Needs Triage'
Member

Reopening, not related to #66844. This is a regression from June 2020 in 2.90, when many basic translations were removed from .pot, likely, due to a bug in bl_extract_messages.

#66844 is another task related to Blender 2.8-rc about messages that were never translated, likely, due to missing IFACE_/iface_/etc. or dynamic creation.

Reopening, not related to #66844. This is a regression from June 2020 in 2.90, when many basic translations were removed from .pot, likely, due to a bug in bl_extract_messages. #66844 is another task related to Blender 2.8-rc about messages that were never translated, likely, due to missing IFACE_/iface_/etc. or dynamic creation.
Bastien Montagne self-assigned this 2020-09-13 19:48:13 +02:00

Indeed, quiet specific issue… For those interested in the 'what happened', Python 3.8 (which I am using here since it's Debian's testing version) changed behavior of its AST module (the tool we use to parse Python files and extract UI strings), constants used to have types like ast.Str or ast.Int, now they all have ast.Constant type, so we need to adapt the script indeed. Fix incoming, and will update the i18n files later today or tomorrow.

@Lockal your issue with MeshEdge & co I also faced at some point, it seems to be triggered when you are using the system's python but still enable the 'install python' CMake option, looks like python gets confused then and this tends to generate quite a few mysterious issues. Those structs are not directly RNA defined ones, they are wrapped into a python class to extend them, in bpy.types.py).

Indeed, quiet specific issue… For those interested in the 'what happened', Python 3.8 (which I am using here since it's Debian's testing version) changed behavior of its AST module (the tool we use to parse Python files and extract UI strings), constants used to have types like `ast.Str` or `ast.Int`, now they all have `ast.Constant` type, so we need to adapt the script indeed. Fix incoming, and will update the i18n files later today or tomorrow. @Lockal your issue with `MeshEdge` & co I also faced at some point, it seems to be triggered when you are using the system's python but still enable the 'install python' CMake option, looks like python gets confused then and this tends to generate quite a few mysterious issues. Those structs are not directly RNA defined ones, they are wrapped into a python class to extend them, in `bpy.types.py`).

This issue was referenced by 2c8f8765a1

This issue was referenced by 2c8f8765a1d815b15e0d9370a871b267d0ebe934

This issue was referenced by 9d674708ea

This issue was referenced by 9d674708ea7e0a5d7ac698784a7649d2ee73e4f8

Changed status from 'Needs Triage' to: 'Resolved'

Changed status from 'Needs Triage' to: 'Resolved'
Sign in to join this conversation.
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
8 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#80589
No description provided.