I18n: Extract and translate asset catalog and asset names and descriptions #105747

Closed
Damien Picard wants to merge 2 commits from pioverfour:dp_translate_asset_nodes_menu into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

The Node Add menu can have special dynamic submenus containing node
assets. These submenus are generated by parsing the asset blend files
from release/datafiles/assets, and the interface drawing is specific
to these menus.

This PR enables the translation of these dynamic menus, including
their names and the description of the operators, as well as their
extraction from the catalog sidecar file and asset blend file.


image

The Node Add menu can have special dynamic submenus containing node assets. These submenus are generated by parsing the asset blend files from release/datafiles/assets, and the interface drawing is specific to these menus. This PR enables the translation of these dynamic menus, including their names and the description of the operators, as well as their extraction from the catalog sidecar file and asset blend file. ----- ![image](/attachments/92293347-ff4d-4f55-aa54-1731e9658072)
109 KiB
Damien Picard requested review from Bastien Montagne 2023-03-14 00:47:09 +01:00
Damien Picard force-pushed dp_translate_asset_nodes_menu from ae38734bda to 806ca1f9e4 2023-03-17 12:22:55 +01:00 Compare
Bastien Montagne requested changes 2023-03-20 16:14:28 +01:00
Bastien Montagne left a comment
Owner

Feels a bit weird to translated data that way, but this is indeed a fairly confusing mix between UI and data. :(

Feels a bit weird to translated data that way, but this is indeed a fairly confusing mix between UI and data. :(
@ -931,0 +939,4 @@
for line in data:
if (line == "\n" or line.startswith("VERSION") or line.startswith("#")):
continue
print("line:", len(line), line)

debug prints should not be committed ;)

debug prints should not be committed ;)
pioverfour marked this conversation as resolved
@ -983,2 +1029,4 @@
dump_template_messages(msgs, reports, settings)
# Get strings from asset catalogs and blend files.
dump_asset_messages(msgs, reports, settings)

Would rather call this as a last step, since it load blend files... (also document that with a comment to the call)?

Would rather call this as a last step, since it load blend files... (also document that with a comment to the call)?
pioverfour marked this conversation as resolved
@ -528,2 +528,4 @@
REL_TEMPLATES_DIR = os.path.join("scripts", "startup", "bl_app_templates_system")
# Where to search for assets (relative to SOURCE_DIR).
REL_ASSETS_DIR = os.path.join("release", "datafiles", "assets")

This is not relative to SOURCE_DIR, but to the installed data (like 3.6/datafiles/assets on linux builds e.g.)?
In source context, assets are from an SVN lib, so they live outside of the root git checkout (typically ../lib/assets/ relative to SOURCE_DIR).

So this path should rather be considered as relative to bpy.utils.resource_path('LOCAL')...

This is not relative to `SOURCE_DIR`, but to the installed data (like `3.6/datafiles/assets` on linux builds e.g.)? In source context, assets are from an SVN lib, so they live outside of the root git checkout (typically `../lib/assets/` relative to `SOURCE_DIR`). So this path should rather be considered as relative to `bpy.utils.resource_path('LOCAL')`...
pioverfour marked this conversation as resolved
Damien Picard force-pushed dp_translate_asset_nodes_menu from 806ca1f9e4 to b68e6a00a4 2023-03-20 18:17:49 +01:00 Compare
Damien Picard reviewed 2023-03-20 18:22:51 +01:00
@ -931,0 +939,4 @@
catalogs = set()
for line in data:
Author
Member

Oops, sorry about that!

Oops, sorry about that!
pioverfour marked this conversation as resolved
@ -980,6 +1029,7 @@ def dump_messages(do_messages, do_checks, settings):
dump_preset_messages(msgs, reports, settings)
# Get strings from startup templates.
# This loads each startup blend file in turn.
Author
Member

Would rather call this as a last step, since it load blend files... (also document that with a comment to the call)?

I moved it down, but another function loaded blends, dump_template_messages() for startup templates. Should I move it down too, or leave it be so messages remain stable?

> Would rather call this as a last step, since it load blend files... (also document that with a comment to the call)? I moved it down, but another function loaded blends, `dump_template_messages()` for startup templates. Should I move it down too, or leave it be so messages remain stable?
@ -528,2 +528,4 @@
REL_TEMPLATES_DIR = os.path.join("scripts", "startup", "bl_app_templates_system")
# Name of the built-in asset catalog file.
ASSET_CATALOG_FILE = "blender_assets.cats.txt"
Author
Member

My bad, I use symbolic links and thought this dir was from the sources.

My bad, I use symbolic links and thought this dir was from the sources.
pioverfour marked this conversation as resolved
Author
Member

Feels a bit weird to translated data that way, but this is indeed a fairly confusing mix between UI and data. :(

I tried finding an API to access catalogs, but couldn’t find it. No one knew on the chat either, so I guess that’s our best option…

> Feels a bit weird to translated data that way, but this is indeed a fairly confusing mix between UI and data. :( I tried finding an API to access catalogs, but couldn’t find it. No one knew on the chat either, so I guess that’s our best option…
Damien Picard requested review from Bastien Montagne 2023-03-20 18:28:07 +01:00

This also seems to not be properly rebased on current main?

This also seems to not be properly rebased on current main?
Bastien Montagne reviewed 2023-03-20 18:48:00 +01:00
@ -980,6 +1029,7 @@ def dump_messages(do_messages, do_checks, settings):
dump_preset_messages(msgs, reports, settings)
# Get strings from startup templates.
# This loads each startup blend file in turn.

Not ideal, but would leave here for now 9for that reason of keeping existing messages order as stable as possible).

Not ideal, but would leave here for now 9for that reason of keeping existing messages order as stable as possible).
Damien Picard force-pushed dp_translate_asset_nodes_menu from b68e6a00a4 to a849bb3dc4 2023-03-20 18:55:06 +01:00 Compare
Author
Member

Closing this, I’ll open a new PR to try solving the rebase issue Gitea has.

Closing this, I’ll open a new PR to try solving the rebase issue Gitea has.
Damien Picard closed this pull request 2023-03-20 18:56:16 +01:00

Pull request closed

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
2 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#105747
No description provided.