Missing text in the msgid entry, might be there is an error in the extraction code #66065

Closed
opened 2019-06-24 00:32:10 +02:00 by Hoang Duy Tran · 10 comments
Member

The file 'vi.po' -- or the file 'blender.pot' -- has an entry like this:

. :src: scripts/addons/cycles/operators.py:101

msgid "Frame '' not found, animation must be complete."
msgstr ""

at the line number: 102959.

This is found at the following section:

              if not os.path.isfile(filepath):
                  scene.render.filepath = original_filepath
                  self.report({'ERROR'}, f"Frame '{filepath}' not found, animation must be complete.")
                  return {'CANCELLED'}

of the file

intern/cycles/blender/addon/operators.py

at the line number: 99

Notice that there is a word 'filepath' which resides between the pair of curly brackets, and the whole group of brackets and its contents have been omitted in the text of 'msgid' entry.

The file 'vi.po' -- or the file 'blender.pot' -- has an entry like this: # . :src: scripts/addons/cycles/operators.py:101 msgid "Frame '' not found, animation must be complete." msgstr "" at the line number: 102959. This is found at the following section: ``` if not os.path.isfile(filepath): scene.render.filepath = original_filepath self.report({'ERROR'}, f"Frame '{filepath}' not found, animation must be complete.") return {'CANCELLED'} ``` of the file intern/cycles/blender/addon/operators.py at the line number: 99 Notice that there is a word 'filepath' which resides between the pair of curly brackets, and the whole group of brackets and its contents have been omitted in the text of 'msgid' entry.
Author
Member

Added subscriber: @hoanguk

Added subscriber: @hoanguk

Added subscriber: @mont29

Added subscriber: @mont29
Bastien Montagne self-assigned this 2019-06-24 22:35:51 +02:00

More like a missing update, we did not use those f-strings before… Guess I'll have to dust off my AST again to add support for those.

More like a missing update, we did not use those f-strings before… Guess I'll have to dust off my AST again to add support for those.

Added subscriber: @ideasman42

Added subscriber: @ideasman42

@ideasman42 this will generate an ast.JoinedStr (containing a list of regular ast.Str and ast.FormattedValue objects). Thing is, I don’t think we can properly translate this in any way, since bpy API will only get the already processed string, which obviously does not exist in translations…
We could try invoking explicitly the pgettext function there, but am pretty sure that would break the fstring too (as this has to be parsed together with the whole py code at load time)? And in any case, it would be super-ugly…

Will dig more later (this is not exactly top priority I think), but am not feeling optimistic here, unless am missing something, think we should avoid those fstrings in UI messages (anything that is translated) for now?

@ideasman42 this will generate an `ast.JoinedStr` (containing a list of regular `ast.Str` and `ast.FormattedValue` objects). Thing is, I don’t think we can properly translate this in any way, since bpy API will only get the already processed string, which obviously does not exist in translations… We could try invoking explicitly the pgettext function there, but am pretty sure that would break the fstring too (as this has to be parsed together with the whole py code at load time)? And in any case, it would be super-ugly… Will dig more later (this is not exactly top priority I think), but am not feeling optimistic here, unless am missing something, think we should avoid those fstrings in UI messages (anything that is translated) for now?

We could avoid f-strings for text which needs to be translated if this complicates things too much.

We could avoid f-strings for text which needs to be translated if this complicates things too much.

Am gonna do that for now, I really do not see how to make fstrings work nicely with translations currently…

Am gonna do that for now, I really do not see how to make fstrings work nicely with translations currently…

This issue was referenced by blender/cycles@f171575602

This issue was referenced by blender/cycles@f1715756029315f52ab321b334527e04cd42058a

This issue was referenced by 787e2ddbd7

This issue was referenced by 787e2ddbd765609b6b0992585815c4d00e7419bf

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' 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
4 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#66065
No description provided.