Add translation preview in editor
Follow-up to #96230 Closes https://github.com/godotengine/godot-proposals/issues/8171
Allow previewing the edited scene in the specified locale.
Mainly a proof-of-concept for now, marking as draft. Not thoroughly tested.
https://github.com/user-attachments/assets/4331936c-6b12-43fc-94b5-fe91a4ae8cd0
Incredible work, truly.
One UX note that wasn't covered in the proposal: when a translation is selected, there is a discrepancy between what is in a Label's inspector and what is shown in the scene. Perhaps some sort of indication in the text field of the fact that the field is translated is in order?
For example: the text field is expanded to include a row explaining what this label translates to (ugly example incoming, but you get the point...):
It would be great to see this feature in 4.5. @timothyqiu is there anything we could do to help with it? Like more testing for example.
@arkology When refining this PR, I often encounter some other editor/engine bugs that need to be fixed first 😛
For example, after modifying a CSV file, the editor can successfully re-import but it still loads the old content; sometimes after removing items, the size of a popup menu gets broken. I am trying to fix dependencies like these first before updating this PR.
- Resolved conflicts.
- The 2D viewport now shows "Previewing: <Language>" when translation preview is active.
- The locale dropdown now shows locale name when possible and keeps open when an option is selected.
- Turns off preview when the current translation is removed from Project Settings dialog.
- Fixed various minor bugs.
Known issues:
- Updating CSV translations does not update preview text in the editor. This is probably due to a CSV file being imported as additional
.translationfiles. Updating PO translations works fine. - After removing a translation, the "Preview Translation" submenu stays the old size: https://github.com/godotengine/godot/issues/106668
The language menu should be either moved elsewhere, or duplicated in the 3D editor. It will affect 3D nodes too, like Label3D.
EDIT: Same with the "Previewing:" label I think.
https://github.com/user-attachments/assets/42b0c78e-863c-4fe3-b84a-bae5e495c8e8
Both 2D & 3D views have a Preview Translation option in the View menu now.
https://github.com/user-attachments/assets/e90c0e11-e3b0-4467-82db-717079926812
Thanks!