Convert the translation identifier screen to the translation info screen.

This:

* Is available outside of developer mode.
* Shows the current line number.
* If a translation is in use, shows the source line number.
* If a translation is in use, shows the translated line.

Fixes #5414.
This commit is contained in:
Tom Rothamel
2024-07-17 01:05:50 -04:00
parent 1d2a811c36
commit 287f74065d
5 changed files with 54 additions and 59 deletions
+32 -3
View File
@@ -20,13 +20,26 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
screen _translates():
screen _translation_info():
layer config.interface_layer
zorder 1500
style_prefix ""
$ tl = renpy.get_translation_info()
$ filename, line = renpy.get_filename_line()
default show_copy = False
python:
identifier = renpy.get_translation_identifier()
copy = None
if identifier:
copy = (SetScreenVariable("show_copy", True),
Function(pygame_sdl2.scrap.put,
pygame_sdl2.scrap.SCRAP_TEXT,
identifier.encode("utf8")))
tl = renpy.get_translation_info()
filename, line = renpy.get_filename_line()
# The filename and line to show.
@@ -47,6 +60,16 @@ screen _translates():
null height gui._scale(7)
textbutton _("Translation identifier: [identifier]"):
action copy
padding (0, 0)
text_color "#fff"
text_hover_color "#bdf"
text_size gui._scale(14)
null height gui._scale(7)
hbox:
textbutton "[filename]:[line]":
@@ -73,3 +96,9 @@ screen _translates():
text " [s]":
size gui._scale(14)
color "#fff"
if show_copy:
text _("\n{color=#fff}Copied to clipboard.{/color}"):
size gui._scale(14)
timer 2.0 action SetScreenVariable("show_copy", False)
+7 -55
View File
@@ -66,12 +66,12 @@ screen _developer:
textbutton _("Image Attributes"):
action ui.callsinnewcontext("_image_attributes")
if not renpy.get_screen("_translation_identifier"):
textbutton _("Show Translation Identifiers"):
action Show("_translation_identifier")
if not renpy.get_screen("_translation_info"):
textbutton _("Show Translation Info"):
action Show("_translation_info")
else:
textbutton _("Hide Translation Identifiers"):
action Hide("_translation_identifier")
textbutton _("Hide Translation Info"):
action Hide("_translation_info")
if bubble.active:
@@ -569,57 +569,9 @@ screen _image_load_log():
timer 10.0 action SetScreenVariable("show_help", False)
# Removed, could be in save files.
screen _translation_identifier():
layer config.interface_layer
zorder 1500
default show_copy = False
default show_help = True
style_prefix ""
python:
identifier = renpy.get_translation_identifier()
copy = None
if identifier:
copy = (SetScreenVariable("show_copy", True),
Function(pygame_sdl2.scrap.put,
pygame_sdl2.scrap.SCRAP_TEXT,
identifier.encode("utf8")))
drag:
draggable True
focus_mask None
xpos 0
ypos 0
frame:
style "empty"
background "#0004"
xpadding 5
ypadding 5
has vbox
textbutton "[identifier]":
action copy
padding (0, 0)
text_color "#fff"
text_hover_color "#bdf"
text_size 14
if show_copy:
text _("\n{color=#fff}Copied to clipboard.{/color}"):
size 14
timer 2.0 action SetScreenVariable("show_copy", False)
elif show_help:
text _("\n{color=#fff}Click to copy.\nDrag to move.{/color}"):
size 14
timer 10.0 action SetScreenVariable("show_help", False)
pass
screen _filename_and_line():
+4
View File
@@ -82,6 +82,10 @@ Wrapped methods of the Steamworks API are documented on the :doc:`achievement` p
Features
--------
The translation identifier screen (accessed through shift+D) is now the translation info screen, and now includes
information about the line being executed. If a language is selected, the screen will also show the line being
translated, and the text of the say statement being translated.
:doc:`cds` can now take take an ATL block, which is supplied to the `execute` function as a keyword argument
giving an ATL transform. It's also possible to define a creator-defined statement that optionally takes
an ATL block, or a block of script statements.
+10
View File
@@ -443,6 +443,16 @@ The default language is chosen using the following method:
:var:`config.default_language` is used.
* Otherwise, the None language is used.
Translation Info Screen
=======================
A screen with information about translations can be found by entering the developer menu (shift+D), and
and selecting "Show Translation Info". For non-developers, this screen can be shown with::
show screen _translation_info
Translation Actions, Functions, and Variables
=============================================
+1 -1
View File
@@ -10,7 +10,7 @@
"name": "The Question",
"numeric_version": 1,
"orientation": "sensorLandscape",
"package": "org.renpy.tq",
"package": "org.renpy.thequestion",
"permissions": [
"VIBRATE",
"INTERNET"