Merge pull request #1774 from thibautbus/fix/translate-pcmenu-changebox-save

Translate the PC's CHANGE BOX save flow
This commit is contained in:
bryanthaboi
2026-08-24 11:33:52 -04:00
committed by GitHub
4 changed files with 212 additions and 46 deletions
+17 -10
View File
@@ -38,9 +38,12 @@ local MON_HOLDING_MAIL = {
Strings.source("Please remove the\nMAIL."),
}
-- _ChangeBoxSaveText (data/text/common_2.asm:1306) is three lines whose `cont`
-- has already scrolled by the time YesNoBox goes up over its last two.
local CHANGE_BOX_SAVE = { "#MON BOX, data", "will be saved. OK?" }
-- _ChangeBoxSaveText (data/text/common_2.asm:1306) is three lines whose first
-- `cont` ("When you change a") has already scrolled by the time YesNoBox goes
-- up over its last two -- confirmed against poke-corpus GoldSilver
-- en_msg.txt:4897. One \n-joined translatable key, same pattern as
-- SaveMenu.lua's OVERWRITE_PROMPT_SOURCE/SAVING_PROMPT_SOURCE.
local CHANGE_BOX_SAVE_SOURCE = Strings.source("#MON BOX, data\nwill be saved. OK?")
-- YesNoBox's own `lb bc, SCREEN_WIDTH - 6, 7` (home/menu.asm:382-383).
local YESNO_X, YESNO_Y, YESNO_W, YESNO_H = 14, 7, 6, 5
@@ -212,16 +215,20 @@ function PcMenu:writeChangeBox()
end
function PcMenu:savePrompt()
if self.savePhase == "overwrite" then return SaveMenu.OVERWRITE_PROMPT end
if self.savePhase == "saving" then return SaveMenu.SAVING_PROMPT end
if self.savePhase == "overwrite" then
return SaveMenu.twoLines(Strings(SaveMenu.OVERWRITE_PROMPT_SOURCE))
end
if self.savePhase == "saving" then
return SaveMenu.twoLines(Strings(SaveMenu.SAVING_PROMPT_SOURCE))
end
if self.savePhase == "done" then
if self.saved then
local name = (self.save.player and self.save.player.name) or "GOLD"
return { name .. " saved", "the game." }
return SaveMenu.twoLines(Strings("%s saved\nthe game.", name))
end
return { "Could not save.", "" }
return SaveMenu.twoLines(Strings("Could not save."))
end
return CHANGE_BOX_SAVE
return SaveMenu.twoLines(Strings(CHANGE_BOX_SAVE_SOURCE))
end
function PcMenu:updateChangeBox()
@@ -404,8 +411,8 @@ function PcMenu:drawPanel()
Chrome.print(lines[2] or "", 1, 16)
if self.savePhase == "confirm" or self.savePhase == "overwrite" then
Chrome.box(YESNO_X, YESNO_Y, YESNO_W, YESNO_H)
Chrome.print("YES", YESNO_X + 2, YESNO_Y + 1)
Chrome.print("NO", YESNO_X + 2, YESNO_Y + 3)
Chrome.print(Strings("YES"), YESNO_X + 2, YESNO_Y + 1)
Chrome.print(Strings("NO"), YESNO_X + 2, YESNO_Y + 3)
Chrome.cursor(YESNO_X + 1,
YESNO_Y + (self.saveChoice == 1 and 1 or 3))
end
+17 -22
View File
@@ -57,27 +57,21 @@ local TIME_X, TIME_Y = 13, 8
local YESNO_X, YESNO_Y, YESNO_W, YESNO_H = 0, 7, 6, 5
-- AlreadyASaveFileText (AskOverwriteSaveFile, engine/menus/save.asm:47) and
-- SavingDontTurnOffThePower's own line, shared with the PC's CHANGE BOX save
-- (src/ui/gen2/PcMenu.lua:savePrompt() reads these two tables' lines[1]/
-- lines[2] directly, so their shape is a cross-file contract: keep them
-- plain, untranslated tables).
local OVERWRITE_PROMPT = { "There is already a", "save file. Is it" }
local SAVING_PROMPT = { "SAVING… DON'T TURN", "OFF THE POWER." }
-- Translatable copies of the two prompts above, one \n-joined key each, used
-- only by this screen's own prompt() below. One key per prompt lets a
-- translation write one whole, freely reordered sentence instead of two
-- fragments translated in isolation, and lets a cart whose own text is a
-- single line (German's SAVING prompt) say so directly by simply omitting
-- the "\n" -- the per-line override style used elsewhere requires a
-- non-empty value for every line, so it can't express "this line is blank".
-- SavingDontTurnOffThePower's own line -- one \n-joined translatable key
-- each, used both by this screen's own prompt() below and, through the
-- SOURCE/twoLines() exports at the bottom of this file, by the PC's CHANGE
-- BOX save (src/ui/gen2/PcMenu.lua:savePrompt()), which shares these exact
-- same two cart messages. One key per prompt lets a translation write one
-- whole, freely reordered sentence instead of two fragments translated in
-- isolation, and lets a cart whose own text is a single line (German's
-- SAVING prompt) say so directly by simply omitting the "\n" -- the
-- per-line override style used elsewhere requires a non-empty value for
-- every line, so it can't express "this line is blank".
--
-- Written as literals, not `table.concat(OVERWRITE_PROMPT, "\n")`: the
-- translation tooling's string harvester only recognizes a literal inside
-- Strings.source(...), not a computed expression, so a concat call here
-- would quietly never reach a translator. Keep byte-for-byte in sync with
-- OVERWRITE_PROMPT/SAVING_PROMPT above (checked by
-- tests/engine/gen2_save_menu_translation_test.lua).
-- Written as a literal, not built from a table: the translation tooling's
-- string harvester only recognizes a literal inside Strings.source(...),
-- not a computed expression, so a concat call here would quietly never
-- reach a translator.
local OVERWRITE_PROMPT_SOURCE = Strings.source("There is already a\nsave file. Is it")
local SAVING_PROMPT_SOURCE = Strings.source("SAVING… DON'T TURN\nOFF THE POWER.")
@@ -279,7 +273,8 @@ end
SaveMenu.SFX_SAVE = SFX_SAVE
SaveMenu.SAVING_FRAMES = SAVING_FRAMES
SaveMenu.SAVED_FRAMES = SAVED_FRAMES
SaveMenu.OVERWRITE_PROMPT = OVERWRITE_PROMPT
SaveMenu.SAVING_PROMPT = SAVING_PROMPT
SaveMenu.OVERWRITE_PROMPT_SOURCE = OVERWRITE_PROMPT_SOURCE
SaveMenu.SAVING_PROMPT_SOURCE = SAVING_PROMPT_SOURCE
SaveMenu.twoLines = twoLines
return SaveMenu