Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

l10n: translate the strings that stayed English in every language

Koshindai329202523181
diff --git a/.github/workflows/build-mac-app.yml b/.github/workflows/build-mac-app.yml
index c8a58a98..e0d10b96 100644
--- a/.github/workflows/build-mac-app.yml
+++ b/.github/workflows/build-mac-app.yml
@@ -298,6 +298,8 @@ jobs:
<key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleShortVersionString</key><string>$V</string>
<key>CFBundleVersion</key><string>$V</string>
+ <key>CFBundleDevelopmentRegion</key><string>en</string>
+ <key>CFBundleLocalizations</key><array><string>en</string><string>zh-Hans</string><string>sv</string><string>de</string></array>
<key>LSMinimumSystemVersion</key><string>13.0</string>
<key>NSHighResolutionCapable</key><true/>
</dict>
diff --git a/frontend-qt/gen_localization.py b/frontend-qt/gen_localization.py
index 29449e1e..7922c2a7 100644
--- a/frontend-qt/gen_localization.py
+++ b/frontend-qt/gen_localization.py
@@ -14,19 +14,21 @@ SWIFT = HERE.parent / 'frontend' / 'Sources' / 'NSPortBuilder' / 'Localization.s
OUT = HERE / 'nspb_qt' / 'localization.py'
PAIR = re.compile(r'"([^"]+)":\s*\(\s*"((?:[^"\\]|\\.)*)"\s*,\s*"((?:[^"\\]|\\.)*)"\s*\)', re.S)
-OVERLAY_ENTRY = re.compile(r'"([^"]+)":\s*"((?:[^"\\]|\\.)*)"')
+OVERLAY = re.compile(r'"([^"]+)":\s*"((?:[^"\\]|\\.)*)"')
+ESCAPE = re.compile(r'\\u\{([0-9a-fA-F]+)\}|\\(.)')
+SIMPLE = {'n': '\n', 't': '\t', '"': '"', '\\': '\\'}
-def overlay(text: str, name: str) -> dict[str, str]:
- """The `static let <name>: [String: String]` overlay of the Swift table (Swedish, German)."""
- match = re.search(r'static let ' + name + r': \[String: String\] = \[(.*?)\n \]', text, re.S)
- return dict(OVERLAY_ENTRY.findall(match.group(1))) if match else {}
+def unescape(s: str) -> str:
+ """A Swift string literal's body as the text it means: \\u{...}, \\n, \\t, \\\" and \\\\, in one pass
+ so an escaped backslash is never read as the start of another escape."""
+ return ESCAPE.sub(lambda m: chr(int(m[1], 16)) if m[1] else SIMPLE.get(m[2], m[0]), s)
-def unescape(s: str) -> str:
- """A Swift string literal's body as text (unicode, quote and backslash, \\n and \\t escapes)."""
- return re.sub(r'\\(u\{([0-9a-fA-F]+)\}|.)',
- lambda m: chr(int(m[2], 16)) if m[2] else {'n': '\n', 't': '\t'}.get(m[1], m[1]), s)
+def overlay(text: str, name: str) -> dict[str, str]:
+ """One language overlay (`static let <name>: [String: String]`), unescaped."""
+ match = re.search(rf'static let {name}: \[String: String\] = \[(.*?)\n \]', text, re.S)
+ return {k: unescape(v) for k, v in OVERLAY.findall(match.group(1))} if match else {}
def main() -> None:
@@ -45,13 +47,13 @@ def main() -> None:
'',
'from .i18n import Lang',
'',
- '# key: (Chinese, English, Swedish, German). Swedish and German fall back to English.',
+ '# key: (Chinese, English, Swedish, German); a missing overlay entry is the English text',
'TABLE: dict[str, tuple[str, str, str, str]] = {',
]
for key, zh, en in rows:
+ # Swift Unicode escapes keep the shared table ASCII without losing translations.
zh, en = unescape(zh), unescape(en)
- sv = unescape(swedish[key]) if key in swedish else en
- de = unescape(german[key]) if key in german else en
+ sv, de = swedish.get(key, en), german.get(key, en)
lines.append(f' {key!r}: ({zh!r}, {en!r}, {sv!r}, {de!r}),')
lines += [
'}',
diff --git a/frontend-qt/nspb_qt/localization.py b/frontend-qt/nspb_qt/localization.py
index d0495f01..9745593a 100644
--- a/frontend-qt/nspb_qt/localization.py
+++ b/frontend-qt/nspb_qt/localization.py
@@ -6,7 +6,7 @@ from __future__ import annotations
from .i18n import Lang
-# key: (Chinese, English, Swedish, German). Swedish and German fall back to English.
+# key: (Chinese, English, Swedish, German); a missing overlay entry is the English text
TABLE: dict[str, tuple[str, str, str, str]] = {
'onboarding.welcome.title': ('准备开始游戏。', 'Make yourself at home.', 'Välkommen.', 'Fühl dich wie zu Hause.'),
'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.', 'Spiele deine Switch-Spiele nativ auf dem Mac, in etwa 15 Minuten.'),
@@ -988,6 +988,66 @@ TABLE: dict[str, tuple[str, str, str, str]] = {
'engine.fail.download': ('无法下载引擎。请检查网络后重试。', 'The engine could not be downloaded. Check the connection and try again.', 'Motorn kunde inte laddas ner. Kontrollera anslutningen och försök igen.', 'Die Engine konnte nicht geladen werden. Prüfe die Verbindung und versuche es erneut.'),
'engine.fail.digest': ('下载的引擎与校验和不符。未安装任何内容。', 'The downloaded engine does not match its checksum. Nothing was installed.', 'Den nedladdade motorn stämmer inte med sin kontrollsumma. Inget installerades.', 'Die geladene Engine passt nicht zu ihrer Prüfsumme. Es wurde nichts installiert.'),
'engine.fail.install': ('无法安装引擎。请检查可用空间后重试。', 'The engine could not be installed. Check the free space and try again.', 'Motorn kunde inte installeras. Kontrollera ledigt utrymme och försök igen.', 'Die Engine konnte nicht installiert werden. Prüfe den freien Speicher und versuche es erneut.'),
+ 'launch.opt.DM_FPS_TARGET.30': ('30 fps', '30 fps', '30 fps', '30 fps'),
+ 'launch.opt.DM_FPS_TARGET.60': ('60 fps', '60 fps', '60 fps', '60 fps'),
+ 'launch.opt.DM_PRESENT_UPSCALE.metalfx': ('MetalFX', 'MetalFX', 'MetalFX', 'MetalFX'),
+ 'launch.opt.DM_LANG.en-US': ('美式英语', 'American English', 'Amerikansk engelska', 'Amerikanisches Englisch'),
+ 'launch.opt.DM_LANG.en-GB': ('英式英语', 'British English', 'Brittisk engelska', 'Britisches Englisch'),
+ 'launch.opt.DM_LANG.ja': ('日语', 'Japanese', 'Japanska', 'Japanisch'),
+ 'launch.opt.DM_LANG.fr': ('法语', 'French', 'Franska', 'Französisch'),
+ 'launch.opt.DM_LANG.de': ('德语', 'German', 'Tyska', 'Deutsch'),
+ 'launch.opt.DM_LANG.es-419': ('拉丁美洲西班牙语', 'Latin American Spanish', 'Latinamerikansk spanska', 'Lateinamerikanisches Spanisch'),
+ 'launch.opt.DM_LANG.es': ('西班牙语', 'Spanish', 'Spanska', 'Spanisch'),
+ 'launch.opt.DM_LANG.it': ('意大利语', 'Italian', 'Italienska', 'Italienisch'),
+ 'launch.opt.DM_LANG.nl': ('荷兰语', 'Dutch', 'Nederländska', 'Niederländisch'),
+ 'launch.opt.DM_LANG.fr-CA': ('加拿大法语', 'Canadian French', 'Kanadensisk franska', 'Kanadisches Französisch'),
+ 'launch.opt.DM_LANG.pt': ('葡萄牙语', 'Portuguese', 'Portugisiska', 'Portugiesisch'),
+ 'launch.opt.DM_LANG.ru': ('俄语', 'Russian', 'Ryska', 'Russisch'),
+ 'launch.opt.DM_LANG.ko': ('韩语', 'Korean', 'Koreanska', 'Koreanisch'),
+ 'launch.opt.DM_LANG.zh-Hant': ('繁体中文', 'Traditional Chinese', 'Traditionell kinesiska', 'Traditionelles Chinesisch'),
+ 'launch.opt.DM_LANG.zh-Hans': ('简体中文', 'Simplified Chinese', 'Förenklad kinesiska', 'Vereinfachtes Chinesisch'),
+ 'launch.opt.DM_LANG.pt-BR': ('巴西葡萄牙语', 'Brazilian Portuguese', 'Brasiliansk portugisiska', 'Brasilianisches Portugiesisch'),
+ 'stage.decompress_nsz': ('解压 NSZ', 'decompress NSZ', 'Packa upp NSZ', 'NSZ entpacken'),
+ 'stage.build_id_lookup': ('查找构建 ID', 'build ID lookup', 'Söker bygg-ID', 'Build-ID suchen'),
+ 'stage.survey_build_nx_extract': ('勘察:构建 nx_extract', 'survey: build nx_extract', 'Kartläggning: bygg nx_extract', 'Analyse: nx_extract bauen'),
+ 'stage.survey_romfs_manifest': ('勘察:RomFS 清单', 'survey: RomFS manifest', 'Kartläggning: RomFS-manifest', 'Analyse: RomFS-Manifest'),
+ 'stage.survey_code_modules': ('勘察:代码模块', 'survey: code modules', 'Kartläggning: kodmoduler', 'Analyse: Code-Module'),
+ 'stage.survey_imports_vs_host_hooks': ('勘察:导入与主机钩子', 'survey: imports vs host hooks', 'Kartläggning: importer mot värdkrokar', 'Analyse: Importe und Host-Hooks'),
+ 'stage.extract_dlc': ('提取 DLC', 'extract DLC', 'Extrahera DLC', 'DLC extrahieren'),
+ 'stage.rewrite': ('改写代码', 'rewrite', 'Skriv om koden', 'Umschreiben'),
+ 'stage.glslc_capture': ('GLSLC 捕获', 'GLSLC capture', 'GLSLC-insamling', 'GLSLC-Erfassung'),
+ 'stage.ue_shader_decode': ('UE 着色器解码', 'UE shader decode', 'Avkodning av UE-shaders', 'UE-Shader dekodieren'),
+ 'stage.heap_check': ('堆检查', 'heap check', 'Heapkontroll', 'Heap-Prüfung'),
+ 'stage.address_regions': ('地址区域', 'address regions', 'Adressområden', 'Adressbereiche'),
+ 'stage.shader_split': ('着色器拆分', 'shader split', 'Uppdelning av shaders', 'Shader aufteilen'),
+ 'stage.mac_shaders': ('Mac 着色器', 'Mac shaders', 'Mac-shaders', 'Mac-Shader'),
+ 'stage.ios_shaders': ('iOS 着色器', 'iOS shaders', 'iOS-shaders', 'iOS-Shader'),
+ 'stage.vulkan_shaders': ('Vulkan 着色器', 'Vulkan shaders', 'Vulkan-shaders', 'Vulkan-Shader'),
+ 'stage.gl_shaders': ('GL 着色器', 'GL shaders', 'GL-shaders', 'GL-Shader'),
+ 'stage.ipa_pack': ('打包 IPA', 'IPA pack', 'Packa IPA', 'IPA packen'),
+ 'stage.mac_host': ('Mac 主机程序', 'Mac host', 'Mac-värd', 'Mac-Host'),
+ 'stage.pipeline_prebuild': ('管线预构建', 'Pipeline prebuild', 'Förbygg pipelines', 'Pipelines vorab erstellen'),
+ 'stage.pipeline_archive': ('管线存档', 'Pipeline archive', 'Pipelinearkiv', 'Pipeline-Archiv'),
+ 'stage.mac_app': ('Mac App', 'Mac app', 'Mac-app', 'Mac-App'),
+ 'stage.build_nx_extract': ('构建 nx_extract', 'build nx_extract', 'Bygg nx_extract', 'nx_extract bauen'),
+ 'stage.prepare_xcode': ('准备 Xcode', 'prepare Xcode', 'Förbered Xcode', 'Xcode vorbereiten'),
+ 'stage.app_build': ('构建 App', 'app build', 'Bygg appen', 'App bauen'),
+ 'stage.extract': ('提取 %@', 'extract %@', 'Extrahera %@', '%@ extrahieren'),
+ 'stage.capture': ('%@ 着色器捕获', '%@ shader capture', 'Insamling av %@-shaders', '%@-Shader-Erfassung'),
+ 'key.return': ('回车', 'Return', 'Retur', 'Zeilenschalter'),
+ 'key.tab': ('Tab', 'Tab', 'Tabb', 'Tabulator'),
+ 'key.space': ('空格', 'Space', 'Mellanslag', 'Leertaste'),
+ 'key.delete': ('删除', 'Delete', 'Radera', 'Rückschritt'),
+ 'key.clear': ('清除', 'Clear', 'Rensa', 'Löschen'),
+ 'key.enter': ('Enter', 'Enter', 'Enter', 'Eingabe'),
+ 'key.home': ('Home', 'Home', 'Home', 'Pos1'),
+ 'key.end': ('End', 'End', 'End', 'Ende'),
+ 'key.page_up': ('Page Up', 'Page Up', 'Page Up', 'Bild auf'),
+ 'key.page_down': ('Page Down', 'Page Down', 'Page Down', 'Bild ab'),
+ 'key.forward_delete': ('向前删除', 'Forward Delete', 'Radera framåt', 'Entfernen'),
+ 'key.keypad': ('小键盘 %@', 'Keypad %@', 'Numeriskt %@', 'Ziffernblock %@'),
+ 'key.code': ('按键 %ld', 'Key %ld', 'Tangent %ld', 'Taste %ld'),
+ 'library.notGame': ('请选择由 NSP 流程构建的完整 nxnative Mac 游戏 App。', 'Choose a complete nxnative Mac game app built by the NSP pipeline.', 'Välj en komplett nxnative-spelapp för Mac som byggts av NSP-flödet.', 'Wähle eine vollständige nxnative-Mac-Spiel-App, die mit der NSP-Pipeline gebaut wurde.'),
}
diff --git a/frontend-qt/tests/test_localization_table.py b/frontend-qt/tests/test_localization_table.py
new file mode 100644
index 00000000..f20dfb0a
--- /dev/null
+++ b/frontend-qt/tests/test_localization_table.py
@@ -0,0 +1,25 @@
+"""gen_localization.py turns the Swift escapes into the text they mean, in every column."""
+from __future__ import annotations
+
+import sys
+import unittest
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[2]
+sys.path.insert(0, str(ROOT / 'frontend-qt'))
+
+from gen_localization import unescape # noqa: E402
+from nspb_qt.localization import TABLE # noqa: E402
+
+
+class Escapes(unittest.TestCase):
+ def test_tabs_newlines_and_backslashes_are_unescaped(self):
+ self.assertEqual(unescape(r'a\tb\\tc'), 'a\tb\\tc')
+ for column, text in enumerate(TABLE['fail.noTitleID.next']):
+ self.assertIn('\n', text, column)
+ self.assertIn('C:\\VulkanSDK\\', TABLE['dep.spirv.hint.win'][1])
+ self.assertNotIn('\\\\', TABLE['dep.spirv.hint.win'][1])
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/frontend/Sources/NSPortBuilder/ContentView.swift b/frontend/Sources/NSPortBuilder/ContentView.swift
index 9b669c7e..0b8a3fde 100644
--- a/frontend/Sources/NSPortBuilder/ContentView.swift
+++ b/frontend/Sources/NSPortBuilder/ContentView.swift
@@ -22,6 +22,19 @@ struct Stage: Identifiable {
var eta: Double? = nil // the script's estimate of the seconds left, as of etaAt
var etaAt: Date? = nil
+ /// A stage's name in the launcher's language. The script names its stages in English (PROG.stage in
+ /// build_ipa_from_nsp.py): stage.<name> in the table, "extract <name>" and "<API> shader capture" with their
+ /// part kept; a name the table does not know (a newer script's) is shown as the script wrote it.
+ static func localizedName(_ name: String, _ t: (String) -> String) -> String {
+ func known(_ key: String) -> String? { let s = t(key); return s == key ? nil : s }
+ let key = "stage." + name.lowercased().replacingOccurrences(of: "[^a-z0-9]+", with: "_", options: .regularExpression)
+ .trimmingCharacters(in: CharacterSet(charactersIn: "_"))
+ if let s = known(key) { return s }
+ if name.hasPrefix("extract "), let f = known("stage.extract") { return String(format: f, String(name.dropFirst("extract ".count))) }
+ if name.hasSuffix(" shader capture"), let f = known("stage.capture") { return String(format: f, String(name.dropLast(" shader capture".count))) }
+ return name
+ }
+
/// "3:42" since the stage began, then "1 min left" while the script's estimate, counted down from when it came,
/// lasts: the estimate only arrives with a new count, so one taken as it was would stand still with the count.
func clock(at now: Date, left: String) -> String {
@@ -1689,12 +1702,12 @@ final class BuildModel: ObservableObject {
noteChainChange(line)
guard let s = Self.parseStage(line) else { return }
if let i = stages.firstIndex(where: { $0.id == s.k }) {
- if !s.name.isEmpty { stages[i].name = s.name }
+ if !s.name.isEmpty { stages[i].name = Stage.localizedName(s.name, t) }
if s.state != .pending { stages[i].state = s.state }
if !s.detail.isEmpty { stages[i].detail = s.detail }
stages[i].percent = s.percent
} else if s.state != .pending {
- stages.append(Stage(id: s.k, name: s.name, state: s.state, detail: s.detail, percent: s.percent, started: Date()))
+ stages.append(Stage(id: s.k, name: Stage.localizedName(s.name, t), state: s.state, detail: s.detail, percent: s.percent, started: Date()))
stages.sort { $0.id < $1.id }
}
}
@@ -1719,14 +1732,14 @@ final class BuildModel: ObservableObject {
let k = (e["k"] as? NSNumber)?.intValue ?? 0
func stage(_ update: (inout Stage) -> Void) {
if let i = stages.firstIndex(where: { $0.id == k }) { update(&stages[i]) }
- else { var s = Stage(id: k, name: e["name"] as? String ?? ""); update(&s); stages.append(s); stages.sort { $0.id < $1.id } }
+ else { var s = Stage(id: k, name: Stage.localizedName(e["name"] as? String ?? "", t)); update(&s); stages.append(s); stages.sort { $0.id < $1.id } }
}
switch kind {
case "stage":
let name = e["name"] as? String ?? "", step = e["step"] as? String ?? ""
let n = (e["n"] as? NSNumber)?.intValue ?? 0
append("[\(k)/\(n)] \(name)" + (step.isEmpty ? "" : " · \(step)") + " …\n")
- stage { $0.name = name; $0.state = .running; $0.detail = step; $0.percent = nil; $0.started = Date(); $0.eta = nil }
+ stage { $0.name = Stage.localizedName(name, t); $0.state = .running; $0.detail = step; $0.percent = nil; $0.started = Date(); $0.eta = nil }
case "step":
let step = e["step"] as? String ?? ""
append(" · \(step)\n")
diff --git a/frontend/Sources/NSPortBuilder/Controls.swift b/frontend/Sources/NSPortBuilder/Controls.swift
index be1873b0..f9856930 100644
--- a/frontend/Sources/NSPortBuilder/Controls.swift
+++ b/frontend/Sources/NSPortBuilder/Controls.swift
@@ -111,8 +111,9 @@ final class ControlLayout: ObservableObject {
if let data = try? JSONEncoder().encode(Saved(keys: keys.mapValues { $0 ?? -1 }, pad: pad, mode: padMode.rawValue)) { defaults.set(data, forKey: "controlLayout") }
}
- /// A key's name on a US keyboard, by virtual key code (the host reads codes, so the name is only for the label).
- static func keyName(_ code: Int?) -> String? {
+ /// A key's name on a US keyboard, by virtual key code (the host reads codes, so the name is only for the label), in the
+ /// launcher's language through `t` where the key has a word for a name (key.<name>, key.keypad, key.code).
+ static func keyName(_ code: Int?, _ t: (String) -> String = { $0 }) -> String? {
guard let code else { return nil }
let names: [Int: String] = [
0: "A", 1: "S", 2: "D", 3: "F", 4: "H", 5: "G", 6: "Z", 7: "X", 8: "C", 9: "V", 11: "B", 12: "Q", 13: "W", 14: "E", 15: "R",
@@ -125,7 +126,10 @@ final class ControlLayout: ObservableObject {
113: "F15", 115: "Home", 116: "Page Up", 117: "Forward Delete", 118: "F4", 119: "End", 120: "F2", 121: "Page Down", 122: "F1",
123: "←", 124: "→", 125: "↓", 126: "↑",
]
- return names[code] ?? "Key \(code)"
+ func known(_ key: String) -> String? { let s = t(key); return s == key ? nil : s }
+ guard let name = names[code] else { return known("key.code").map { String(format: $0, code) } ?? "Key \(code)" }
+ if name.hasPrefix("Keypad "), let f = known("key.keypad") { return String(format: f, String(name.dropFirst("Keypad ".count))) }
+ return known("key." + name.lowercased().replacingOccurrences(of: " ", with: "_")) ?? name
}
}
@@ -227,7 +231,7 @@ struct ControlsView: View {
.buttonStyle(.plain).help(m.t("controls.clear"))
}
Button { on ? stopListening() : listen(f) } label: {
- Text(on ? m.t("controls.press") : ControlLayout.keyName(key) ?? m.t("controls.none"))
+ Text(on ? m.t("controls.press") : ControlLayout.keyName(key, m.t) ?? m.t("controls.none"))
.font(.manrope(12.5, on ? .bold : .semibold))
.foregroundStyle(on ? Color.black : key == nil ? Color.white.opacity(0.45) : Color.white.opacity(0.92))
.frame(maxWidth: .infinity).padding(.vertical, 6)
diff --git a/frontend/Sources/NSPortBuilder/Library.swift b/frontend/Sources/NSPortBuilder/Library.swift
index 17427c6b..54fec95d 100644
--- a/frontend/Sources/NSPortBuilder/Library.swift
+++ b/frontend/Sources/NSPortBuilder/Library.swift
@@ -81,9 +81,11 @@ extension LibraryGame {
/// One row of the app's `dm/launcher.json` (dm/games/settings.py), the list the iPhone launcher shows
/// (dm/ios/Sources/LauncherSettings.swift). Each sets an environment variable the game reads at start.
struct LaunchSetting: Decodable, Identifiable {
- let env, kind, label, note, def: String
+ let env, kind: String
+ var label, note: String // var: localized() puts the launcher's language in place of the build's English
+ let def: String
let section: String?
- let options: [[String]]? // choice: [value, label]
+ var options: [[String]]? // choice: [value, label]
let min, max, step: Double? // range
let on, off: String? // toggle: the values the variable takes
/// "basic" for a setting shown first (settings.tsv's level column, seedds/nxnative#399); without it, `basicByDefault` decides.
@@ -130,7 +132,7 @@ struct LaunchSetting: Decodable, Identifiable {
/// DM_FULLSCREEN in front_mac.m; a list from settings.tsv will carry it as a platform:mac row), and the render scale's
/// base size from the game's profile in the repository when the list does not carry it (render_base).
static func forMac(app: String, titleID: String, repo: String, labels: (String) -> String) -> [LaunchSetting]? {
- guard var list = read(app: app) else { return nil }
+ guard var list = read(app: app)?.map({ $0.localized(labels) }) else { return nil }
if !list.contains(where: { $0.env == "DM_FULLSCREEN" }) {
let display = LaunchSetting(env: "DM_FULLSCREEN", kind: "choice", label: labels("launch.display"), note: "", def: "",
section: "Game", options: [["", labels("launch.display.window")], ["1", labels("launch.display.fullscreen")]],
@@ -143,6 +145,21 @@ struct LaunchSetting: Decodable, Identifiable {
return list
}
+ /// The row in the launcher's language: launch.set.<VAR> for the label, launch.set.<VAR>.note for the note and
+ /// launch.opt.<VAR>.<value> for a choice. launcher.json carries English only; a key the table does not have (a row
+ /// a newer build adds) keeps the build's own text rather than showing the key.
+ func localized(_ labels: (String) -> String) -> LaunchSetting {
+ func text(_ key: String, _ fallback: String) -> String {
+ let s = labels(key)
+ return s == key ? fallback : s
+ }
+ var s = self
+ s.label = text("launch.set." + env, label)
+ if !note.isEmpty { s.note = text("launch.set.\(env).note", note) }
+ s.options = options?.map { $0.count > 1 ? [$0[0], text("launch.opt.\(env).\($0[0])", $0[1])] : $0 }
+ return s
+ }
+
/// render_base in the game's profile ("1600x900 1280x720": docked, then handheld).
static func renderBase(titleID: String, repo: String) -> [String: [Int]]? {
let path = EngineLayout.root(repo) + "/dm/games/" + titleID + "/game.tsv"
@@ -225,7 +242,7 @@ struct MacGameBundle {
enum Invalid: LocalizedError {
case notGame
- var errorDescription: String? { "Choose a complete nxnative Mac game app built by the NSP pipeline." }
+ var errorDescription: String? { L10n.string("library.notGame", Lang.initial()) }
}
static func read(_ url: URL) throws -> MacGameBundle {
diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swift
index 3def7147..5ea854fd 100644
--- a/frontend/Sources/NSPortBuilder/Localization.swift
+++ b/frontend/Sources/NSPortBuilder/Localization.swift
@@ -1159,6 +1159,69 @@ enum L10n {
"engine.fail.download": ("无法下载引擎。请检查网络后重试。", "The engine could not be downloaded. Check the connection and try again."),
"engine.fail.digest": ("下载的引擎与校验和不符。未安装任何内容。", "The downloaded engine does not match its checksum. Nothing was installed."),
"engine.fail.install": ("无法安装引擎。请检查可用空间后重试。", "The engine could not be installed. Check the free space and try again."),
+ // Launch options by environment variable (dm/games/settings.tsv; DM_LANG values from dm/tools/nacp.py): LaunchSetting.localized
+ "launch.opt.DM_FPS_TARGET.30": ("30 fps", "30 fps"),
+ "launch.opt.DM_FPS_TARGET.60": ("60 fps", "60 fps"),
+ "launch.opt.DM_PRESENT_UPSCALE.metalfx": ("MetalFX", "MetalFX"),
+ "launch.opt.DM_LANG.en-US": ("美式英语", "American English"),
+ "launch.opt.DM_LANG.en-GB": ("英式英语", "British English"),
+ "launch.opt.DM_LANG.ja": ("日语", "Japanese"),
+ "launch.opt.DM_LANG.fr": ("法语", "French"),
+ "launch.opt.DM_LANG.de": ("德语", "German"),
+ "launch.opt.DM_LANG.es-419": ("拉丁美洲西班牙语", "Latin American Spanish"),
+ "launch.opt.DM_LANG.es": ("西班牙语", "Spanish"),
+ "launch.opt.DM_LANG.it": ("意大利语", "Italian"),
+ "launch.opt.DM_LANG.nl": ("荷兰语", "Dutch"),
+ "launch.opt.DM_LANG.fr-CA": ("加拿大法语", "Canadian French"),
+ "launch.opt.DM_LANG.pt": ("葡萄牙语", "Portuguese"),
+ "launch.opt.DM_LANG.ru": ("俄语", "Russian"),
+ "launch.opt.DM_LANG.ko": ("韩语", "Korean"),
+ "launch.opt.DM_LANG.zh-Hant": ("繁体中文", "Traditional Chinese"),
+ "launch.opt.DM_LANG.zh-Hans": ("简体中文", "Simplified Chinese"),
+ "launch.opt.DM_LANG.pt-BR": ("巴西葡萄牙语", "Brazilian Portuguese"),
+ // Build stages by the name build_ipa_from_nsp.py gives them (PROG.stage): Stage.localizedName
+ "stage.decompress_nsz": ("解压 NSZ", "decompress NSZ"),
+ "stage.build_id_lookup": ("查找构建 ID", "build ID lookup"),
+ "stage.survey_build_nx_extract": ("勘察:构建 nx_extract", "survey: build nx_extract"),
+ "stage.survey_romfs_manifest": ("勘察:RomFS 清单", "survey: RomFS manifest"),
+ "stage.survey_code_modules": ("勘察:代码模块", "survey: code modules"),
+ "stage.survey_imports_vs_host_hooks": ("勘察:导入与主机钩子", "survey: imports vs host hooks"),
+ "stage.extract_dlc": ("提取 DLC", "extract DLC"),
+ "stage.rewrite": ("改写代码", "rewrite"),
+ "stage.glslc_capture": ("GLSLC 捕获", "GLSLC capture"),
+ "stage.ue_shader_decode": ("UE 着色器解码", "UE shader decode"),
+ "stage.heap_check": ("堆检查", "heap check"),
+ "stage.address_regions": ("地址区域", "address regions"),
+ "stage.shader_split": ("着色器拆分", "shader split"),
+ "stage.mac_shaders": ("Mac 着色器", "Mac shaders"),
+ "stage.ios_shaders": ("iOS 着色器", "iOS shaders"),
+ "stage.vulkan_shaders": ("Vulkan 着色器", "Vulkan shaders"),
+ "stage.gl_shaders": ("GL 着色器", "GL shaders"),
+ "stage.ipa_pack": ("打包 IPA", "IPA pack"),
+ "stage.mac_host": ("Mac 主机程序", "Mac host"),
+ "stage.pipeline_prebuild": ("管线预构建", "Pipeline prebuild"),
+ "stage.pipeline_archive": ("管线存档", "Pipeline archive"),
+ "stage.mac_app": ("Mac App", "Mac app"),
+ "stage.build_nx_extract": ("构建 nx_extract", "build nx_extract"),
+ "stage.prepare_xcode": ("准备 Xcode", "prepare Xcode"),
+ "stage.app_build": ("构建 App", "app build"),
+ "stage.extract": ("提取 %@", "extract %@"),
+ "stage.capture": ("%@ 着色器捕获", "%@ shader capture"),
+ // Key names in Controls (ControlLayout.keyName) and the library's wrong-app error
+ "key.return": ("回车", "Return"),
+ "key.tab": ("Tab", "Tab"),
+ "key.space": ("空格", "Space"),
+ "key.delete": ("删除", "Delete"),
+ "key.clear": ("清除", "Clear"),
+ "key.enter": ("Enter", "Enter"),
+ "key.home": ("Home", "Home"),
+ "key.end": ("End", "End"),
+ "key.page_up": ("Page Up", "Page Up"),
+ "key.page_down": ("Page Down", "Page Down"),
+ "key.forward_delete": ("向前删除", "Forward Delete"),
+ "key.keypad": ("小键盘 %@", "Keypad %@"),
+ "key.code": ("按键 %ld", "Key %ld"),
+ "library.notGame": ("请选择由 NSP 流程构建的完整 nxnative Mac 游戏 App。", "Choose a complete nxnative Mac game app built by the NSP pipeline."),
]
/// Swedish translations are kept as an overlay so adding a language does not require a
@@ -1969,6 +2032,66 @@ enum L10n {
"engine.fail.download": "Motorn kunde inte laddas ner. Kontrollera anslutningen och försök igen.",
"engine.fail.digest": "Den nedladdade motorn stämmer inte med sin kontrollsumma. Inget installerades.",
"engine.fail.install": "Motorn kunde inte installeras. Kontrollera ledigt utrymme och försök igen.",
+ "launch.opt.DM_FPS_TARGET.30": "30 fps",
+ "launch.opt.DM_FPS_TARGET.60": "60 fps",
+ "launch.opt.DM_PRESENT_UPSCALE.metalfx": "MetalFX",
+ "launch.opt.DM_LANG.en-US": "Amerikansk engelska",
+ "launch.opt.DM_LANG.en-GB": "Brittisk engelska",
+ "launch.opt.DM_LANG.ja": "Japanska",
+ "launch.opt.DM_LANG.fr": "Franska",
+ "launch.opt.DM_LANG.de": "Tyska",
+ "launch.opt.DM_LANG.es-419": "Latinamerikansk spanska",
+ "launch.opt.DM_LANG.es": "Spanska",
+ "launch.opt.DM_LANG.it": "Italienska",
+ "launch.opt.DM_LANG.nl": "Nederländska",
+ "launch.opt.DM_LANG.fr-CA": "Kanadensisk franska",
+ "launch.opt.DM_LANG.pt": "Portugisiska",
+ "launch.opt.DM_LANG.ru": "Ryska",
+ "launch.opt.DM_LANG.ko": "Koreanska",
+ "launch.opt.DM_LANG.zh-Hant": "Traditionell kinesiska",
+ "launch.opt.DM_LANG.zh-Hans": "Förenklad kinesiska",
+ "launch.opt.DM_LANG.pt-BR": "Brasiliansk portugisiska",
+ "stage.decompress_nsz": "Packa upp NSZ",
+ "stage.build_id_lookup": "Söker bygg-ID",
+ "stage.survey_build_nx_extract": "Kartläggning: bygg nx_extract",
+ "stage.survey_romfs_manifest": "Kartläggning: RomFS-manifest",
+ "stage.survey_code_modules": "Kartläggning: kodmoduler",
+ "stage.survey_imports_vs_host_hooks": "Kartläggning: importer mot värdkrokar",
+ "stage.extract_dlc": "Extrahera DLC",
+ "stage.rewrite": "Skriv om koden",
+ "stage.glslc_capture": "GLSLC-insamling",
+ "stage.ue_shader_decode": "Avkodning av UE-shaders",
+ "stage.heap_check": "Heapkontroll",
+ "stage.address_regions": "Adressområden",
+ "stage.shader_split": "Uppdelning av shaders",
+ "stage.mac_shaders": "Mac-shaders",
+ "stage.ios_shaders": "iOS-shaders",
+ "stage.vulkan_shaders": "Vulkan-shaders",
+ "stage.gl_shaders": "GL-shaders",
+ "stage.ipa_pack": "Packa IPA",
+ "stage.mac_host": "Mac-värd",
+ "stage.pipeline_prebuild": "Förbygg pipelines",
+ "stage.pipeline_archive": "Pipelinearkiv",
+ "stage.mac_app": "Mac-app",
+ "stage.build_nx_extract": "Bygg nx_extract",
+ "stage.prepare_xcode": "Förbered Xcode",
+ "stage.app_build": "Bygg appen",
+ "stage.extract": "Extrahera %@",
+ "stage.capture": "Insamling av %@-shaders",
+ "key.return": "Retur",
+ "key.tab": "Tabb",
+ "key.space": "Mellanslag",
+ "key.delete": "Radera",
+ "key.clear": "Rensa",
+ "key.enter": "Enter",
+ "key.home": "Home",
+ "key.end": "End",
+ "key.page_up": "Page Up",
+ "key.page_down": "Page Down",
+ "key.forward_delete": "Radera framåt",
+ "key.keypad": "Numeriskt %@",
+ "key.code": "Tangent %ld",
+ "library.notGame": "Välj en komplett nxnative-spelapp för Mac som byggts av NSP-flödet.",
]
/// German translations, an overlay like Swedish: informal "du", Apple's German terms for system
@@ -2956,6 +3079,67 @@ enum L10n {
"fail.devicePairing.next": "Schließe das Gerät mit einem Kabel an, tippe auf dem Gerät auf Vertrauen und gib den Code ein. Versuche es dann erneut.",
"fail.shellDataIncomplete.what": "Die Spieldaten auf dem Gerät sind unvollständig.",
"fail.shellDataIncomplete.next": "Das Spiel ist noch nicht spielbereit. Entsperre das Gerät und lass es verbunden, dann versuche es erneut. Nur fehlende oder unvollständige Dateien werden kopiert.",
+ // Launch options, build stages, key names (LaunchSetting.localized, Stage.localizedName, ControlLayout.keyName)
+ "launch.opt.DM_FPS_TARGET.30": "30 fps",
+ "launch.opt.DM_FPS_TARGET.60": "60 fps",
+ "launch.opt.DM_PRESENT_UPSCALE.metalfx": "MetalFX",
+ "launch.opt.DM_LANG.en-US": "Amerikanisches Englisch",
+ "launch.opt.DM_LANG.en-GB": "Britisches Englisch",
+ "launch.opt.DM_LANG.ja": "Japanisch",
+ "launch.opt.DM_LANG.fr": "Französisch",
+ "launch.opt.DM_LANG.de": "Deutsch",
+ "launch.opt.DM_LANG.es-419": "Lateinamerikanisches Spanisch",
+ "launch.opt.DM_LANG.es": "Spanisch",
+ "launch.opt.DM_LANG.it": "Italienisch",
+ "launch.opt.DM_LANG.nl": "Niederländisch",
+ "launch.opt.DM_LANG.fr-CA": "Kanadisches Französisch",
+ "launch.opt.DM_LANG.pt": "Portugiesisch",
+ "launch.opt.DM_LANG.ru": "Russisch",
+ "launch.opt.DM_LANG.ko": "Koreanisch",
+ "launch.opt.DM_LANG.zh-Hant": "Traditionelles Chinesisch",
+ "launch.opt.DM_LANG.zh-Hans": "Vereinfachtes Chinesisch",
+ "launch.opt.DM_LANG.pt-BR": "Brasilianisches Portugiesisch",
+ "stage.decompress_nsz": "NSZ entpacken",
+ "stage.build_id_lookup": "Build-ID suchen",
+ "stage.survey_build_nx_extract": "Analyse: nx_extract bauen",
+ "stage.survey_romfs_manifest": "Analyse: RomFS-Manifest",
+ "stage.survey_code_modules": "Analyse: Code-Module",
+ "stage.survey_imports_vs_host_hooks": "Analyse: Importe und Host-Hooks",
+ "stage.extract_dlc": "DLC extrahieren",
+ "stage.rewrite": "Umschreiben",
+ "stage.glslc_capture": "GLSLC-Erfassung",
+ "stage.ue_shader_decode": "UE-Shader dekodieren",
+ "stage.heap_check": "Heap-Prüfung",
+ "stage.address_regions": "Adressbereiche",
+ "stage.shader_split": "Shader aufteilen",
+ "stage.mac_shaders": "Mac-Shader",
+ "stage.ios_shaders": "iOS-Shader",
+ "stage.vulkan_shaders": "Vulkan-Shader",
+ "stage.gl_shaders": "GL-Shader",
+ "stage.ipa_pack": "IPA packen",
+ "stage.mac_host": "Mac-Host",
+ "stage.pipeline_prebuild": "Pipelines vorab erstellen",
+ "stage.pipeline_archive": "Pipeline-Archiv",
+ "stage.mac_app": "Mac-App",
+ "stage.build_nx_extract": "nx_extract bauen",
+ "stage.prepare_xcode": "Xcode vorbereiten",
+ "stage.app_build": "App bauen",
+ "stage.extract": "%@ extrahieren",
+ "stage.capture": "%@-Shader-Erfassung",
+ "key.return": "Zeilenschalter",
+ "key.tab": "Tabulator",
+ "key.space": "Leertaste",
+ "key.delete": "Rückschritt",
+ "key.clear": "Löschen",
+ "key.enter": "Eingabe",
+ "key.home": "Pos1",
+ "key.end": "Ende",
+ "key.page_up": "Bild auf",
+ "key.page_down": "Bild ab",
+ "key.forward_delete": "Entfernen",
+ "key.keypad": "Ziffernblock %@",
+ "key.code": "Taste %ld",
+ "library.notGame": "Wähle eine vollständige nxnative-Mac-Spiel-App, die mit der NSP-Pipeline gebaut wurde.",
]
static func string(_ key: String, _ lang: Lang) -> String {
diff --git a/frontend/Tests/NSPortBuilderTests/BuildFailureRowsTests.swift b/frontend/Tests/NSPortBuilderTests/BuildFailureRowsTests.swift
index 293309d5..28110289 100644
--- a/frontend/Tests/NSPortBuilderTests/BuildFailureRowsTests.swift
+++ b/frontend/Tests/NSPortBuilderTests/BuildFailureRowsTests.swift
@@ -66,6 +66,7 @@ final class BuildFailureRowsTests: XCTestCase {
XCTAssertEqual(low, BuildFailure(kind: .diskFull, gameName: nil, detail: try fixture("disk.low").gb))
XCTAssertEqual(BuildFailureClassifier.classify(try fixture("disk.full").text), BuildFailure(kind: .diskFull, gameName: nil, detail: nil))
let m = BuildModel()
+ m.lang = .en // the English text, whatever the Mac's language
XCTAssertTrue(m.failureWhat(low).contains("40 GB"), m.failureWhat(low))
XCTAssertFalse(m.failureWhat(BuildFailure(kind: .diskFull, gameName: nil)).contains("GB"))
}
diff --git a/frontend/Tests/NSPortBuilderTests/ControlsTests.swift b/frontend/Tests/NSPortBuilderTests/ControlsTests.swift
index 48b3fe92..65e2b270 100644
--- a/frontend/Tests/NSPortBuilderTests/ControlsTests.swift
+++ b/frontend/Tests/NSPortBuilderTests/ControlsTests.swift
@@ -61,5 +61,22 @@ final class ControlsTests: XCTestCase {
for f in ControlLayout.functions { XCTAssertNotNil(L10n.table["controls.fn." + f.id], f.id) }
XCTAssertEqual(ControlLayout.keyName(49), "Space")
XCTAssertEqual(ControlLayout.keyName(126), "↑")
+ XCTAssertEqual(ControlLayout.keyName(49, { L10n.string($0, .zh) }), "空格")
+ XCTAssertEqual(ControlLayout.keyName(83, { L10n.string($0, .sv) }), "Numeriskt 1")
+ XCTAssertEqual(ControlLayout.keyName(0, { L10n.string($0, .zh) }), "A", "a letter stays a letter")
+ XCTAssertEqual(ControlLayout.keyName(200, { L10n.string($0, .sv) }), "Tangent 200")
+ }
+}
+
+final class StageNameTests: XCTestCase {
+ func testTheScriptsStageNamesAreShownInTheLaunchersLanguage() {
+ let zh = { (k: String) in L10n.string(k, .zh) }, sv = { (k: String) in L10n.string(k, .sv) }
+ XCTAssertEqual(Stage.localizedName("Mac shaders", zh), "Mac 着色器")
+ XCTAssertEqual(Stage.localizedName("iOS shaders", zh), "iOS 着色器")
+ XCTAssertEqual(Stage.localizedName("survey: code modules", sv), "Kartläggning: kodmoduler")
+ XCTAssertEqual(Stage.localizedName("extract v1.2.0", sv), "Extrahera v1.2.0", "the version is kept")
+ XCTAssertEqual(Stage.localizedName("Vulkan shader capture", zh), "Vulkan 着色器捕获")
+ XCTAssertEqual(Stage.localizedName("a stage added later", zh), "a stage added later", "an unknown name stays as the script wrote it")
+ XCTAssertEqual(Stage.localizedName("Mac app", { $0 }), "Mac app")
}
}
diff --git a/frontend/Tests/NSPortBuilderTests/GermanLocalizationTests.swift b/frontend/Tests/NSPortBuilderTests/GermanLocalizationTests.swift
index 922d2ad6..123ba303 100644
--- a/frontend/Tests/NSPortBuilderTests/GermanLocalizationTests.swift
+++ b/frontend/Tests/NSPortBuilderTests/GermanLocalizationTests.swift
@@ -18,6 +18,7 @@ final class GermanLocalizationTests: XCTestCase {
"controls.fn.A", "controls.fn.B", "controls.fn.X", "controls.fn.Y", "controls.fn.L", "controls.fn.R",
"controls.fn.ZL", "controls.fn.ZR", "controls.fn.Plus", "controls.fn.Minus", "launch.mods",
"update.pill", "launch.opt.DM_OPMODE.0", "launch.opt.DM_PRESENT_UPSCALE.off",
+ "launch.opt.DM_FPS_TARGET.30", "launch.opt.DM_FPS_TARGET.60", "launch.opt.DM_PRESENT_UPSCALE.metalfx",
]
/// printf-style placeholders in order: %@, %d, %ld, %lld, %.0f and %.1f, positional %1$@, and %%.
diff --git a/frontend/Tests/NSPortBuilderTests/LaunchOptionsTests.swift b/frontend/Tests/NSPortBuilderTests/LaunchOptionsTests.swift
index 84340b42..9f9c1c83 100644
--- a/frontend/Tests/NSPortBuilderTests/LaunchOptionsTests.swift
+++ b/frontend/Tests/NSPortBuilderTests/LaunchOptionsTests.swift
@@ -28,6 +28,46 @@ final class LaunchOptionsTests: XCTestCase {
private let opmode = #"{"env": "DM_OPMODE", "kind": "choice", "label": "Console mode", "note": "", "default": "1", "section": "Game", "options": [["1", "Docked"], ["0", "Handheld"]]}"#
private let hud = #"{"env": "DM_METAL_HUD", "kind": "toggle", "label": "Metal HUD", "note": "", "default": "0", "section": "Performance", "on": "1", "off": "0"}"#
+ func testTheBuildsEnglishRowsAreShownInTheLaunchersLanguage() throws {
+ let unknown = #"{"env": "DM_NEW", "kind": "choice", "label": "New setting", "note": "A note", "default": "a", "section": "Game", "options": [["a", "Alpha"]]}"#
+ let (app, repo) = try app([opmode, unknown].joined(separator: ","))
+ let sv = try XCTUnwrap(LaunchSetting.forMac(app: app, titleID: "01007EF00011E000", repo: repo, labels: { L10n.string($0, .sv) }))
+ let mode = try XCTUnwrap(sv.first { $0.env == "DM_OPMODE" })
+ XCTAssertEqual(mode.label, "Konsolläge")
+ XCTAssertEqual(mode.options ?? [], [["1", "Dockad"], ["0", "Handhållen"]], "the values stay, the labels change")
+ let new = try XCTUnwrap(sv.first { $0.env == "DM_NEW" })
+ XCTAssertEqual([new.label, new.note], ["New setting", "A note"], "a row the table does not know keeps the build's text")
+ XCTAssertEqual(new.options ?? [], [["a", "Alpha"]])
+ let zh = try XCTUnwrap(LaunchSetting.forMac(app: app, titleID: "01007EF00011E000", repo: repo, labels: { L10n.string($0, .zh) }))
+ XCTAssertEqual(zh.first { $0.env == "DM_OPMODE" }?.label, "主机模式")
+ }
+
+ /// Every row of dm/games/settings.tsv and every language of dm/tools/nacp.py has its launch.set or launch.opt entry, with the same
+ /// English, so a row added there is translated here too.
+ func testEveryPlayerFacingSettingHasItsEntries() throws {
+ let tsv = try String(contentsOf: BuildFailureTests.engine.appendingPathComponent("dm/games/settings.tsv"), encoding: .utf8)
+ for line in tsv.split(separator: "\n") where !line.hasPrefix("#") {
+ let c = line.split(separator: "\t", omittingEmptySubsequences: false).map(String.init)
+ guard c.count > 6 else { continue }
+ XCTAssertEqual(L10n.string("launch.set." + c[0], .en), c[6], c[0])
+ // DM_PSO_MTL4's note is written without the semicolon settings.tsv has; the table follows the text rules.
+ if c.count > 7, !c[7].isEmpty, c[0] != "DM_PSO_MTL4" { XCTAssertEqual(L10n.string("launch.set.\(c[0]).note", .en), c[7], c[0]) }
+ if c[1] == "choice", c[2] != "languages" {
+ for pair in c[2].split(separator: ",") {
+ let v = pair.split(separator: "=", maxSplits: 1).map(String.init)
+ XCTAssertEqual(L10n.string("launch.opt.\(c[0]).\(v[0])", .en), v[1], c[0])
+ }
+ }
+ }
+ let nacp = try String(contentsOf: BuildFailureTests.engine.appendingPathComponent("dm/tools/nacp.py"), encoding: .utf8)
+ let re = try NSRegularExpression(pattern: #"\('([A-Za-z-0-9]+)', '([^']+)'\)"#)
+ let langs = re.matches(in: nacp, range: NSRange(nacp.startIndex..., in: nacp)).map { m in
+ (String(nacp[Range(m.range(at: 1), in: nacp)!]), String(nacp[Range(m.range(at: 2), in: nacp)!]))
+ }
+ XCTAssertEqual(langs.count, 16)
+ for (code, name) in langs { XCTAssertEqual(L10n.string("launch.opt.DM_LANG." + code, .en), name, code) }
+ }
+
func testDisplayModeComesAfterTheRenderScaleAndWindowLeavesTheVariableUnset() throws {
let (app, repo) = try app([scale, opmode].joined(separator: ","))
let list = try XCTUnwrap(LaunchSetting.forMac(app: app, titleID: "01007EF00011E000", repo: repo, labels: { $0 }))
diff --git a/frontend/Tests/NSPortBuilderTests/LibraryTests.swift b/frontend/Tests/NSPortBuilderTests/LibraryTests.swift
index 25ff689e..6a89189a 100644
--- a/frontend/Tests/NSPortBuilderTests/LibraryTests.swift
+++ b/frontend/Tests/NSPortBuilderTests/LibraryTests.swift
@@ -559,6 +559,7 @@ final class LibraryTests: XCTestCase {
let saved = ["repoPath", "buildTarget", "buildOutputDirectory"].map { ($0, UserDefaults.standard.object(forKey: $0)) }
defer { for (key, value) in saved { UserDefaults.standard.set(value, forKey: key) } }
let model = BuildModel()
+ model.lang = .en // the script's stage name as English shows it, whatever the Mac's language
model.repoPath = temporary.path
model.target = "mac-app"
model.outDir = temporary.path