Page MenuHome

Translations in python scripts are missing.
Closed, ResolvedPublic

Description

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.

Here is an example:


the code behind:

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.

Event Timeline

This comment was removed by Yuezhi HUANG (juicyenc).
This comment was removed by Yuezhi HUANG (juicyenc).
This comment was removed by Yuezhi HUANG (juicyenc).
Yuezhi HUANG (juicyenc) updated the task description. (Show Details)

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

@Bastien Montagne (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.

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.

Sv. Lockal (lockal) reopened this task as Needs Triage.Sun, Sep 13, 3:19 PM

Reopening, not related to T66844. 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.

T66844 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.

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.

@Sv. Lockal (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).