Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.
Swift apple-siliconcustom-formathomebrewiosipaipadipadosiphonemetalnative-portnintendo-switchnxnativeromfsswitch-games
Windows: guide the two Apple downloads, fold the deps panel, name the fix
LNPANDY64d56caf11bb
diff --git a/frontend-qt/nspb_qt/localization.py b/frontend-qt/nspb_qt/localization.pyindex 016139e5..3ec36148 100644--- a/frontend-qt/nspb_qt/localization.py+++ b/frontend-qt/nspb_qt/localization.py@@ -12,6 +12,8 @@ TABLE: dict[str, tuple[str, str, str]] = {'onboarding.welcome.note': ('约 15 分钟,即可在 Mac 上原生运行你的 Switch 游戏。', 'Play your Switch games natively on your Mac, in about 15 minutes.', 'Spela dina Switch-spel direkt på din Mac på ungefär 15 minuter.'),'onboarding.platform.title': ('你想在哪里玩?', 'Where do you want to play?', 'Var vill du spela?'),'onboarding.platform.note': ('选择游玩设备,我们会准备所需的工具。', 'Choose where you will play. We will prepare just what you need.', 'Välj var du ska spela. Vi förbereder bara det du behöver.'),+ 'onboarding.nvn.os': ('部分游戏需要 Xcode 27.1,而它需要 macOS 26.6 或更高版本。在这台 Mac 上,使用 NVN 的游戏无法构建,其他游戏不受影响。', 'Some games need Xcode 27.1, which needs macOS 26.6 or later. On this Mac, games that use NVN won’t build, but others will.', 'Some games need Xcode 27.1, which needs macOS 26.6 or later. On this Mac, games that use NVN won’t build, but others will.'),+ 'onboarding.nvn.xcode': ('这个 Xcode 低于 27.1,而使用 NVN 的游戏需要 27.1。如果你的 macOS 支持,请在 App Store 中更新 Xcode。其他游戏用当前版本即可构建。', 'This Xcode is older than 27.1, which games that use NVN need. Update Xcode in the App Store if your macOS allows it. Other games build with this one.', 'This Xcode is older than 27.1, which games that use NVN need. Update Xcode in the App Store if your macOS allows it. Other games build with this one.'),'onboarding.xcode.title': ('准备好你的 Mac。', 'Let’s get your Mac ready.', 'Gör din Mac redo.'),'onboarding.xcode.note': ('Xcode 提供构建游戏所需的 Apple 工具。我们将引导你完成设置。', 'Xcode provides Apple’s tools for building your games. We will guide you through the setup.', 'Xcode tillhandahåller Apples verktyg för att bygga dina spel. Vi guidar dig genom inställningen.'),'onboarding.keys.title': ('添加你的密钥。', 'Bring your own keys.', 'Ange dina nycklar.'),@@ -57,7 +59,7 @@ TABLE: dict[str, tuple[str, str, str]] = {'onboarding.xcode.checking': ('正在检查 Xcode…', 'Checking Xcode…', 'Kontrollerar Xcode …'),'onboarding.xcode.checkingNote': ('正在查找游戏所需的工具。', 'Looking for the tools your games need.', 'Söker efter verktygen som dina spel behöver.'),'onboarding.xcode.missing': ('先获取 Xcode。', 'First, get Xcode.', 'Hämta först Xcode.'),- 'onboarding.xcode.missingNote': ('从 App Store 下载 Xcode。这是设置中最大的下载项目。', 'Download Xcode from the App Store. This is the largest part of setup.', 'Hämta Xcode från App Store. Det är den största delen av inställningen.'),+ 'onboarding.xcode.missingNote': ('从 App Store 下载 Xcode(免费)——这是设置中最大的下载项。下载完成后我们会自动继续。首次打开 Xcode 会提示安装 iOS SDK——让它装完。', 'Download Xcode from the App Store (free) — this is the largest part of setup. We will continue automatically when it is installed. The first launch of Xcode will prompt to install the iOS SDK — let it finish.', 'Hämta Xcode från App Store. Det är den största delen av inställningen.'),'onboarding.xcode.downloading': ('正在等待 Xcode…', 'Waiting for Xcode…', 'Väntar på Xcode …'),'onboarding.xcode.downloadNote': ('请让 App Store 继续下载。Xcode 安装完成后,我们会自动继续。', 'Leave the App Store download running. We will continue automatically when Xcode is installed.', 'Låt nedladdningen i App Store fortsätta. Vi fortsätter automatiskt när Xcode är installerat.'),'onboarding.xcode.needsSetup': ('完成 Xcode 的最后一步。', 'One last step for Xcode.', 'Ett sista steg för Xcode.'),@@ -71,6 +73,7 @@ TABLE: dict[str, tuple[str, str, str]] = {'onboarding.setup.ios': ('iOS 平台', 'iOS platform', 'iOS-plattform'),'onboarding.background.title': ('正在后台准备', 'Preparing in the background', 'Förbereder i bakgrunden'),'onboarding.background.note': ('这些工具将在设置 Xcode 时准备就绪。', 'These tools get ready while you set up Xcode.', 'De här verktygen förbereds medan du ställer in Xcode.'),+ 'onboarding.background.installing': ('正在安装…', 'Installing…', 'Installing…'),'onboarding.background.python': ('Python', 'Python', 'Python'),'onboarding.background.dotnet': ('.NET', '.NET', '.NET'),'onboarding.background.tools': ('构建工具', 'Build tools', 'Byggverktyg'),@@ -98,6 +101,108 @@ TABLE: dict[str, tuple[str, str, str]] = {'onboarding.demo.library': ('游戏库将在此打开。', 'Your library would open here.', 'Ditt spelbibliotek skulle öppnas här.'),'onboarding.demo.note': ('这是预览。未读取任何文件,也未安装任何工具。', 'This is a preview. No files were read and no tools were installed.', 'Det här är en förhandsvisning. Inga filer lästes och inga verktyg installerades.'),'onboarding.demo.resume': ('继续设置', 'Resume setup', 'Fortsätt inställningen'),+ 'console.kind.gamepad': ('游戏手柄', 'Gamepad', 'Gamepad'),+ 'console.kind.fullSize': ('全尺寸手柄', 'Full-size pad', 'Full-size pad'),+ 'console.kind.paired': ('双体手柄', 'Paired controllers', 'Paired controllers'),+ 'console.kind.xbox': ('Xbox 型手柄', 'Xbox-style pad', 'Xbox-style pad'),+ 'console.kind.keyboard': ('键盘', 'Keyboard', 'Keyboard'),+ 'console.batteryPercent': ('%d%%', '%d%%', '%d%%'),+ 'console.batteryLevel': ('电量百分之 %d', 'Battery %d percent', 'Battery %d percent'),+ 'console.batteryCharging': ('电量百分之 %d,正在充电', 'Battery %d percent, charging', 'Battery %d percent, charging'),+ 'console.charging': ('正在充电', 'Charging', 'Charging'),+ 'console.batteryUnknown': ('未报告电量', 'Battery not reported', 'Battery not reported'),+ 'console.identify': ('识别', 'Identify', 'Identify'),+ 'console.identifying': ('正在识别…', 'Identifying…', 'Identifying…'),+ 'console.identifyingName': ('正在识别 %@…', 'Identifying %@…', 'Identifying %@…'),+ 'console.assign': ('分配玩家', 'Assign player', 'Assign player'),+ 'console.disconnect': ('断开连接', 'Disconnect', 'Disconnect'),+ 'console.playerMode': ('玩家模式', 'Player mode', 'Player mode'),+ 'console.mergeAll': ('所有手柄均为玩家 1', 'All controllers are player 1', 'All controllers are player 1'),+ 'console.mergeNote': ('打开后,每个手柄都按玩家 1 输入。关闭时,每个手柄各有自己的玩家。仅对在 Mac 上运行的游戏生效。', 'Every controller sends player 1’s input. When off, each controller is its own player. Applies to games running on this Mac.', 'Every controller sends player 1’s input. When off, each controller is its own player. Applies to games running on this Mac.'),+ 'console.disconnectHint': ('在 macOS 的蓝牙设置中断开这个手柄。', 'Disconnect it in the macOS Bluetooth settings.', 'Disconnect it in the macOS Bluetooth settings.'),+ 'console.promptSetting': ('插入手柄时提示进入主机模式', 'Offer console mode when a controller connects', 'Offer console mode when a controller connects'),+ 'console.promptSettingNote': ('每次启动最多提示一次。', 'At most once each time the launcher starts.', 'At most once each time the launcher starts.'),+ 'console.menuLeave': ('退出主机模式', 'Leave Console Mode', 'Leave Console Mode'),+ 'console.promptNever': ('不再提示', 'Don’t ask again', 'Don’t ask again'),+ 'console.notBuilt': ('尚未构建', 'Not built yet', 'Not built yet'),+ 'console.needsDataBadge': ('需要游戏数据', 'Needs game data', 'Needs game data'),+ 'console.iphoneOnly': ('仅 iPhone 版', 'iPhone only', 'iPhone only'),+ 'console.iphoneOnlyNote': ('这款游戏只构建了 iPhone 版。请在桌面模式的“构建”页面构建 Mac 版,之后就能在这里游玩。', 'This game is built for iPhone only. Build it for Mac on the Builds page in desktop mode, then play it here.', 'This game is built for iPhone only. Build it for Mac on the Builds page in desktop mode, then play it here.'),+ 'console.explanationTitle': ('暂时无法游玩', 'Not ready to play', 'Not ready to play'),+ 'console.connectedNextPlayer': ('%@ 已连接,玩家 %d', '%@ connected, player %d', '%@ connected, player %d'),+ 'console.noFreePlayer': ('四位玩家都已占用。请打开手柄页面调整。', 'All four players are taken. Open Controllers to change them.', 'All four players are taken. Open Controllers to change them.'),+ 'console.controllersRowNote': ('查看已连接的手柄,识别、分配玩家。', 'See connected controllers, identify them and assign players.', 'See connected controllers, identify them and assign players.'),+ 'console.controllersOpen': ('打开…', 'Open…', 'Open…'),+ 'console.promptSelectBefore': ('随时按', 'Press', 'Press'),+ 'console.promptSelectAfter': ('键即可切换。', 'anytime to switch.', 'anytime to switch.'),+ 'console.mergeOff': ('现在每个手柄各是一位玩家。', 'Each controller is now its own player.', 'Each controller is now its own player.'),+ 'console.assignedTo': ('%@ 是玩家 %d', '%@ is player %d', '%@ is player %d'),+ 'console.assignCancelled': ('已取消分配玩家。', 'Player assignment cancelled.', 'Player assignment cancelled.'),+ 'console.assignTimeout': ('没有按键。请重新选择玩家再试一次。', 'No button was pressed. Choose a player to try again.', 'No button was pressed. Choose a player to try again.'),+ 'console.mergeEach': ('每个手柄对应一位玩家', 'Each controller is its own player', 'Each controller is its own player'),+ 'console.mockPress': ('模拟按下按钮', 'Simulate a button press', 'Simulate a button press'),+ 'console.connectedUnassigned': ('%@ 已连接', '%@ connected', '%@ connected'),+ 'console.connected': ('%@ 已连接,玩家 %d', '%@ connected, player %d', '%@ connected, player %d'),+ 'console.disconnected': ('%@ 已断开连接', '%@ disconnected', '%@ disconnected'),+ 'console.demoXbox': ('Xbox 手柄', 'Xbox controller', 'Xbox controller'),+ 'console.demoKeyboard': ('键盘', 'Keyboard', 'Keyboard'),+ 'console.demoPaired': ('双体手柄', 'Paired controllers', 'Paired controllers'),+ 'console.shaders': ('正在编译着色器', 'Compiling shaders', 'Compiling shaders'),+ 'console.shadersProgress': ('正在编译着色器 · %d / %d', 'Compiling shaders · %d of %d', 'Compiling shaders · %d of %d'),+ 'console.openingGame': ('正在打开游戏窗口…', 'Opening game window…', 'Opening game window…'),+ 'console.simulatedShaders': ('此预览中的进度为模拟进度', 'Simulated progress in this preview', 'Simulated progress in this preview'),+ 'console.brand': ('NX2Apple', 'NX2Apple', 'NX2Apple'),+ 'console.entry': ('主机模式', 'Console mode', 'Console mode'),+ 'console.connectionTitle': ('切换到主机模式?', 'Switch to console mode?', 'Switch to console mode?'),+ 'console.connectionNote': ('手柄已连接。在大屏幕上选择并畅玩游戏。', 'A controller is connected. Your games, ready for the big screen.', 'A controller is connected. Your games, ready for the big screen.'),+ 'console.later': ('留在桌面模式', 'Stay on desktop', 'Stay on desktop'),+ 'console.library': ('你的游戏', 'YOUR GAMES', 'YOUR GAMES'),+ 'console.ready': ('可以开始游戏', 'Ready to play', 'Ready to play'),+ 'console.setup': ('在 Mac 上完成设置', 'Set up on your Mac', 'Set up on your Mac'),+ 'console.unavailable': ('需要处理', 'Needs attention', 'Needs attention'),+ 'console.needsBuild': ('先在 Mac 上构建此游戏,然后回来开始游戏。', 'Build this game on your Mac, then come back to play.', 'Build this game on your Mac, then come back to play.'),+ 'console.needsData': ('先在桌面模式中选择游戏数据,然后回来开始游戏。', 'Choose this game’s data in desktop mode, then come back to play.', 'Choose this game’s data in desktop mode, then come back to play.'),+ 'console.broken': ('此游戏需要在桌面模式中处理。', 'This game needs attention in desktop mode.', 'This game needs attention in desktop mode.'),+ 'console.platform.mac': ('Mac', 'Mac', 'Mac'),+ 'console.platform.iphone': ('iPhone', 'iPhone', 'iPhone'),+ 'console.version': ('版本 %@', 'Version %@', 'Version %@'),+ 'console.play': ('开始游戏', 'Play', 'Play'),+ 'console.playHint': ('开始游戏,或了解如何完成设置。', 'Play, or learn how to finish setup.', 'Play, or learn how to finish setup.'),+ 'console.options': ('游戏选项', 'Game options', 'Game options'),+ 'console.controllers': ('手柄', 'Controllers', 'Controllers'),+ 'console.desktop': ('返回桌面', 'Back to desktop', 'Back to desktop'),+ 'console.close': ('返回', 'Back', 'Back'),+ 'console.empty': ('还没有游戏', 'No games yet', 'No games yet'),+ 'console.emptyNote': ('在 Mac 上构建一个游戏。', 'Build one on your Mac.', 'Build one on your Mac.'),+ 'console.starting': ('正在启动 %@…', 'Starting %@…', 'Starting %@…'),+ 'console.startingNote': ('正在准备游戏', 'Getting your game ready', 'Getting your game ready'),+ 'console.noOptions': ('此游戏没有启动选项。', 'This game has no launch options.', 'This game has no launch options.'),+ 'console.adjustHint': ('使用左右方向键调整。', 'Use left or right to adjust.', 'Use left or right to adjust.'),+ 'console.on': ('开启', 'On', 'On'),+ 'console.off': ('关闭', 'Off', 'Off'),+ 'console.noControllers': ('未连接手柄', 'No controllers connected', 'No controllers connected'),+ 'console.player': ('玩家 %d', 'Player %d', 'Player %d'),+ 'console.playerShort': ('P%d', 'P%d', 'P%d'),+ 'console.unassigned': ('未分配', 'Unassigned', 'Unassigned'),+ 'console.pressToAssign': ('按下一个按钮以分配玩家 %d。', 'Press a button to assign player %d.', 'Press a button to assign player %d.'),+ 'console.controllerNote': ('选择玩家,然后按下该玩家手柄上的按钮。', 'Choose a player, then press a button on their controller.', 'Choose a player, then press a button on their controller.'),+ 'console.desktopPreview': ('已返回桌面模式', 'Back on desktop', 'Back on desktop'),+ 'console.desktopPreviewNote': ('预览已结束。游戏库保持不变。', 'Preview complete. Your library stays as it is.', 'Preview complete. Your library stays as it is.'),+ 'console.return': ('返回主机模式', 'Return to console', 'Return to console'),+ 'console.resolution': ('分辨率缩放', 'Resolution scale', 'Resolution scale'),+ 'console.frameRate': ('帧率', 'Frame rate', 'Frame rate'),+ 'console.fps30': ('30 帧/秒', '30 fps', '30 fps'),+ 'console.fps60': ('60 帧/秒', '60 fps', '60 fps'),+ 'console.language': ('游戏语言', 'Game language', 'Game language'),+ 'console.english': ('英语', 'English', 'English'),+ 'console.chinese': ('中文', 'Chinese', 'Chinese'),+ 'console.japanese': ('日语', 'Japanese', 'Japanese'),+ 'console.fullscreen': ('全屏', 'Full screen', 'Full screen'),+ 'console.rumble': ('手柄振动', 'Controller vibration', 'Controller vibration'),+ 'console.demoBroken': ('上次构建未完成。请在 Mac 上重新构建。', 'The last build did not finish. Rebuild it on your Mac.', 'The last build did not finish. Rebuild it on your Mac.'),+ 'console.demoController': ('无线手柄', 'Wireless controller', 'Wireless controller'),+ 'console.demoController2': ('全尺寸手柄', 'Full-size controller', 'Full-size controller'),+ 'console.demoController3': ('USB 手柄', 'USB controller', 'USB controller'),'library.readyIOS': ('可用于 iPhone', 'Ready for iPhone', 'Klar för iPhone'),'library.stopping': ('正在停止…', 'Stopping…', 'Avslutar …'),'build.setup': ('完成设置', 'Finish setup', 'Slutför inställningen'),@@ -121,7 +226,7 @@ TABLE: dict[str, tuple[str, str, str]] = {'dev.noDevices': ('没有与这台 Mac 配对的 iPhone 或 iPad(需要 Xcode)。', 'No iPhone or iPad paired with this Mac (needs Xcode).', 'Ingen iPhone eller iPad är parkopplad med den här Mac-datorn (Xcode krävs).'),'dev.refresh': ('刷新', 'Refresh', 'Uppdatera'),'dev.team': ('签名团队', 'Signing team', 'Signeringsteam'),- 'dev.noTeam': ('Xcode 里没有 Apple ID,也没有开发证书。请在 Xcode → 设置 → 账户中登录。', 'No Apple ID in Xcode and no development certificate. Sign in to Xcode → Settings → Accounts.', 'Det finns inget Apple-ID i Xcode och inget utvecklarcertifikat. Logga in i Xcode → Inställningar → Konton.'),+ 'dev.noTeam': ('Xcode 里没有 Apple ID,也没有开发证书。打开 Xcode → Settings → Apple Accounts(Xcode 菜单没有中文),登录 Apple ID 后选 Personal Team → Download Manual Profiles。证书不会立刻出现——等 30 秒左右再按「重新检测」。如果等了还没有,在 Manage Certificates 里点 + 手动创建一个 Apple Development 证书。', 'No Apple ID in Xcode and no development certificate. Open Xcode → Settings → Apple Accounts (Xcode menus are English-only), sign in with your Apple ID, select Personal Team → Download Manual Profiles. The certificate does not appear immediately — wait ~30 seconds and press Check again. If it still does not appear, click + in Manage Certificates to create an Apple Development certificate manually.', 'Det finns inget Apple-ID i Xcode och inget utvecklarcertifikat. Logga in i Xcode → Inställningar → Konton.'),'dev.teamNoCert': ('这个团队还没有开发证书:第一次安装时 Xcode 会自动创建(Mac 需要联网)。', 'This team has no development certificate yet: Xcode creates it at the first install (the Mac needs to be online).', 'Det här teamet saknar utvecklarcertifikat. Xcode skapar det automatiskt vid första installationen och Mac-datorn måste vara ansluten till internet.'),'dev.personalTeam': ('个人团队', 'Personal team', 'Personligt team'),'dev.note': ('Xcode 会为这台设备签名并直接安装,游戏数据(romfs.img)复制到 App 的“文稿”中,与侧载相同。第一次复制大型游戏需要几分钟。第一次需要在设备上开启开发者模式,并信任开发者(设置 → 通用 → VPN 与设备管理)。', 'Xcode signs the game for this device and installs it there, then copies the game data (romfs.img) into the app’s Documents, as for sideloading. The first copy of a large game takes a few minutes. The first time, turn on Developer Mode on the device and trust the developer (Settings → General → VPN & Device Management).', 'Xcode signerar spelet för den här enheten och installerar det där. Därefter kopieras speldata (romfs.img) till appens Dokument, som vid sidoinläsning. Första kopieringen av ett stort spel tar några minuter. Aktivera utvecklarläge på enheten och lita på utvecklaren första gången (Inställningar → Allmänt → VPN och enhetshantering).'),@@ -167,6 +272,32 @@ TABLE: dict[str, tuple[str, str, str]] = {'dev.signFailed': ('签名失败:%@', 'Signing failed: %@', 'Signeringen misslyckades: %@'),'dev.installFailed': ('安装失败:%@', 'Installing failed: %@', 'Installationen misslyckades: %@'),'dev.noProject': ('没有找到:%@', 'Not found: %@', 'Hittades inte: %@'),+ 'dev.reinstall': ('重装', 'Reinstall', 'Reinstall'),+ 'dev.reinstallStage': ('重装到 %@', 'Reinstalling on %@', 'Reinstalling on %@'),+ 'dev.reinstalled': ('已重新安装到 %@(游戏数据保留)', 'Reinstalled on %@ (the game data is kept)', 'Reinstalled on %@ (the game data is kept)'),+ 'dev.reinstallFailed': ('重装失败:%@(签名已过期时请重新签名并安装)', 'Reinstalling failed: %@ (if the signature has expired, sign and install again)', 'Reinstalling failed: %@ (if the signature has expired, sign and install again)'),+ 'dev.reinstallMissing': ('找不到已签名的 App:%@(请重新构建)', 'The signed app is not there: %@ (build again)', 'The signed app is not there: %@ (build again)'),+ 'dev.signedApp': ('已签名的 App', 'Signed app', 'Signed app'),+ 'dev.saveIPA': ('保存 IPA…', 'Save IPA…', 'Save IPA…'),+ 'dev.saveIPATitle': ('保存已签名的 IPA', 'Save the signed IPA', 'Save the signed IPA'),+ 'dev.saveStage': ('打包 IPA', 'Packing the IPA', 'Packing the IPA'),+ 'dev.savedIPA': ('已保存 IPA:%@', 'Saved the IPA: %@', 'Saved the IPA: %@'),+ 'dev.saveFailed': ('保存 IPA 失败:%@(请检查目标位置的可用空间和写入权限)', 'Saving the IPA failed: %@ (check free space and write permission at the destination)', 'Saving the IPA failed: %@ (check free space and write permission at the destination)'),+ 'dev.saveNeedsApp': ('没有可打包的已签名 App:%@(请重新构建)', 'No signed app to pack: %@ (build again)', 'No signed app to pack: %@ (build again)'),+ 'dev.expiry': ('签名到期:%@(剩 %d 天)', 'Signature expires: %@ (%d days left)', 'Signature expires: %@ (%d days left)'),+ 'dev.expiryToday': ('签名今天到期(%@)', 'Signature expires today (%@)', 'Signature expires today (%@)'),+ 'dev.expiryPast': ('签名已过期(%@,%d 天前)', 'Signature expired %@ (%d days ago)', 'Signature expired %@ (%d days ago)'),+ 'dev.expiryShort': ('签名剩 %d 天', '%d days of signature left', '%d days of signature left'),+ 'dev.expiryTodayShort': ('签名今天到期', 'signature expires today', 'signature expires today'),+ 'dev.expiryExpiredShort': ('签名已过期', 'signature expired', 'signature expired'),+ 'dev.expiryUnknown': ('签名到期:未知(仍可续签)', 'Signature expiry: unknown (re-signing is still offered)', 'Signature expiry: unknown (re-signing is still offered)'),+ 'dev.resign': ('续签', 'Re-sign', 'Re-sign'),+ 'dev.resignHelp': ('用缓存工程重新签名并安装:不重新编译游戏,App 数据(存档、游戏数据)保留', "Sign and install again from the cached project: no rebuild, and the app's data (saves, game data) is kept", "Sign and install again from the cached project: no rebuild, and the app's data (saves, game data) is kept"),+ 'dev.resignStage': ('续签并安装到 %@', 'Re-signing for %@', 'Re-signing for %@'),+ 'dev.resigned': ('已续签并安装到 %@', 'Re-signed and installed on %@', 'Re-signed and installed on %@'),+ 'dev.resignFailed': ('续签失败:%@(请在 Xcode → 设置 → 账户 → Manage Certificates 检查证书,或确认网络)', 'Re-signing failed: %@ (check the certificate in Xcode → Settings → Accounts → Manage Certificates, or the network)', 'Re-signing failed: %@ (check the certificate in Xcode → Settings → Accounts → Manage Certificates, or the network)'),+ 'dev.resignNoProject': ('找不到缓存的 Xcode 工程:%@(请重新构建一次)', 'The cached Xcode project is not there: %@ (build once more)', 'The cached Xcode project is not there: %@ (build once more)'),+ 'dev.resignNoTeam': ('续签需要签名团队:请选择签名团队后再试。', 'Re-signing needs a signing team: pick one first.', 'Re-signing needs a signing team: pick one first.'),'prog.eta': ('还剩 %@', '%@ left', '%@ kvar'),'activity.mac': ('正在构建 Mac 版', 'Mac build in progress', 'Mac-byggning pågår'),'activity.ios': ('正在构建 iPhone 版', 'iPhone build in progress', 'iPhone-byggning pågår'),@@ -452,7 +583,7 @@ TABLE: dict[str, tuple[str, str, str]] = {'dep.installTimeout': ('安装超时(30 分钟)——网络太慢或卡住了', 'Install timed out (30 minutes) — the network is slow or stuck', 'Installationen överskred tidsgränsen på 30 minuter. Nätverket kan vara långsamt eller ha fastnat.'),'dep.installAll': ('一键安装全部缺失项', 'Install all missing', 'Installera alla som saknas'),'diag.title': ('诊断信息', 'Diagnostics', 'Diagnostik'),- 'diag.note': ('用于问题报告:版本、工具和上次构建的日志,不含密钥。', 'For a bug report: versions, tools, the last build’s log. No keys.', 'För en felrapport: versioner, verktyg och loggen från senaste bygget. Inga nycklar.'),+ 'diag.note': ('用于问题报告:版本、工具、上次构建的日志和所选游戏的日志,不含密钥。', 'For a bug report: versions, tools, the last build’s log and the selected game’s log. No keys.', 'För en felrapport: versioner, verktyg och loggen från senaste bygget. Inga nycklar.'),'diag.copy': ('复制诊断信息', 'Copy diagnostics', 'Kopiera diagnostik'),'diag.copied': ('已复制', 'Copied', 'Kopierad'),'dep.recheck': ('重新检测', 'Check again', 'Kontrollera igen'),@@ -462,7 +593,7 @@ TABLE: dict[str, tuple[str, str, str]] = {'dep.xcode': ('Xcode + iOS SDK', 'Xcode + iOS SDK', 'Xcode + iOS SDK'),'dep.xcode.notSelected': ('Xcode 已安装,但 xcode-select 还指向 CommandLineTools——点「修复」会切换到 Xcode 并完成首次启动(会要管理员密码)。', 'Xcode is installed, but xcode-select still points at CommandLineTools — Fix switches to Xcode and finishes its first launch (asks for your admin password).', 'Xcode är installerat men xcode-select pekar fortfarande på CommandLineTools. Välj ”Åtgärda” för att byta till Xcode och slutföra första starten. Administratörslösenord krävs.'),'dep.xcode.fix': ('修复', 'Fix', 'Åtgärda'),- 'dep.xcode.hint': ('App Store 安装(Beta 版也行,用 xcode-select 指向它),约 12 GB', 'from the App Store (a beta works too — point xcode-select at it), about 12 GB', 'Installera från App Store. Betaversion går också bra om xcode-select pekar på den. Ungefär 12 GB.'),+ 'dep.xcode.hint': ('App Store 安装(Beta 版也行,用 xcode-select 指向它),约 12 GB。首次打开会提示装 iOS SDK——让它装完。不需要 iOS Simulator(约 8 GB),Xcode 如果自动下载请取消。', 'from the App Store (a beta works too — point xcode-select at it), about 12 GB', 'Installera från App Store. Betaversion går också bra om xcode-select pekar på den. Ungefär 12 GB.'),'dep.xcode.noSDK': ('Xcode 已装,但 iOS SDK 未下载(Xcode 15 起 iOS 平台是单独下载的)', 'Xcode is installed but the iOS SDK is not downloaded (a separate download since Xcode 15)', 'Xcode är installerat men iOS SDK är inte hämtat. Från Xcode 15 hämtas iOS-plattformen separat.'),'dep.metal': ('Metal Toolchain', 'Metal Toolchain', 'Metal-verktygskedja'),'dep.metal.hint': ('xcodebuild -downloadComponent MetalToolchain(约 840 MB)', 'xcodebuild -downloadComponent MetalToolchain (about 840 MB)', 'xcodebuild -downloadComponent MetalToolchain (ungefär 840 MB)'),@@ -476,6 +607,17 @@ TABLE: dict[str, tuple[str, str, str]] = {'dep.zstd.win': ('zstd', 'zstd', 'zstd'),'dep.zstd.hint.win': ('解压——点「安装」由 App 下载(facebook/zstd 官方 Windows 版)', "decompression — press Install and the app fetches it (facebook/zstd's official Windows build)", 'dekomprimering. Välj Installera så hämtar appen den officiella Windows-versionen av facebook/zstd.'),'dep.metal.hint.win': ('需要 <a href="https://developer.apple.com/download/all/">Apple 开发者下载页</a> 的「Metal Developer Tools for Windows」(需 Apple ID)', 'needs <a href="https://developer.apple.com/download/all/">Apple developer downloads</a>: "Metal Developer Tools for Windows" (Apple ID required)', 'Kräver ”Metal Developer Tools for Windows” från <a href="https://developer.apple.com/download/all/">Apples utvecklarhämtningar</a> och ett Apple-ID.'),+ 'dep.hide': ('收起', 'Hide', 'Hide'),+ 'dep.show': ('展开', 'Show', 'Show'),+ 'dep.pick': ('选择文件夹…', 'Choose folder…', 'Choose folder…'),+ 'dep.pick.ios_sdk.title': ('选择 iPhoneOS SDK 文件夹', 'Choose the iPhoneOS SDK folder', 'Choose the iPhoneOS SDK folder'),+ 'dep.pick.metal_dir.title': ('选择 Metal Developer Tools 文件夹', 'Choose the Metal Developer Tools folder', 'Choose the Metal Developer Tools folder'),+ 'dep.pick.saved': ('已记住:%@', 'Remembered: %@', 'Remembered: %@'),+ 'dep.pick.iossdk.saved': ('SDK 已记住:%@', 'SDK remembered: %@', 'SDK remembered: %@'),+ 'dep.pick.iossdk.version': ('SDK 版本:%@', 'SDK version: %@', 'SDK version: %@'),+ 'dep.pick.iossdk.invalid': ('“%@”不是 iPhoneOS SDK(需要 SDKSettings.json 和 UIKit 存根)。也可以选它的上一级目录。', '"%@" is not an iPhoneOS SDK (needs SDKSettings.json and the UIKit stubs). The folder one level up may be it.', '"%@" is not an iPhoneOS SDK (needs SDKSettings.json and the UIKit stubs). The folder one level up may be it.'),+ 'dep.guide.iossdk': ('三种获取方式:① 点「安装」由本程序下载(无需 Apple ID,约 100 MB);② 在 <a href="https://developer.apple.com/download/all/">Apple 开发者下载页</a>(需 Apple ID)搜索 “iPhoneOS” 下载并解压,然后点「选择文件夹…」指向里面的 iPhoneOS*.sdk;③ 已有 Xcode 的 Mac:拷贝 Xcode.app 内 Platforms/iPhoneOS.platform/Developer/SDKs/ 下的同名文件夹到这台电脑。Apple 的 SDK 无法由本程序直接分发。', 'Three ways to get it: ① press Install and this app downloads one (no Apple ID, about 100 MB); ② search “iPhoneOS” on the <a href="https://developer.apple.com/download/all/">Apple developer downloads</a> (Apple ID required), unpack, then press Choose folder… and point at the iPhoneOS*.sdk inside; ③ copy the same-named folder from Xcode.app\'s Platforms/iPhoneOS.platform/Developer/SDKs/ on a Mac that has Xcode. Apple\'s SDK cannot be shipped by this app.', 'Three ways to get it: ① press Install and this app downloads one (no Apple ID, about 100 MB); ② search “iPhoneOS” on the <a href="https://developer.apple.com/download/all/">Apple developer downloads</a> (Apple ID required), unpack, then press Choose folder… and point at the iPhoneOS*.sdk inside; ③ copy the same-named folder from Xcode.app\'s Platforms/iPhoneOS.platform/Developer/SDKs/ on a Mac that has Xcode. Apple\'s SDK cannot be shipped by this app.'),+ 'dep.guide.metal': ('Metal 着色器编译器由 Apple 单独发布:在 <a href="https://developer.apple.com/download/all/">Apple 开发者下载页</a>(需 Apple ID)下载 “Metal Developer Tools for Windows”,解压后点「选择文件夹…」指向解压出的目录(含 metal.exe 或 ios/)。已装的话本程序会在常见位置自动找到。', 'The Metal shader compiler ships separately from Apple: download "Metal Developer Tools for Windows" from the <a href="https://developer.apple.com/download/all/">Apple developer downloads</a> (Apple ID required), unpack, then press Choose folder… and point at the unpacked folder (holding metal.exe or ios/). An installed copy is found by itself in the usual places.', 'The Metal shader compiler ships separately from Apple: download "Metal Developer Tools for Windows" from the <a href="https://developer.apple.com/download/all/">Apple developer downloads</a> (Apple ID required), unpack, then press Choose folder… and point at the unpacked folder (holding metal.exe or ios/). An installed copy is found by itself in the usual places.'),'dep.zstd.hint': ('解压', 'decompression', 'dekomprimering'),'dep.spirv': ('brew: spirv-cross', 'brew: spirv-cross', 'brew: spirv-cross'),'dep.spirv.hint': ('shader 转换', 'shader translation', 'shaderöversättning'),@@ -492,6 +634,7 @@ TABLE: dict[str, tuple[str, str, str]] = {'dep.fix.brewMissing': ('没装 Homebrew:从 brew.sh 安装(安装程序会要你的密码),再点「重新检测」。', 'Homebrew is not installed: install it from brew.sh (the installer asks for your password), then press Check again.', 'Homebrew är inte installerat. Installera från brew.sh. Installationsprogrammet ber om ditt lösenord. Välj sedan ”Kontrollera igen”.'),'dep.fix.xcodeLicense': ('Xcode 的许可协议还没接受:运行 sudo xcodebuild -license accept。', "Xcode's license is not accepted yet: run sudo xcodebuild -license accept.", 'Xcodes licensavtal är inte godkänt. Kör sudo xcodebuild -license accept.'),'dep.fix.network': ('下载失败了:检查网络(代理或 VPN 可能拦住了 Homebrew 的域名),再试一次。', "The download failed: check the network (a proxy or VPN can block Homebrew's hosts) and try again.", 'Hämtningen misslyckades. Kontrollera nätverket; proxy eller VPN kan blockera Homebrews domäner. Försök sedan igen.'),+ 'dep.fix.diskspace': ('磁盘空间不足:清理后(SDK 和工具链解压需要数 GB)再点「安装」。', 'The disk is full: free some space (the SDK and toolchains unpack to several GB) and press Install again.', 'The disk is full: free some space (the SDK and toolchains unpack to several GB) and press Install again.'),'dep.fix.log': ('完整输出在 Mac/iPhone 选择下面的日志里。', 'The full output is in the log under the Mac/iPhone choice.', 'Fullständig utdata finns i loggen under Mac/iPhone-valet.'),'dep.python.missing': ('%@ 缺包', '%@ is missing packages', '%@ saknar paket'),'dep.install.begin': ('开始安装 %@…', 'Installing %@…', 'Installerar %@ …'),@@ -527,6 +670,8 @@ TABLE: dict[str, tuple[str, str, str]] = {'install.step1': ('1\\t用 AltStore / Sideloadly 安装上面的 IPA', '1\\tInstall the IPA above with AltStore / Sideloadly', '1\\tInstallera IPA-filen ovan med AltStore/Sideloadly'),'install.step2': ('2\\t把上面的 romfs 文件夹整个拷到游戏 App 的 Documents 里(文件 App → 我的 iPhone → 游戏名)', "2\\tCopy the whole romfs folder above into the game app's Documents (Files → On My iPhone → game name)", '2\\tKopiera hela romfs-mappen ovan till spelappens Dokument (appen Filer → På min iPhone → spelets namn)'),'install.step3': ('3\\t启动游戏', '3\\tLaunch the game', '3\\tStarta spelet'),+ 'library.showLog': ('显示游戏日志', 'Show game log', 'Show game log'),+ 'library.showLog.none': ('这个游戏还没有日志,运行一次就会生成', 'No game log yet. Play the game once to create it', 'No game log yet. Play the game once to create it'),'install.reveal': ('在访达中显示', 'Reveal in Finder', 'Visa i Finder'),'msg.running': ('运行:%@', 'Running: %@', 'Kör: %@'),'msg.installingNsz': ('选中的是 NSZ / XCZ 压缩格式,正在给构建用的 Python 安装 nsz…', "The selected dump is NSZ / XCZ — installing nsz into the build's Python…", 'Det valda filformatet är komprimerat NSZ/XCZ. Installerar nsz i Python-miljön som används för bygget …'),diff --git a/frontend-qt/nspb_qt/model.py b/frontend-qt/nspb_qt/model.pyindex fd999500..465d7020 100644--- a/frontend-qt/nspb_qt/model.py+++ b/frontend-qt/nspb_qt/model.py@@ -9,11 +9,12 @@ import sysimport tempfileimport threadingimport time+from collections.abc import Callablefrom dataclasses import dataclass, fieldfrom enum import Enumfrom pathlib import Path-from PySide6.QtCore import Q_ARG, QMetaObject, QObject, Qt, QThread, Signal, Slot+from PySide6.QtCore import QSettings, Q_ARG, QMetaObject, QObject, Qt, QThread, Signal, Slotfrom . import platform_util as pufrom .i18n import Lang@@ -39,6 +40,10 @@ class Dep:installing: bool = Falserequired: bool = True # a missing optional row (spirv-cross for Metal games, glslangValidator)# is not part of "缺 N 项": it does not stop the build in front of you+ pick_key: str = '' # a manual row the user can point at a folder ('ios_sdk', 'metal_dir'):+ # the panel grows a Choose button; the pick is validated and remembered+ fix_hint: str = '' # an L10n key set when this row's install failed: what to do next+ last_error: str = '' # the tool's own last error line, shown under the row (Mac parity)@propertydef ok(self) -> bool:@@ -72,8 +77,13 @@ class Model(QObject):finished = Signal(bool, str) # ok, noteappUpdateFound = Signal(str, str) # tag, url+ #: Set by the window: asks for a folder (QFileDialog lives in the UI layer) and returns the+ #: path, or '' when the user cancelled. `pick_dep_folder` calls it, so the model stays UI-free.+ ask_folder: Callable[[str], str] | None = None+def __init__(self) -> None:super().__init__()+ self.settings = QSettings('NS Port Builder', 'NSPortBuilder')self.lang = Lang.initial()self.repo_path = self._find_repo()self.python_path, self.python_ok, self.python_ver = pu.find_python()@@ -123,6 +133,13 @@ class Model(QObject):def t(self, key: str, *args: object) -> str:return t(key, self.lang, *args)+ def settings_value(self, key: str, default: bool | None = None) -> bool | None:+ v = self.settings.value(key, defaultValue='', type=str)+ return default if v == '' else v.lower() == 'true'++ def settings_set(self, key: str, value: bool) -> None:+ self.settings.setValue(key, 'true' if value else 'false')+def toggle_lang(self) -> None:self.lang = self.lang.otherself.repoChanged.emit()@@ -270,6 +287,13 @@ class Model(QObject):for d in deps:if d.id in running:d.installing = True+ # The failure note belongs to the row, and a check (which rebuilds every row) must not+ # wipe it: it clears when that row installs successfully instead.+ previous = {d.id: d for d in self.deps}+ for d in deps:+ p = previous.get(d.id)+ if p is not None and not d.ok:+ d.last_error, d.fix_hint = p.last_error, p.fix_hintself.deps = depsif not pu.IS_WIN:@@ -359,7 +383,10 @@ class Model(QObject):out.append(Dep('lld', 'dep.lld', 'dep.lld.hint', state(p),p.detail if not p.ok else (p.path or 'ok')))- # the SDK+ # the SDK. Apple's SDK cannot be redistributed by us; the in-app download (the+ # xybp888/iOS-SDKs checkout) needs no Apple ID and is the default fix, and Choose lets a+ # user with Apple's own SDK point at it instead — validated and written to+ # toolchain.json, so the choice survives restarts.p = by_id.get('ios_sdk')if p:detail = ''@@ -369,7 +396,7 @@ class Model(QObject):detail = p.detailinstall = [] if p.ok else ['__win__:ios_sdk']out.append(Dep('ios_sdk', 'dep.iossdk', 'dep.iossdk.hint', state(p), detail,- install=install))+ install=install, pick_key='' if p.ok else 'ios_sdk'))# Metal. The hint is the Windows one: on macOS this row says# `xcodebuild -downloadComponent`, which is an Apple ID login away on Windows@@ -377,7 +404,8 @@ class Model(QObject):p = by_id.get('metal')if p:out.append(Dep('metal', 'dep.metal', 'dep.metal.hint.win', state(p),- (p.path or 'ok') if p.ok else (p.detail or '')))+ (p.path or 'ok') if p.ok else (p.detail or ''),+ pick_key='' if p.ok else 'metal_dir'))# the probes: one row each, so a broken toolchain names the step that failsfor pid, key in (('probe_compile', 'dep.probe.compile'),@@ -722,14 +750,72 @@ class Model(QObject):# DownloadError, OSError, ImportError, a missing attribute: all reported with the# type so a bug report names the failure without guessing.import traceback- self.log(self.t('dep.install.fail', f'{type(e).__name__}: {e}') + '\n')+ detail = f'{type(e).__name__}: {e}'+ self.log(self.t('dep.install.fail', detail) + '\n')self.log(traceback.format_exc() + '\n')+ self._record_install_failure(dep, detail)self._clear_installing(dep)self.depsChanged.emit()self.check_deps()threading.Thread(target=work, daemon=True).start()+ def _record_install_failure(self, dep: Dep, detail: str) -> None:+ """Say why an install failed and what to do, under the row itself (Mac parity).++ The log already carries the traceback; the row gets the one-line error plus a fix chosen+ from it — network for downloads, disk space for unpacks — so the player needs no log+ reading for the two cases that cover most of them.+ """+ fix = self._classify_install_failure(detail)+ for r in self.deps:+ if r.id == dep.id:+ r.last_error = detail+ r.fix_hint = fix++ @staticmethod+ def _classify_install_failure(detail: str) -> str:+ """The fix hint for one install failure, from its text (network, disk space, else the log)."""+ low = detail.lower()+ if 'timed out' in low or 'connection' in low or 'resolve host' in low or 'network' in low:+ return 'dep.fix.network'+ if 'no space' in low or 'disk full' in low or 'errno 28' in low:+ return 'dep.fix.diskspace'+ return 'dep.fix.log'++ def pick_dep_folder(self, dep: Dep) -> None:+ """A folder the user chose for one manual row: validated now, remembered in+ `toolchain.json`, then a fresh check re-reads it.++ Validation before saving keeps a wrong pick from silently becoming the configured answer+ (the SDK probe would then say `wrong` with a confusing version note on every start).+ """+ if not dep.pick_key:+ return+ from .win import toolchain as wtc+ ask = self.ask_folder+ if ask is None:+ return # no window attached (tests): nothing to ask with+ folder = ask(self.t('dep.pick.' + dep.pick_key + '.title'))+ if not folder:+ return+ if dep.pick_key == 'ios_sdk':+ # The SDK can sit one level down (the guide's step 2 says so): accept both layouts.+ candidates = [Path(folder)] + sorted(Path(folder).glob('iPhoneOS*.sdk'), reverse=True)+ match = next((c for c in candidates if wtc.is_sdk_dir(c)), None)+ if match is None:+ self.log(self.t('dep.pick.iossdk.invalid', folder) + '\n')+ return+ ver, _build = wtc.sdk_version(match)+ wtc.save_config('ios_sdk', str(match))+ self.log(self.t('dep.pick.iossdk.saved', match) + '\n')+ if ver:+ self.log(self.t('dep.pick.iossdk.version', ver) + '\n')+ else:+ wtc.save_config(dep.pick_key, folder)+ self.log(self.t('dep.pick.saved', folder) + '\n')+ self.check_deps()+def _progress_logger(self, label: str):"""A progress callback that logs at 5% steps, not on every chunk.diff --git a/frontend-qt/nspb_qt/ui.py b/frontend-qt/nspb_qt/ui.pyindex 759c482c..76ee938a 100644--- a/frontend-qt/nspb_qt/ui.py+++ b/frontend-qt/nspb_qt/ui.py@@ -229,10 +229,31 @@ class MainWindow(QMainWindow):self._translatable.append((recheck, 'dep.recheck'))recheck.clicked.connect(self.m.check_deps)head.addWidget(recheck)+ self.deps_toggle = QPushButton(self.m.t('dep.hide'))+ self._translatable.append((self.deps_toggle, 'dep.hide'))+ self.deps_toggle.clicked.connect(self._toggle_deps)+ head.addWidget(self.deps_toggle)lay.addLayout(head)self.deps_container = QVBoxLayout()self.deps_container.setSpacing(3)lay.addLayout(self.deps_container)+ # Open by default, like the Mac's panel (open while anything is missing); remembered for+ # the next start either way.+ self.deps_open = self.m.settings_value('depsExpanded')+ self._apply_deps_open()++ def _toggle_deps(self) -> None:+ self.deps_open = not self.deps_open+ self.m.settings_set('depsExpanded', self.deps_open)+ self._apply_deps_open()++ def _apply_deps_open(self) -> None:+ for i in range(self.deps_container.count()):+ if w := self.deps_container.itemAt(i).widget():+ w.setVisible(self.deps_open)+ self.deps_toggle.setText(self.m.t('dep.hide' if self.deps_open else 'dep.show'))+ self._translatable = [(w, k) if k != 'dep.hide' and w is not self.deps_toggle else (w, 'dep.hide' if self.deps_open else 'dep.show')+ for w, k in self._translatable]def _build_progress(self) -> None:box, lay = self._card('prog.title')@@ -366,6 +387,11 @@ class MainWindow(QMainWindow):val.setStyleSheet(f'color: {MUTED if optional else ORANGE};')self._refresh_running()+ @staticmethod+ def _esc(text: str) -> str:+ # The failure line is tool output; keep it out of the rich-text parser.+ return (text.replace('&', '&').replace('<', '<').replace('>', '>'))+def _refresh_deps(self) -> None:while self.deps_container.count():item = self.deps_container.takeAt(0)@@ -408,12 +434,41 @@ class MainWindow(QMainWindow):btn.setEnabled(not d.installing)btn.clicked.connect(lambda _=False, dep=d: self.m.install_dep(dep))h.addWidget(btn)- else:+ if d.pick_key:+ # Apple-licensed pieces cannot be downloaded by the app: Choose points at a+ # copy the user already has (validated, remembered in toolchain.json).+ pick = QPushButton(self.m.t('dep.pick'))+ pick.clicked.connect(lambda _=False, dep=d: self.m.pick_dep_folder(dep))+ h.addWidget(pick)+ if not d.install and not d.pick_key:hint = QLabel(self.m.t(d.hint_key))hint.setObjectName('note')hint.setOpenExternalLinks(True) # the Windows hints carry download linksh.addWidget(hint)self.deps_container.addWidget(row)+ # Why the last install failed and what to do: the tool's own line under the row, the+ # fix under it (Mac parity). Cleared when the row installs successfully.+ if not d.ok and (d.last_error or d.fix_hint):+ note = QLabel(('<br>' if d.last_error and d.fix_hint else '')+ + (self._esc(d.last_error) if d.last_error else '')+ + ('<br>' + self.m.t(d.fix_hint) if d.fix_hint else ''))+ note.setObjectName('note')+ note.setOpenExternalLinks(True)+ note.setContentsMargins(20, 0, 0, 4)+ self.deps_container.addWidget(note)+ for d in self.m.deps:+ if not d.ok and not d.install and d.id == 'ios_sdk':+ guide = QLabel(self.m.t('dep.guide.iossdk'))+ guide.setObjectName('note')+ guide.setOpenExternalLinks(True)+ guide.setContentsMargins(20, 0, 0, 4)+ self.deps_container.addWidget(guide)+ elif not d.ok and not d.install and d.id == 'metal':+ guide = QLabel(self.m.t('dep.guide.metal'))+ guide.setObjectName('note')+ guide.setOpenExternalLinks(True)+ guide.setContentsMargins(20, 0, 0, 4)+ self.deps_container.addWidget(guide)if self.m.deps_checked:if not self.m.deps:# The check produced no rows at all, which means it failed — never report that asdiff --git a/frontend-qt/nspb_qt/win/toolchain.py b/frontend-qt/nspb_qt/win/toolchain.pyindex ae64595b..c7eefcb8 100644--- a/frontend-qt/nspb_qt/win/toolchain.py+++ b/frontend-qt/nspb_qt/win/toolchain.py@@ -250,6 +250,22 @@ def config_path() -> Path:return base / 'NS Port Builder' / 'toolchain.json'+def save_config(key: str, value: str) -> Path:+ """Set one `toolchain.json` key, keeping the rest (an unreadable file is replaced, not merged:+ its content could not be parsed anyway). Returns the path written, for the log line.++ The dependency panel's Choose button uses this: a folder the user pointed at once must+ survive restarts, and the discovery helpers already read it back through `setting(key)`.+ """+ p = Path(os.environ.get(ENV_TOOLCHAIN) or config_path())+ p.parent.mkdir(parents=True, exist_ok=True)+ data = load_config()+ data.pop('_error', None)+ data[key] = value+ p.write_text(json.dumps(data, indent=2, ensure_ascii=False) + '\n', encoding='utf-8')+ return p++def load_config() -> dict:"""The user's `toolchain.json`; an unreadable one is reported, never fatal.diff --git a/frontend-qt/tests/test_win.py b/frontend-qt/tests/test_win.pyindex 22c4407d..4ce0c7b2 100644--- a/frontend-qt/tests/test_win.py+++ b/frontend-qt/tests/test_win.py@@ -1527,6 +1527,93 @@ class LocalizationTest(unittest.TestCase):self.assertTrue(zh and zh != k, f'{k} has no Chinese text')self.assertTrue(en and en != k, f'{k} has no English text')+ def test_the_guidance_and_pick_keys_exist_in_both_languages(self) -> None:+ from nspb_qt.i18n import Lang+ from nspb_qt.localization import TABLE, t+ keys = ['dep.guide.iossdk', 'dep.guide.metal', 'dep.pick', 'dep.hide', 'dep.show',+ 'dep.pick.ios_sdk.title', 'dep.pick.metal_dir.title',+ 'dep.pick.saved', 'dep.pick.iossdk.saved', 'dep.pick.iossdk.version',+ 'dep.pick.iossdk.invalid', 'dep.fix.network', 'dep.fix.diskspace', 'dep.fix.log']+ for k in keys:+ self.assertIn(k, TABLE, f'{k} missing from the table')+ zh, en = t(k, Lang.ZH), t(k, Lang.EN)+ self.assertTrue(zh and zh != k and en and en != k, f'{k} is not bilingual')+++class SaveConfigTest(unittest.TestCase):+ """The Choose-a-folder path writes toolchain.json and reads it back through setting()."""++ def setUp(self) -> None:+ self.tmp = tempfile.TemporaryDirectory()+ self.addCleanup(self.tmp.cleanup)+ self._old = os.environ.get('NSPB_TOOLCHAIN_JSON')+ os.environ['NSPB_TOOLCHAIN_JSON'] = str(Path(self.tmp.name) / 'toolchain.json')++ def tearDown(self) -> None:+ if self._old is None:+ os.environ.pop('NSPB_TOOLCHAIN_JSON', None)+ else:+ os.environ['NSPB_TOOLCHAIN_JSON'] = self._old++ def test_save_config_keeps_other_keys_and_is_read_back(self) -> None:+ cfg = Path(os.environ['NSPB_TOOLCHAIN_JSON'])+ cfg.parent.mkdir(parents=True, exist_ok=True)+ cfg.write_text('{"llvm_dir": "C:/tools/llvm"}', encoding='utf-8')+ p = tc.save_config('ios_sdk', 'C:/sdks/iPhoneOS26.0.sdk')+ self.assertEqual(p, cfg)+ self.assertEqual(tc.setting('ios_sdk'), 'C:/sdks/iPhoneOS26.0.sdk')+ self.assertEqual(tc.setting('llvm_dir'), 'C:/tools/llvm', 'the other keys survive')++ def test_save_config_creates_missing_folders_and_replaces_a_broken_file(self) -> None:+ cfg = Path(os.environ['NSPB_TOOLCHAIN_JSON'])+ cfg.parent.mkdir(parents=True, exist_ok=True)+ cfg.write_text('not json', encoding='utf-8')+ tc.save_config('metal_dir', 'C:/Metal')+ self.assertEqual(tc.setting('metal_dir'), 'C:/Metal')++ def test_the_picked_sdk_is_accepted_only_when_it_really_is_one(self) -> None:+ # The model validates before saving: a wrong pick must not become the configured answer.+ root = Path(self.tmp.name)+ unpacked = root / 'Metal-thing-unpacked' # whatever the archive's top folder is called+ unpacked.mkdir(parents=True)+ good = make_fake_sdk(unpacked, '26.2')+ self.assertTrue(tc.is_sdk_dir(good), 'the sdk folder itself')+ self.assertFalse(tc.is_sdk_dir(unpacked), 'the folder above it is not an SDK by itself')+ self.assertFalse(tc.is_sdk_dir(root / 'elsewhere'))+ # ...but the model's pick accepts "one level down", so the unpacked root resolves to the SDK:+ matches = sorted(unpacked.glob('iPhoneOS*.sdk'), reverse=True)+ self.assertTrue(matches and all(tc.is_sdk_dir(m) for m in matches))+++class InstallFailureHintTest(unittest.TestCase):+ """The row's fix hint after a failed install (Mac parity: name the fix, not the traceback)."""++ def test_network_disk_and_other_map_to_their_hints(self) -> None:+ # model.py imports PySide6, which the test machine need not have: the classifier is a+ # pure function, so its source is extracted and run standalone when Qt is absent.+ try:+ from nspb_qt import model as M+ classify = M.BuildModel._classify_install_failure+ except ImportError:+ import ast+ src = (HERE.parent / 'nspb_qt' / 'model.py').read_text()+ tree = ast.parse(src)+ fn = next(n for n in ast.walk(tree) if isinstance(n, ast.FunctionDef)+ and n.name == '_classify_install_failure')+ # A copied FunctionDef needs line numbers before compile accepts it.+ ast.copy_location(fn, fn)+ for n in ast.walk(fn):+ ast.copy_location(n, n)+ ast.fix_missing_locations(n)+ ns: dict = {}+ exec(compile(ast.fix_missing_locations(ast.Module(body=[fn], type_ignores=[])),+ '<model>', 'exec'), ns)+ classify = ns['_classify_install_failure']+ self.assertEqual(classify('DownloadError: connection reset by peer'), 'dep.fix.network')+ self.assertEqual(classify('URLError: operation timed out'), 'dep.fix.network')+ self.assertEqual(classify('OSError: [Errno 28] No space left on device'), 'dep.fix.diskspace')+ self.assertEqual(classify('KeyError: x'), 'dep.fix.log')+if __name__ == '__main__':unittest.main(verbosity=2)diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swiftindex bfa70f4a..5b38e771 100644--- a/frontend/Sources/NSPortBuilder/Localization.swift+++ b/frontend/Sources/NSPortBuilder/Localization.swift@@ -702,6 +702,19 @@ enum L10n {"dep.zstd.hint.win": ("解压——点「安装」由 App 下载(facebook/zstd 官方 Windows 版)", "decompression — press Install and the app fetches it (facebook/zstd's official Windows build)"),"dep.metal.hint.win": ("需要 <a href=\"https://developer.apple.com/download/all/\">Apple 开发者下载页</a> 的「Metal Developer Tools for Windows」(需 Apple ID)","needs <a href=\"https://developer.apple.com/download/all/\">Apple developer downloads</a>: \"Metal Developer Tools for Windows\" (Apple ID required)"),+ "dep.hide": ("收起", "Hide"),+ "dep.show": ("展开", "Show"),+ "dep.pick": ("选择文件夹…", "Choose folder…"),+ "dep.pick.ios_sdk.title": ("选择 iPhoneOS SDK 文件夹", "Choose the iPhoneOS SDK folder"),+ "dep.pick.metal_dir.title": ("选择 Metal Developer Tools 文件夹", "Choose the Metal Developer Tools folder"),+ "dep.pick.saved": ("已记住:%@", "Remembered: %@"),+ "dep.pick.iossdk.saved": ("SDK 已记住:%@", "SDK remembered: %@"),+ "dep.pick.iossdk.version": ("SDK 版本:%@", "SDK version: %@"),+ "dep.pick.iossdk.invalid": ("“%@”不是 iPhoneOS SDK(需要 SDKSettings.json 和 UIKit 存根)。也可以选它的上一级目录。", "\"%@\" is not an iPhoneOS SDK (needs SDKSettings.json and the UIKit stubs). The folder one level up may be it."),+ "dep.guide.iossdk": ("三种获取方式:① 点「安装」由本程序下载(无需 Apple ID,约 100 MB);② 在 <a href=\"https://developer.apple.com/download/all/\">Apple 开发者下载页</a>(需 Apple ID)搜索 “iPhoneOS” 下载并解压,然后点「选择文件夹…」指向里面的 iPhoneOS*.sdk;③ 已有 Xcode 的 Mac:拷贝 Xcode.app 内 Platforms/iPhoneOS.platform/Developer/SDKs/ 下的同名文件夹到这台电脑。Apple 的 SDK 无法由本程序直接分发。",+ "Three ways to get it: ① press Install and this app downloads one (no Apple ID, about 100 MB); ② search “iPhoneOS” on the <a href=\"https://developer.apple.com/download/all/\">Apple developer downloads</a> (Apple ID required), unpack, then press Choose folder… and point at the iPhoneOS*.sdk inside; ③ copy the same-named folder from Xcode.app's Platforms/iPhoneOS.platform/Developer/SDKs/ on a Mac that has Xcode. Apple's SDK cannot be shipped by this app."),+ "dep.guide.metal": ("Metal 着色器编译器由 Apple 单独发布:在 <a href=\"https://developer.apple.com/download/all/\">Apple 开发者下载页</a>(需 Apple ID)下载 “Metal Developer Tools for Windows”,解压后点「选择文件夹…」指向解压出的目录(含 metal.exe 或 ios/)。已装的话本程序会在常见位置自动找到。",+ "The Metal shader compiler ships separately from Apple: download \"Metal Developer Tools for Windows\" from the <a href=\"https://developer.apple.com/download/all/\">Apple developer downloads</a> (Apple ID required), unpack, then press Choose folder… and point at the unpacked folder (holding metal.exe or ios/). An installed copy is found by itself in the usual places."),"dep.zstd.hint": ("解压", "decompression"),"dep.spirv": ("brew: spirv-cross", "brew: spirv-cross"),"dep.spirv.hint": ("shader 转换", "shader translation"),@@ -722,6 +735,8 @@ enum L10n {"Xcode's license is not accepted yet: run sudo xcodebuild -license accept."),"dep.fix.network": ("下载失败了:检查网络(代理或 VPN 可能拦住了 Homebrew 的域名),再试一次。","The download failed: check the network (a proxy or VPN can block Homebrew's hosts) and try again."),+ "dep.fix.diskspace": ("磁盘空间不足:清理后(SDK 和工具链解压需要数 GB)再点「安装」。",+ "The disk is full: free some space (the SDK and toolchains unpack to several GB) and press Install again."),"dep.fix.log": ("完整输出在 Mac/iPhone 选择下面的日志里。","The full output is in the log under the Mac/iPhone choice."),"dep.python.missing": ("%@ 缺包", "%@ is missing packages"),