mirror of
https://github.com/Dasemu/vnpipe.git
synced 2026-11-26 07:16:23 +00:00
feat(renpy): book-style Spanish menus and save/load register
- Ship the Spanish UI translation (common + screens) with the template, overlaid by the work's tl/, and force config.language so a stale persistent preference cannot fall back to English. - Redesign main menu, game menu frame, save/load, preferences, history, help, about, confirm, notify and quick menu in the title-card style (gold rules, framed cards, deterministic PIL ornaments). - Save slots: thumbnail, scene title, date and verse excerpt from save JSON metadata; four large slots per page, Roman-numeral pages, separate Autosaves/Quick saves tabs, per-slot delete, no Sync. - Phone (small/touch) variants and e2e checks for save metadata. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
92df74f0a5
commit
d1236b470c
12 files changed
+2291
-302
No files matched your search
+148
-26
@@ -164,21 +164,40 @@ def scan_audio(out: Path) -> Audio:
|
||||
|
||||
|
||||
def copy_translations(work: Work, out: Path) -> list[Path]:
|
||||
"""Copy ``<work>/tl/**/*.rpy`` into ``game/tl/`` and set ``[ui].language`` as default."""
|
||||
src_root = work.path("tl")
|
||||
"""Install the UI translation for ``[ui].language`` and make it the only language.
|
||||
|
||||
vnpipe ships ``renpy_templates/tl/<language>/`` (Ren'Py's common strings plus every string
|
||||
of the template screens); ``<work>/tl/**/*.rpy`` is copied on top, so a work file with the
|
||||
same path replaces the shipped one. ``config.language`` (not only
|
||||
``config.default_language``, which applies on first run) forces the language even when a
|
||||
persistent preference from an older build says otherwise.
|
||||
"""
|
||||
dest_root = out / "game" / "tl"
|
||||
lang_file = out / "game" / "language.rpy"
|
||||
language = work.data.get("ui", {}).get("language")
|
||||
sources: dict[Path, Path] = {}
|
||||
roots = [TEMPLATE_DIR / "tl" / language] if language else []
|
||||
roots.append(work.path("tl"))
|
||||
for i, root in enumerate(roots):
|
||||
if not root.is_dir():
|
||||
continue
|
||||
prefix = Path(language) if i == 0 and language else Path()
|
||||
for src in sorted(root.rglob("*.rpy")):
|
||||
sources[prefix / src.relative_to(root)] = src
|
||||
written = []
|
||||
if src_root.is_dir():
|
||||
if sources:
|
||||
shutil.rmtree(dest_root, ignore_errors=True)
|
||||
for src in sorted(src_root.rglob("*.rpy")):
|
||||
dest = dest_root / src.relative_to(src_root)
|
||||
for rel, src in sorted(sources.items()):
|
||||
dest = dest_root / rel
|
||||
dest.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copyfile(src, dest)
|
||||
written.append(dest)
|
||||
language = work.data.get("ui", {}).get("language")
|
||||
if language:
|
||||
write_text(lang_file, f"define config.default_language = {quote(language)}\n")
|
||||
write_text(
|
||||
lang_file,
|
||||
f"define config.default_language = {quote(language)}\n"
|
||||
f"define config.language = {quote(language)}\n",
|
||||
)
|
||||
written.append(lang_file)
|
||||
else:
|
||||
lang_file.unlink(missing_ok=True)
|
||||
@@ -722,13 +741,19 @@ def _solid(size: tuple[int, int], color: tuple[int, ...]) -> Image.Image:
|
||||
|
||||
|
||||
def _check_image(selected: bool, round_: bool) -> Image.Image:
|
||||
"""Preference marks: a diamond (radio) or a square (check), filled with gold when set."""
|
||||
img = Image.new("RGBA", (38, 38), (0, 0, 0, 0))
|
||||
draw = ImageDraw.Draw(img)
|
||||
box = [4, 4, 33, 33]
|
||||
shape = draw.ellipse if round_ else draw.rectangle
|
||||
shape(box, outline=IVORY + (255,), width=3)
|
||||
if selected:
|
||||
shape([12, 12, 25, 25], fill=ACCENT + (255,))
|
||||
if round_:
|
||||
outer = [(19, 4), (34, 19), (19, 34), (4, 19)]
|
||||
inner = [(19, 11), (27, 19), (19, 27), (11, 19)]
|
||||
draw.polygon(outer, outline=IVORY + (200,), width=2)
|
||||
if selected:
|
||||
draw.polygon(inner, fill=ACCENT + (255,))
|
||||
else:
|
||||
draw.rectangle([6, 6, 31, 31], outline=IVORY + (200,), width=2)
|
||||
if selected:
|
||||
draw.rectangle([12, 12, 25, 25], fill=ACCENT + (255,))
|
||||
return img
|
||||
|
||||
|
||||
@@ -739,6 +764,84 @@ def _slot_image(border_alpha: int, fill_alpha: int) -> Image.Image:
|
||||
return img
|
||||
|
||||
|
||||
def _card_image(fill: tuple[int, ...], outer_alpha: int, inner_alpha: int) -> Image.Image:
|
||||
"""A book-plate panel: tinted fill, a gold outline and a fainter inner rule 5 px inside.
|
||||
Used as a Frame with 12 px borders, so the double rule never scales."""
|
||||
img = Image.new("RGBA", (64, 64), fill)
|
||||
draw = ImageDraw.Draw(img)
|
||||
draw.rectangle([0, 0, 63, 63], outline=ACCENT + (outer_alpha,), width=2)
|
||||
draw.rectangle([5, 5, 58, 58], outline=ACCENT + (inner_alpha,), width=1)
|
||||
return img
|
||||
|
||||
|
||||
def _rule_image(width: int, height: int, diamond: int) -> Image.Image:
|
||||
"""A gold rule fading out at both ends, with a small diamond at its centre."""
|
||||
img = Image.new("RGBA", (width, height), (0, 0, 0, 0))
|
||||
mid_y = height // 2
|
||||
half = width / 2
|
||||
for x in range(width):
|
||||
alpha = round(255 * min(1.0, (1 - abs(x + 0.5 - half) / half) * 1.6))
|
||||
img.putpixel((x, mid_y), ACCENT + (alpha,))
|
||||
img.putpixel((x, mid_y + 1), ACCENT + (alpha // 2,))
|
||||
cx, d = width // 2, diamond
|
||||
ImageDraw.Draw(img).polygon(
|
||||
[(cx, mid_y - d), (cx + d, mid_y), (cx, mid_y + d), (cx - d, mid_y)], fill=ACCENT + (255,)
|
||||
)
|
||||
return img
|
||||
|
||||
|
||||
def _nav_marker(alpha: int) -> Image.Image:
|
||||
"""Navigation highlight: a gold bar on the left edge and a tint fading to the right."""
|
||||
img = Image.new("RGBA", (96, 8), (0, 0, 0, 0))
|
||||
for x in range(96):
|
||||
a = alpha if x < 4 else round(alpha * 0.28 * (1 - (x - 4) / 92))
|
||||
for y in range(8):
|
||||
img.putpixel((x, y), ACCENT + (a,))
|
||||
return img
|
||||
|
||||
|
||||
def _line_bar(color: tuple[int, ...], thickness: int) -> Image.Image:
|
||||
"""A bar/slider track: a thin horizontal line centred in a transparent 48x48 tile."""
|
||||
img = Image.new("RGBA", (48, 48), (0, 0, 0, 0))
|
||||
top = 24 - thickness // 2
|
||||
ImageDraw.Draw(img).rectangle([0, top, 47, top + thickness - 1], fill=color)
|
||||
return img
|
||||
|
||||
|
||||
def _vline_bar(color: tuple[int, ...], thickness: int) -> Image.Image:
|
||||
return _line_bar(color, thickness).transpose(Image.Transpose.ROTATE_90)
|
||||
|
||||
|
||||
def _diamond_thumb(width: int, height: int) -> Image.Image:
|
||||
img = Image.new("RGBA", (width, height), (0, 0, 0, 0))
|
||||
cx, cy = width // 2, height // 2
|
||||
r = min(cx, cy) - 1
|
||||
ImageDraw.Draw(img).polygon(
|
||||
[(cx, cy - r), (cx + r, cy), (cx, cy + r), (cx - r, cy)],
|
||||
fill=ACCENT + (255,),
|
||||
outline=DARK + (255,),
|
||||
)
|
||||
return img
|
||||
|
||||
|
||||
def _hairline() -> Image.Image:
|
||||
"""A faint gold line on the top edge (a Frame with a 1 px top border keeps it 1 px)."""
|
||||
img = Image.new("RGBA", (64, 4), (0, 0, 0, 0))
|
||||
ImageDraw.Draw(img).line([(0, 0), (63, 0)], fill=ACCENT + (70,))
|
||||
return img
|
||||
|
||||
|
||||
def _vignette() -> Image.Image:
|
||||
"""Menu shade (scaled up to the screen): darker towards the edges, never opaque."""
|
||||
w, h = 192, 108
|
||||
img = Image.new("RGBA", (w, h))
|
||||
for y in range(h):
|
||||
for x in range(w):
|
||||
d = min(1.0, (((x - w / 2) / (w / 2)) ** 2 + ((y - h / 2) / (h / 2)) ** 2) ** 0.5)
|
||||
img.putpixel((x, y), DARK + (round(120 + 115 * d * d),))
|
||||
return img
|
||||
|
||||
|
||||
def gui_extra_images() -> dict[str, Image.Image]:
|
||||
"""Deterministic simple GUI images, keyed by path relative to ``game/``."""
|
||||
base: dict[str, Image.Image] = {
|
||||
@@ -751,22 +854,35 @@ def gui_extra_images() -> dict[str, Image.Image]:
|
||||
"button/check_selected_foreground.png": _check_image(True, False),
|
||||
"button/radio_foreground.png": _check_image(False, True),
|
||||
"button/radio_selected_foreground.png": _check_image(True, True),
|
||||
"bar/left.png": _solid((48, 48), ACCENT + (255,)),
|
||||
"bar/right.png": _solid((48, 48), IVORY + (60,)),
|
||||
"bar/top.png": _solid((48, 48), IVORY + (60,)),
|
||||
"bar/bottom.png": _solid((48, 48), ACCENT + (255,)),
|
||||
"slider/horizontal_bar.png": _solid((48, 48), IVORY + (60,)),
|
||||
"slider/horizontal_thumb.png": _solid((20, 38), ACCENT + (255,)),
|
||||
"slider/vertical_bar.png": _solid((48, 48), IVORY + (60,)),
|
||||
"slider/vertical_thumb.png": _solid((38, 20), ACCENT + (255,)),
|
||||
"scrollbar/horizontal_bar.png": _solid((48, 48), IVORY + (40,)),
|
||||
"scrollbar/horizontal_thumb.png": _solid((48, 48), ACCENT + (255,)),
|
||||
"scrollbar/vertical_bar.png": _solid((48, 48), IVORY + (40,)),
|
||||
"scrollbar/vertical_thumb.png": _solid((48, 48), ACCENT + (255,)),
|
||||
"bar/left.png": _line_bar(ACCENT + (255,), 6),
|
||||
"bar/right.png": _line_bar(IVORY + (70,), 2),
|
||||
"bar/top.png": _vline_bar(IVORY + (70,), 2),
|
||||
"bar/bottom.png": _vline_bar(ACCENT + (255,), 6),
|
||||
"slider/horizontal_bar.png": _line_bar(IVORY + (90,), 2),
|
||||
"slider/horizontal_thumb.png": _diamond_thumb(34, 38),
|
||||
"slider/vertical_bar.png": _vline_bar(IVORY + (90,), 2),
|
||||
"slider/vertical_thumb.png": _diamond_thumb(38, 34),
|
||||
"scrollbar/horizontal_bar.png": _line_bar(IVORY + (50,), 2),
|
||||
"scrollbar/horizontal_thumb.png": _line_bar(ACCENT + (220,), 6),
|
||||
"scrollbar/vertical_bar.png": _vline_bar(IVORY + (50,), 2),
|
||||
"scrollbar/vertical_thumb.png": _vline_bar(ACCENT + (220,), 6),
|
||||
# Menu ornaments (screens.rpy): panels, rules, navigation marker, menu shade.
|
||||
"vn/card_background.png": _card_image(DARK + (215,), 120, 45),
|
||||
"vn/card_hover_background.png": _card_image((38, 31, 22, 235), 255, 140),
|
||||
"vn/card_empty.png": _card_image(DARK + (120,), 55, 0),
|
||||
"vn/rule.png": _rule_image(520, 18, 6),
|
||||
"vn/rule_small.png": _rule_image(240, 14, 4),
|
||||
"vn/nav_background.png": _solid((96, 8), (0, 0, 0, 0)),
|
||||
"vn/nav_hover_background.png": _nav_marker(130),
|
||||
"vn/nav_selected_background.png": _nav_marker(255),
|
||||
"vn/nav_selected_hover_background.png": _nav_marker(255),
|
||||
"vn/vignette.png": _vignette(),
|
||||
"vn/hairline.png": _hairline(),
|
||||
}
|
||||
result = dict(base)
|
||||
for path, img in base.items():
|
||||
result[f"phone/{path}"] = img
|
||||
if not path.startswith("vn/"): # ornaments are not looked up by variant prefix
|
||||
result[f"phone/{path}"] = img
|
||||
return {f"gui/{path}": img for path, img in sorted(result.items())}
|
||||
|
||||
|
||||
@@ -806,7 +922,11 @@ testcase default:
|
||||
pause 1.0
|
||||
# Actions, not label text: stock menu labels may be translated.
|
||||
run Start()
|
||||
@@PICK@@ advance until eval (e2e_state["end"]) timeout 900
|
||||
@@PICK@@ pause 1.0
|
||||
# A save carries the scene title shown by the load screen.
|
||||
run FileSave(1, confirm=False)
|
||||
assert eval (FileJson(1, "vn_scene") is not None)
|
||||
advance until eval (e2e_state["end"]) timeout 900
|
||||
advance until screen "main_menu" timeout 60
|
||||
@@MENUS@@ assert eval (e2e_state["end"])
|
||||
"""
|
||||
@@ -834,6 +954,8 @@ def render_e2e(styles: dict[str, Any], ui: dict[str, str]) -> str:
|
||||
" run Return()\n"
|
||||
' assert screen "main_menu"\n'
|
||||
)
|
||||
for screen in ("load", "preferences", "about"):
|
||||
menus += f' run ShowMenu("{screen}")\n assert screen "{screen}"\n run Return()\n'
|
||||
return E2E_TESTCASE.replace("@@PICK@@", pick).replace("@@MENUS@@", menus)
|
||||
|
||||
|
||||
|
||||
@@ -28,21 +28,21 @@ define config.check_conflicting_properties = True
|
||||
define gui.accent_color = '#c9a25b'
|
||||
|
||||
## The color used for a text button when it is neither selected nor hovered.
|
||||
define gui.idle_color = '#888888'
|
||||
define gui.idle_color = '#b4a990'
|
||||
|
||||
## The small color is used for small text, which needs to be brighter/darker to
|
||||
## achieve the same effect.
|
||||
define gui.idle_small_color = '#aaaaaa'
|
||||
define gui.idle_small_color = '#cfc4ab'
|
||||
|
||||
## The color that is used for buttons and bars that are hovered.
|
||||
define gui.hover_color = '#dec79c'
|
||||
define gui.hover_color = '#ecd4a0'
|
||||
|
||||
## The color used for a text button when it is selected but not focused. A
|
||||
## button is selected if it is the current screen or preference value.
|
||||
define gui.selected_color = '#ffffff'
|
||||
define gui.selected_color = '#d9b46a'
|
||||
|
||||
## The color used for a text button when it cannot be selected.
|
||||
define gui.insensitive_color = '#8888887f'
|
||||
define gui.insensitive_color = '#7d74647f'
|
||||
|
||||
## Colors used for the portions of bars that are not filled in. These are not
|
||||
## used directly, but are used when re-generating bar image files.
|
||||
@@ -188,10 +188,10 @@ define gui.confirm_button_text_xalign = 0.5
|
||||
|
||||
define gui.page_button_borders = Borders(15, 6, 15, 6)
|
||||
|
||||
define gui.quick_button_borders = Borders(15, 6, 15, 0)
|
||||
define gui.quick_button_text_size = 21
|
||||
define gui.quick_button_borders = Borders(18, 6, 18, 6)
|
||||
define gui.quick_button_text_size = 24
|
||||
define gui.quick_button_text_idle_color = gui.idle_small_color
|
||||
define gui.quick_button_text_selected_color = gui.accent_color
|
||||
define gui.quick_button_text_selected_color = gui.selected_color
|
||||
|
||||
## You can also add your own customizations, by adding properly-named variables.
|
||||
## For example, you can uncomment the following line to set the width of a
|
||||
@@ -211,9 +211,9 @@ define gui.choice_button_borders = Borders(150, 8, 150, 8)
|
||||
define gui.choice_button_text_font = gui.text_font
|
||||
define gui.choice_button_text_size = gui.text_size
|
||||
define gui.choice_button_text_xalign = 0.5
|
||||
define gui.choice_button_text_idle_color = '#888888'
|
||||
define gui.choice_button_text_hover_color = "#ffffff"
|
||||
define gui.choice_button_text_insensitive_color = '#8888887f'
|
||||
define gui.choice_button_text_idle_color = '#cfc4ab'
|
||||
define gui.choice_button_text_hover_color = '#ecd4a0'
|
||||
define gui.choice_button_text_insensitive_color = '#7d74647f'
|
||||
|
||||
|
||||
## File Slot Buttons ###########################################################
|
||||
@@ -237,8 +237,8 @@ define config.thumbnail_width = 384
|
||||
define config.thumbnail_height = 216
|
||||
|
||||
## The number of columns and rows in the grid of save slots.
|
||||
define gui.file_slot_cols = 3
|
||||
define gui.file_slot_rows = 2
|
||||
define gui.file_slot_cols = 1
|
||||
define gui.file_slot_rows = 4
|
||||
|
||||
|
||||
## Positioning and Spacing #####################################################
|
||||
@@ -251,10 +251,10 @@ define gui.file_slot_rows = 2
|
||||
define gui.navigation_xpos = 60
|
||||
|
||||
## The vertical position of the skip indicator.
|
||||
define gui.skip_ypos = 15
|
||||
define gui.skip_ypos = 36
|
||||
|
||||
## The vertical position of the notify screen.
|
||||
define gui.notify_ypos = 68
|
||||
define gui.notify_ypos = 36
|
||||
|
||||
## The spacing between menu choices.
|
||||
define gui.choice_spacing = 33
|
||||
@@ -341,7 +341,7 @@ define config.history_length = 250
|
||||
|
||||
## The height of a history screen entry, or None to make the height variable at
|
||||
## the cost of performance.
|
||||
define gui.history_height = 210
|
||||
define gui.history_height = None
|
||||
|
||||
## Additional space to add between history screen entries.
|
||||
define gui.history_spacing = 0
|
||||
@@ -424,7 +424,7 @@ init python:
|
||||
@gui.variant
|
||||
def touch():
|
||||
|
||||
gui.quick_button_borders = Borders(60, 21, 60, 0)
|
||||
gui.quick_button_borders = Borders(54, 18, 54, 10)
|
||||
|
||||
## This changes the size and spacing of various GUI elements to ensure they
|
||||
## are easily visible on phones.
|
||||
@@ -454,14 +454,13 @@ init python:
|
||||
gui.navigation_spacing = 30
|
||||
gui.pref_button_spacing = 15
|
||||
|
||||
gui.history_height = 285
|
||||
gui.history_text_width = 1035
|
||||
|
||||
gui.quick_button_text_size = 30
|
||||
|
||||
## File button layout.
|
||||
gui.file_slot_cols = 2
|
||||
gui.file_slot_rows = 2
|
||||
gui.file_slot_cols = 1
|
||||
gui.file_slot_rows = 3
|
||||
|
||||
## NVL-mode.
|
||||
gui.nvl_height = None
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 38 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 39 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 39 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 38 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 39 KiB |
@@ -4,12 +4,37 @@
|
||||
## Labels of the scenes the player has reached; updated when a scene starts.
|
||||
default persistent.vn_seen_scenes = set()
|
||||
|
||||
## The scene being played (a label of `vn_scenes`); saved with the game.
|
||||
default vn_current_scene = None
|
||||
|
||||
init python:
|
||||
def vn_mark_scene(label):
|
||||
store.vn_current_scene = label
|
||||
if label not in persistent.vn_seen_scenes:
|
||||
persistent.vn_seen_scenes.add(label)
|
||||
renpy.save_persistent()
|
||||
|
||||
## Save metadata shown by the file slots (screens.rpy): the scene title and the first
|
||||
## line of the text on screen. Text tags are dropped and markup is escaped.
|
||||
VN_EXCERPT_CHARS = 90
|
||||
|
||||
def vn_excerpt(what):
|
||||
line = renpy.filter_text_tags(what or "", allow=[]).strip().split("\n")[0].strip()
|
||||
if len(line) > VN_EXCERPT_CHARS:
|
||||
line = line[:VN_EXCERPT_CHARS].rsplit(" ", 1)[0] + "…"
|
||||
return line.replace("[", "[[").replace("{", "{{")
|
||||
|
||||
def vn_save_json(d):
|
||||
titles = dict((l, t) for l, t in vn_scenes)
|
||||
if store.vn_current_scene in titles:
|
||||
d["vn_scene"] = titles[store.vn_current_scene]
|
||||
if _history_list:
|
||||
last = _history_list[-1]
|
||||
d["vn_who"] = (last.who or "").replace("[", "[[").replace("{", "{{")
|
||||
d["vn_line"] = vn_excerpt(last.what)
|
||||
|
||||
config.save_json_callbacks.append(vn_save_json)
|
||||
|
||||
screen vn_scene_select():
|
||||
|
||||
tag menu
|
||||
@@ -33,6 +58,8 @@ style vn_scenes_button_text is gui_button_text
|
||||
style vn_scenes_button:
|
||||
properties gui.button_properties("navigation_button")
|
||||
xalign 0.0
|
||||
padding (26, 5, 20, 5)
|
||||
background Frame("gui/vn/nav_[prefix_]background.png", 6, 0)
|
||||
|
||||
style vn_scenes_button_text:
|
||||
properties gui.text_properties("navigation_button")
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,244 @@
|
||||
## The strings of vnpipe's template screens (renpy_templates/game/*.rpy) in Spanish (Spain).
|
||||
## Keep in step with the template: tests/test_renpy_gen.py checks every _("...") string.
|
||||
|
||||
translate spanish strings:
|
||||
|
||||
old "Back"
|
||||
new "Atrás"
|
||||
|
||||
old "History"
|
||||
new "Historial"
|
||||
|
||||
old "Skip"
|
||||
new "Saltar"
|
||||
|
||||
old "Auto"
|
||||
new "Auto"
|
||||
|
||||
old "Save"
|
||||
new "Guardar"
|
||||
|
||||
old "Q.Save"
|
||||
new "Guardar rápido"
|
||||
|
||||
old "Q.Load"
|
||||
new "Cargar rápido"
|
||||
|
||||
old "Prefs"
|
||||
new "Opciones"
|
||||
|
||||
old "Start"
|
||||
new "Comenzar"
|
||||
|
||||
old "Load"
|
||||
new "Cargar"
|
||||
|
||||
old "Preferences"
|
||||
new "Opciones"
|
||||
|
||||
old "End Replay"
|
||||
new "Terminar la repetición"
|
||||
|
||||
old "Main Menu"
|
||||
new "Menú principal"
|
||||
|
||||
old "About"
|
||||
new "Acerca de"
|
||||
|
||||
old "Help"
|
||||
new "Ayuda"
|
||||
|
||||
old "Quit"
|
||||
new "Salir"
|
||||
|
||||
old "Return"
|
||||
new "Volver"
|
||||
|
||||
old "Version [config.version!t]\n"
|
||||
new "Versión [config.version!t]\n"
|
||||
|
||||
old "Made with {a=https://www.renpy.org/}Ren'Py{/a} [renpy.version_only].\n\n[renpy.license!t]"
|
||||
new "Hecho con {a=https://www.renpy.org/}Ren'Py{/a} [renpy.version_only].\n\n[renpy.license!t]"
|
||||
|
||||
old "Page {}"
|
||||
new "Página {}"
|
||||
|
||||
old "Automatic saves"
|
||||
new "Autoguardado"
|
||||
|
||||
old "Quick saves"
|
||||
new "Guardado rápido"
|
||||
|
||||
old "empty slot"
|
||||
new "Espacio libre"
|
||||
|
||||
old "Saved game"
|
||||
new "Partida guardada"
|
||||
|
||||
old "{#vn_file_time}%A, %d/%m/%Y · %H:%M"
|
||||
new "{#vn_file_time}%A, %d/%m/%Y · %H:%M"
|
||||
|
||||
old "Delete"
|
||||
new "Borrar"
|
||||
|
||||
old "Autosaves"
|
||||
new "Autoguardado"
|
||||
|
||||
old "Display"
|
||||
new "Pantalla"
|
||||
|
||||
old "Window"
|
||||
new "Ventana"
|
||||
|
||||
old "Fullscreen"
|
||||
new "Pantalla completa"
|
||||
|
||||
old "Unseen Text"
|
||||
new "Texto no leído"
|
||||
|
||||
old "After Choices"
|
||||
new "Tras las elecciones"
|
||||
|
||||
old "Transitions"
|
||||
new "Transiciones"
|
||||
|
||||
old "Text Speed"
|
||||
new "Velocidad del texto"
|
||||
|
||||
old "Auto-Forward Time"
|
||||
new "Avance automático"
|
||||
|
||||
old "Music Volume"
|
||||
new "Volumen de la música"
|
||||
|
||||
old "Sound Volume"
|
||||
new "Volumen de los efectos"
|
||||
|
||||
old "Test"
|
||||
new "Probar"
|
||||
|
||||
old "Voice Volume"
|
||||
new "Volumen de las voces"
|
||||
|
||||
old "Mute All"
|
||||
new "Silenciar todo"
|
||||
|
||||
old "The dialogue history is empty."
|
||||
new "El historial está vacío."
|
||||
|
||||
old "Keyboard"
|
||||
new "Teclado"
|
||||
|
||||
old "Mouse"
|
||||
new "Ratón"
|
||||
|
||||
old "Gamepad"
|
||||
new "Mando"
|
||||
|
||||
old "Enter"
|
||||
new "Intro"
|
||||
|
||||
old "Advances dialogue and activates the interface."
|
||||
new "Avanza el diálogo y activa la interfaz."
|
||||
|
||||
old "Space"
|
||||
new "Espacio"
|
||||
|
||||
old "Advances dialogue without selecting choices."
|
||||
new "Avanza el diálogo sin elegir opciones."
|
||||
|
||||
old "Arrow Keys"
|
||||
new "Flechas"
|
||||
|
||||
old "Navigate the interface."
|
||||
new "Recorren la interfaz."
|
||||
|
||||
old "Escape"
|
||||
new "Esc"
|
||||
|
||||
old "Accesses the game menu."
|
||||
new "Abre el menú del juego."
|
||||
|
||||
old "Ctrl"
|
||||
new "Ctrl"
|
||||
|
||||
old "Skips dialogue while held down."
|
||||
new "Salta el diálogo mientras se mantiene pulsada."
|
||||
|
||||
old "Tab"
|
||||
new "Tab"
|
||||
|
||||
old "Toggles dialogue skipping."
|
||||
new "Activa o desactiva el salto del diálogo."
|
||||
|
||||
old "Page Up"
|
||||
new "Re Pág"
|
||||
|
||||
old "Rolls back to earlier dialogue."
|
||||
new "Vuelve al diálogo anterior."
|
||||
|
||||
old "Page Down"
|
||||
new "Av Pág"
|
||||
|
||||
old "Rolls forward to later dialogue."
|
||||
new "Avanza hasta el diálogo siguiente."
|
||||
|
||||
old "Hides the user interface."
|
||||
new "Oculta la interfaz."
|
||||
|
||||
old "Takes a screenshot."
|
||||
new "Hace una captura de pantalla."
|
||||
|
||||
old "Toggles assistive {a=https://www.renpy.org/l/voicing}self-voicing{/a}."
|
||||
new "Activa o desactiva la {a=https://www.renpy.org/l/voicing}lectura en voz alta{/a}."
|
||||
|
||||
old "Opens the accessibility menu."
|
||||
new "Abre el menú de accesibilidad."
|
||||
|
||||
old "Left Click"
|
||||
new "Clic izquierdo"
|
||||
|
||||
old "Middle Click"
|
||||
new "Clic central"
|
||||
|
||||
old "Right Click"
|
||||
new "Clic derecho"
|
||||
|
||||
old "Mouse Wheel Up"
|
||||
new "Rueda hacia arriba"
|
||||
|
||||
old "Mouse Wheel Down"
|
||||
new "Rueda hacia abajo"
|
||||
|
||||
old "Right Trigger\nA/Bottom Button"
|
||||
new "Gatillo derecho\nA/Botón inferior"
|
||||
|
||||
old "Left Trigger\nLeft Shoulder"
|
||||
new "Gatillo izquierdo\nBotón superior izquierdo"
|
||||
|
||||
old "Right Shoulder"
|
||||
new "Botón superior derecho"
|
||||
|
||||
old "D-Pad, Sticks"
|
||||
new "Cruceta, palancas"
|
||||
|
||||
old "Start, Guide, B/Right Button"
|
||||
new "Start, Guía, B/Botón derecho"
|
||||
|
||||
old "Y/Top Button"
|
||||
new "Y/Botón superior"
|
||||
|
||||
old "Calibrate"
|
||||
new "Calibrar"
|
||||
|
||||
old "Yes"
|
||||
new "Sí"
|
||||
|
||||
old "No"
|
||||
new "No"
|
||||
|
||||
old "Skipping"
|
||||
new "Saltando"
|
||||
|
||||
old "Menu"
|
||||
new "Menú"
|
||||
+63
-4
@@ -1,5 +1,6 @@
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
@@ -434,22 +435,80 @@ def test_scan_and_copy_audio(work, tmp_path):
|
||||
assert "audio/scenes/x.ogg" in audio.files
|
||||
|
||||
|
||||
def test_copy_translations_and_default_language(work, tmp_path):
|
||||
def test_copy_translations_and_forced_language(work, tmp_path):
|
||||
root = tmp_path / "w"
|
||||
(root / "tl/spanish").mkdir(parents=True)
|
||||
(root / "tl/spanish/common.rpy").write_text("translate spanish strings:\n", encoding="utf-8")
|
||||
work_common = "translate spanish strings:\n"
|
||||
(root / "tl/spanish/common.rpy").write_text(work_common, encoding="utf-8")
|
||||
(root / "tl/spanish/extra.rpy").write_text(work_common, encoding="utf-8")
|
||||
data = {**work.data, "ui": {**work.data.get("ui", {}), "language": "spanish"}}
|
||||
out = tmp_path / "out"
|
||||
copied = renpy_gen.copy_translations(type(work)(root=root, data=data), out)
|
||||
assert (out / "game/tl/spanish/common.rpy").is_file()
|
||||
tl = out / "game/tl/spanish"
|
||||
# vnpipe's own translation ships; a work file with the same path replaces it
|
||||
shipped = renpy_gen.TEMPLATE_DIR / "tl/spanish/screens.rpy"
|
||||
assert (tl / "screens.rpy").read_bytes() == shipped.read_bytes()
|
||||
assert (tl / "common.rpy").read_text(encoding="utf-8") == work_common
|
||||
assert (tl / "extra.rpy").is_file()
|
||||
lang = out / "game/language.rpy"
|
||||
assert lang in copied
|
||||
assert lang.read_text(encoding="utf-8") == 'define config.default_language = "spanish"\n'
|
||||
# config.language beats a persistent preference left by an older build
|
||||
assert lang.read_text(encoding="utf-8") == (
|
||||
'define config.default_language = "spanish"\ndefine config.language = "spanish"\n'
|
||||
)
|
||||
# Without [ui].language the stale file is removed.
|
||||
renpy_gen.copy_translations(type(work)(root=tmp_path / "none", data=work.data), out)
|
||||
assert not lang.exists()
|
||||
|
||||
|
||||
def _tl_strings(path: Path) -> list[str]:
|
||||
return re.findall(r'^\s*old "((?:[^"\\]|\\.)*)"$', path.read_text(encoding="utf-8"), re.M)
|
||||
|
||||
|
||||
def test_shipped_spanish_covers_every_template_string():
|
||||
"""Every _("...") string of the template screens has exactly one Spanish translation."""
|
||||
template = ""
|
||||
for path in sorted((renpy_gen.TEMPLATE_DIR / "game").glob("*.rpy")):
|
||||
template += path.read_text(encoding="utf-8")
|
||||
wanted = set(re.findall(r'(?<![\w.])_\("((?:[^"\\]|\\.)*)"\)', template))
|
||||
wanted = {s for s in wanted if "@@" not in s} # work values (title) are already translated
|
||||
assert len(wanted) > 70
|
||||
olds = []
|
||||
for path in sorted((renpy_gen.TEMPLATE_DIR / "tl/spanish").glob("*.rpy")):
|
||||
olds += _tl_strings(path)
|
||||
assert len(olds) == len(set(olds)), "a string translated twice breaks Ren'Py"
|
||||
assert sorted(wanted - set(olds)) == []
|
||||
|
||||
|
||||
def test_no_sync_buttons(project):
|
||||
options = (project / "game/options.rpy").read_text(encoding="utf-8")
|
||||
assert "define config.has_sync = False" in options
|
||||
screens = (project / "game/screens.rpy").read_text(encoding="utf-8")
|
||||
assert "UploadSync" not in screens and "DownloadSync" not in screens
|
||||
|
||||
|
||||
def test_menu_ornaments_are_deterministic():
|
||||
a, b = renpy_gen.gui_extra_images(), renpy_gen.gui_extra_images()
|
||||
assert a.keys() == b.keys()
|
||||
assert all(a[k].tobytes() == b[k].tobytes() for k in a)
|
||||
for name in ("card_background", "card_hover_background", "rule", "nav_selected_background"):
|
||||
assert f"gui/vn/{name}.png" in a
|
||||
assert "gui/phone/vn/rule.png" not in a # ornaments are not looked up per variant
|
||||
rule = a["gui/vn/rule.png"]
|
||||
mid = rule.height // 2
|
||||
# bright in the middle, faded at the ends
|
||||
assert rule.getpixel((0, mid))[3] < 10 and rule.getpixel((rule.width // 3, mid))[3] == 255
|
||||
|
||||
|
||||
def test_save_metadata_and_slots(project):
|
||||
menus = (project / "game/menus.rpy").read_text(encoding="utf-8")
|
||||
assert "config.save_json_callbacks.append(vn_save_json)" in menus
|
||||
assert "store.vn_current_scene = label" in menus
|
||||
screens = (project / "game/screens.rpy").read_text(encoding="utf-8")
|
||||
assert 'info.get("vn_scene")' in screens and 'info["vn_line"]' in screens
|
||||
assert "FileDelete(slot)" in screens and "vn_roman(page)" in screens
|
||||
|
||||
|
||||
def test_mood_directory_is_a_playlist(work, annotated):
|
||||
block = scene_block(renpy_gen.render_script(work, annotated, _audio()), "lyric")
|
||||
assert _music_lines(block) == [
|
||||
|
||||
Reference in new issue
Block a user