Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit
Swift apple-silicond3dmetaldxmtdxvkgame-porting-toolkitgptkmac-gamingmacosmetalfxrosetta-2steamsteam-playwinewinecx
Add Simplified Chinese localization with English fallback
KameraZhaoe1f0e68f665b
diff --git a/Makefile b/Makefileindex 23bed07..7f878d3 100644--- a/Makefile+++ b/Makefile@@ -328,6 +328,7 @@ panel-behavior:node $(PANEL_TESTS)/launch-options.js $(OUT_DIR)/panel-emit && \node $(PANEL_TESTS)/shell.js $(OUT_DIR)/panel-emit && \node $(PANEL_TESTS)/migration.js $(OUT_DIR)/panel-emit && \+ node $(PANEL_TESTS)/localization.js $(OUT_DIR)/panel-emit && \echo "==> panel behavior: renders as expected, no stale arguments"CX_ROOT ?= /Applications/CrossOver Preview.appdiff --git a/app/Info.plist b/app/Info.plistindex 87ebd53..8b24259 100644--- a/app/Info.plist+++ b/app/Info.plist@@ -4,6 +4,11 @@<dict><key>CFBundleDevelopmentRegion</key><string>en</string>+ <key>CFBundleLocalizations</key>+ <array>+ <string>en</string>+ <string>zh-Hans</string>+ </array><key>CFBundleExecutable</key><string>NotProtonApp</string><key>CFBundleIconFile</key>diff --git a/app/Package.swift b/app/Package.swiftindex 6d4b9e7..b2178e2 100644--- a/app/Package.swift+++ b/app/Package.swift@@ -14,6 +14,7 @@ let hasPayload = FileManager.default.fileExists(atPath: packageRoot.appendingPathComponent(payloadPath).path)let package = Package(name: "NotProtonApp",+ defaultLocalization: "en",platforms: [.macOS("15.0")],dependencies: [.package(url: "https://github.com/sparkle-project/Sparkle", exact: "2.10.0"),@@ -24,6 +25,7 @@ let package = Package(dependencies: [.product(name: "Sparkle", package: "Sparkle")],path: "Sources/NotProtonApp",resources: (hasPayload ? [.copy("Resources/payload")] : []) + [+ .process("Resources/Localization"),.copy("Resources/payload.manifest"),.copy("Resources/valve-packages.manifest"),.copy("Resources/detour2.bin"),diff --git a/app/Sources/NotProtonApp/App.swift b/app/Sources/NotProtonApp/App.swiftindex e431792..56f2bf4 100644--- a/app/Sources/NotProtonApp/App.swift+++ b/app/Sources/NotProtonApp/App.swift@@ -33,20 +33,20 @@ struct NotProtonApp: App {CommandGroup(replacing: .newItem) {}CommandGroup(after: .appInfo) {- Button("Check for Updates…") { updater.check() }+ Button(L10n.tr("Check for Updates…")) { updater.check() }}CommandGroup(after: .sidebar) {- Button("Status") { pane = .status }+ Button(L10n.tr("Status")) { pane = .status }.keyboardShortcut("1", modifiers: .command)- Button("Prefixes") { pane = .prefixes }+ Button(L10n.tr("Prefixes")) { pane = .prefixes }.keyboardShortcut("2", modifiers: .command)- Button("Prefix Backups") { pane = .backups }+ Button(L10n.tr("Prefix Backups")) { pane = .backups }.keyboardShortcut("3", modifiers: .command)Divider()- Button("Refresh") {+ Button(L10n.tr("Refresh")) {Task {switch pane {case .status: await status.refresh()@@ -60,27 +60,27 @@ struct NotProtonApp: App {Divider()}- CommandMenu("Setup") {- Button("Install") { Task { await status.requestInstall() } }+ CommandMenu(L10n.tr("Setup")) {+ Button(L10n.tr("Install")) { Task { await status.requestInstall() } }.keyboardShortcut("i", modifiers: .command).disabled(!status.canInstall)- Button("Set Up Compatibility Tool") { Task { await status.requestCompatibilityTool() } }+ Button(L10n.tr("Set Up Compatibility Tool")) { Task { await status.requestCompatibilityTool() } }.disabled(!status.canInstall || status.setupSource == nil)- Button("Fetch Valve Binaries") { Task { await status.fetchValveBinaries() } }+ Button(L10n.tr("Fetch Valve Binaries")) { Task { await status.fetchValveBinaries() } }.disabled(!status.canInstall)Divider()updateBlockCommand- Button("Repair Steam") { status.pendingConfirmation = .replaceSteam }+ Button(L10n.tr("Repair Steam")) { status.pendingConfirmation = .replaceSteam }.disabled(!status.isIdle)Divider()- Button("Reveal Log in Finder") {+ Button(L10n.tr("Reveal Log in Finder")) {NSWorkspace.shared.activateFileViewerSelecting([AppLog.file])}}@@ -90,8 +90,8 @@ struct NotProtonApp: App {@CommandsBuilderprivate var prefixMenu: some Commands {- CommandMenu("Prefix") {- Button("Run Program…") {+ CommandMenu(L10n.tr("Prefix")) {+ Button(L10n.tr("Run Program…")) {if let prefix = prefixTarget { prefixes.chooseExecutable(for: prefix) }}.disabled(prefixTarget == nil)@@ -107,7 +107,7 @@ struct NotProtonApp: App {Divider()- Button("Reveal in Finder") {+ Button(L10n.tr("Reveal in Finder")) {if let prefix = prefixes.selectedPrefix { prefixes.reveal(prefix) }}.keyboardShortcut("r", modifiers: [.command, .shift])@@ -160,10 +160,10 @@ struct NotProtonApp: App {@ViewBuilderprivate var updateBlockCommand: some View {if status.snapshot?.updateBlocked == true {- Button("Allow Client Updates") { Task { await status.setUpdateBlock(false) } }+ Button(L10n.tr("Allow Client Updates")) { Task { await status.setUpdateBlock(false) } }.disabled(!status.isIdle)} else {- Button("Block Client Updates") { status.pendingConfirmation = .blockUpdates }+ Button(L10n.tr("Block Client Updates")) { status.pendingConfirmation = .blockUpdates }.disabled(!status.isIdle || status.snapshot == nil)}}diff --git a/app/Sources/NotProtonApp/Model/BridgePayload.swift b/app/Sources/NotProtonApp/Model/BridgePayload.swiftindex 5f0a5d3..4804d8c 100644--- a/app/Sources/NotProtonApp/Model/BridgePayload.swift+++ b/app/Sources/NotProtonApp/Model/BridgePayload.swift@@ -5,7 +5,7 @@import Foundationenum BridgePayload {- static let step = "Copy the built bridge files"+ static let step = L10n.tr("Copy the built bridge files")struct Entry: Sendable {// Two different lsteamclient binaries, one 32 bit and one 64 bit.@@ -45,7 +45,7 @@ enum BridgePayload {guard let payloadRoot = try? InstallPayload.root() else {throw StepFailure(step: step,- detail: "NotProton carries no components."+ detail: L10n.tr("NotProton carries no components."))}base = payloadRoot.appending(path: "bridge")@@ -67,8 +67,7 @@ enum BridgePayload {guard missing.isEmpty else {throw StepFailure(step: step,- detail: "Missing components: \(missing.joined(separator: ", ")). "- + "Run make app-payload and build the app again."+ detail: L10n.tr("Missing components: \(missing.joined(separator: ", ")). Run make app-payload and build the app again."))}diff --git a/app/Sources/NotProtonApp/Model/CrossOverLicense.swift b/app/Sources/NotProtonApp/Model/CrossOverLicense.swiftindex 07155f1..45e7e0b 100644--- a/app/Sources/NotProtonApp/Model/CrossOverLicense.swift+++ b/app/Sources/NotProtonApp/Model/CrossOverLicense.swift@@ -24,8 +24,8 @@ enum CrossOverLicense {private static let licenseBase = "com.codeweavers.CrossOver"- static let notActivatedTitle = "CrossOver does not appear to be activated."- static let notActivatedAdvice = "Please run CrossOver and try again."+ static let notActivatedTitle = L10n.tr("CrossOver does not appear to be activated.")+ static let notActivatedAdvice = L10n.tr("Please run CrossOver and try again.")static var notActivated: String { "\(notActivatedTitle) \(notActivatedAdvice)" }static let defaultOpenssl = "/usr/bin/openssl"@@ -94,7 +94,7 @@ enum CrossOverLicense {if result.succeeded {return Status(licensed: true,- detail: "CrossOver is activated.",+ detail: L10n.tr("CrossOver is activated."),diagnostic: "valid license in \(label)")}@@ -127,7 +127,7 @@ enum CrossOverLicense {let status = check(crossOverRoot: install.crossOverRoot)guard status.licensed else {throw StepFailure(- step: "Verify CrossOver license",+ step: L10n.tr("Verify CrossOver license"),detail: status.detail)}diff --git a/app/Sources/NotProtonApp/Model/CrossOverSource.swift b/app/Sources/NotProtonApp/Model/CrossOverSource.swiftindex ea4b67c..2d6baf3 100644--- a/app/Sources/NotProtonApp/Model/CrossOverSource.swift+++ b/app/Sources/NotProtonApp/Model/CrossOverSource.swift@@ -157,16 +157,14 @@ enum CrossOverSource {let ntdll = NtdllPatcher.cleanSource(inRoot: root, arch: arch)guard let actual = Digest.sha256IfPresent(ntdll) else {throw StepFailure(- step: "Verify CrossOver",- detail: "\(arch.rawValue)/ntdll.dll is missing from \(root.path(percentEncoded: false))."+ step: L10n.tr("Verify CrossOver"),+ detail: L10n.tr("\(arch.rawValue)/ntdll.dll is missing from \(root.path(percentEncoded: false))."))}guard actual == expected else {throw StepFailure(- step: "Verify CrossOver",- detail: "\(arch.rawValue)/\(ntdll.lastPathComponent) is not the build "- + "\(build.bundleVersion) copy. Expected \(expected.prefix(16)), "- + "found \(actual.prefix(16))."+ step: L10n.tr("Verify CrossOver"),+ detail: L10n.tr("\(arch.rawValue)/\(ntdll.lastPathComponent) is not the build \(build.bundleVersion) copy. Expected \(expected.prefix(16)), found \(actual.prefix(16))."))}}diff --git a/app/Sources/NotProtonApp/Model/DeploymentContent.swift b/app/Sources/NotProtonApp/Model/DeploymentContent.swiftindex c0df85f..8705457 100644--- a/app/Sources/NotProtonApp/Model/DeploymentContent.swift+++ b/app/Sources/NotProtonApp/Model/DeploymentContent.swift@@ -60,11 +60,11 @@ enum DeploymentContent {let parent = app.deletingLastPathComponent().path(percentEncoded: false)let fd = open(parent, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC)guard fd >= 0 else {- throw StepFailure(step: SteamInstaller.step, detail: "Could not lock the installation at \(parent): \(String(cString: strerror(errno))).")+ throw StepFailure(step: SteamInstaller.step, detail: L10n.tr("Could not lock the installation at \(parent): \(String(cString: strerror(errno)))."))}guard flock(fd, LOCK_EX | LOCK_NB) == 0 else {close(fd)- throw StepFailure(step: SteamInstaller.step, detail: "Another installation operation is changing files here. Wait for it to finish.")+ throw StepFailure(step: SteamInstaller.step, detail: L10n.tr("Another installation operation is changing files here. Wait for it to finish."))}return fd}@@ -73,7 +73,7 @@ enum DeploymentContent {guard FileManager.default.fileExists(atPath: file.path(percentEncoded: false)) else { return nil }let build = try JSONDecoder().decode(Build.self, from: Data(contentsOf: file))guard !build.version.isEmpty, build.builtAt > 0 else {- throw StepFailure(step: "Check installed files", detail: "The installed build record is invalid.")+ throw StepFailure(step: L10n.tr("Check installed files"), detail: L10n.tr("The installed build record is invalid."))}return build}@@ -99,8 +99,8 @@ enum DeploymentContent {let deployed = try MachOBuild.hashesIgnoringSignature(of: dylib.destination),hashes != deployed{- throw StepFailure(step: "Check installed files",- detail: "Steam's installed dylib does not match this account's build record. Finish or repair its installation with the NotProton app that last installed it.")+ throw StepFailure(step: L10n.tr("Check installed files"),+ detail: L10n.tr("Steam's installed dylib does not match this account's build record. Finish or repair its installation with the NotProton app that last installed it."))}return bundled.isNewer(than: installed) ? .update(differences) : .repair(differences)}diff --git a/app/Sources/NotProtonApp/Model/InstallPayload.swift b/app/Sources/NotProtonApp/Model/InstallPayload.swiftindex 4c58b52..e025c8b 100644--- a/app/Sources/NotProtonApp/Model/InstallPayload.swift+++ b/app/Sources/NotProtonApp/Model/InstallPayload.swift@@ -3,7 +3,7 @@import Foundationenum InstallPayload {- static let step = "Find NotProton's components"+ static let step = L10n.tr("Find NotProton's components")struct Located: Sendable {let dylib: URL@@ -22,7 +22,7 @@ enum InstallPayload {guard let url = bundle.url(forResource: "payload", withExtension: nil) else {throw StepFailure(step: step,- detail: "This build of NotProton carries no components at all."+ detail: L10n.tr("This build of NotProton carries no components at all."))}return url@@ -74,8 +74,7 @@ enum InstallPayload {guard missing.isEmpty, let builtAt, builtAt > 0 else {throw StepFailure(step: step,- detail: "These components are missing: \(missing.joined(separator: ", ")). "- + "Run make app-payload and build the app again."+ detail: L10n.tr("These components are missing: \(missing.joined(separator: ", ")). Run make app-payload and build the app again."))}diff --git a/app/Sources/NotProtonApp/Model/NtdllPatcher.swift b/app/Sources/NotProtonApp/Model/NtdllPatcher.swiftindex f9477b4..9c54c6e 100644--- a/app/Sources/NotProtonApp/Model/NtdllPatcher.swift+++ b/app/Sources/NotProtonApp/Model/NtdllPatcher.swift@@ -40,7 +40,7 @@ struct NtdllPatch: Sendable {enum NtdllPatcher {- static let step = "Patch ntdll"+ static let step = L10n.tr("Patch ntdll")private static let magicPE32Plus: UInt16 = 0x20b// SECTION_NAME, SECTION_SIZE and SECTION_FLAGS in resolve.py. The patched file is checked@@ -277,8 +277,7 @@ enum NtdllPatcher {guard intoCave >= 0 else {throw StepFailure(step: step,- detail: "The \(patch.arch.rawValue) detour goes to \(hex(patch.payloadRVA)), below its "- + "cave at \(hex(patch.caveRVA)), so writing it would land in live code."+ detail: L10n.tr("The \(patch.arch.rawValue) detour goes to \(hex(patch.payloadRVA)), below its cave at \(hex(patch.caveRVA)), so writing it would land in live code."))}@@ -286,31 +285,28 @@ enum NtdllPatcher {if payload.count > room {throw StepFailure(step: step,- detail: "The \(patch.arch.rawValue) detour is \(payload.count) bytes and the cave holds "- + "\(room), so writing it would overrun into live code."+ detail: L10n.tr("The \(patch.arch.rawValue) detour is \(payload.count) bytes and the cave holds \(room), so writing it would overrun into live code."))}- try requireRange(caveOffset, patch.caveSize, in: bytes, describing: "The cave")+ try requireRange(caveOffset, patch.caveSize, in: bytes, describing: L10n.tr("The cave"))guard bytes[caveOffset ..< caveOffset + patch.caveSize].allSatisfy({ $0 == patch.cavePad }) else {throw StepFailure(step: step,- detail: "The \(patch.arch.rawValue) cave at \(hex(patch.caveRVA)) is not empty. "- + "This ntdll is either already patched or not the build its hash claimed."+ detail: L10n.tr("The \(patch.arch.rawValue) cave at \(hex(patch.caveRVA)) is not empty. This ntdll is either already patched or not the build its hash claimed."))}// check filesvar branches: [(offset: Int, code: [UInt8])] = []for hook in patch.hooks {- let offset = try fileOffset(of: hook.rva, in: bytes, describing: "hook site", patch: patch)- try requireRange(offset, hook.stolen.count, in: bytes, describing: "The hook site")+ let offset = try fileOffset(of: hook.rva, in: bytes, describing: L10n.tr("hook site"), patch: patch)+ try requireRange(offset, hook.stolen.count, in: bytes, describing: L10n.tr("The hook site"))let present = Array(bytes[offset ..< offset + hook.stolen.count])guard present == hook.stolen else {throw StepFailure(step: step,- detail: "The \(patch.arch.rawValue) hook site at \(hex(hook.rva)) holds \(hex(present)) "- + "instead of \(hex(hook.stolen)), so the offsets do not belong to this ntdll."+ detail: L10n.tr("The \(patch.arch.rawValue) hook site at \(hex(hook.rva)) holds \(hex(present)) instead of \(hex(hook.stolen)), so the offsets do not belong to this ntdll."))}branches.append(@@ -335,7 +331,7 @@ enum NtdllPatcher {private static func branchLink(from hookRVA: Int, to payloadRVA: Int, filling width: Int) throws -> [UInt8] {guard width == 4 else {throw StepFailure(- step: step, detail: "A hook site of \(width) bytes cannot hold a branch and link."+ step: step, detail: L10n.tr("A hook site of \(width) bytes cannot hold a branch and link."))}@@ -343,8 +339,7 @@ enum NtdllPatcher {guard delta % 4 == 0, (-0x800_0000 ..< 0x800_0000).contains(delta) else {throw StepFailure(step: step,- detail: "The detour is \(delta) bytes from the hook site, which a branch and link "- + "cannot reach."+ detail: L10n.tr("The detour is \(delta) bytes from the hook site, which a branch and link cannot reach."))}@@ -356,7 +351,7 @@ enum NtdllPatcher {private static func relativeJump(from hookRVA: Int, to caveRVA: Int, filling width: Int) throws -> [UInt8] {guard width >= 5 else {throw StepFailure(- step: step, detail: "A hook site of \(width) bytes cannot hold a relative jump."+ step: step, detail: L10n.tr("A hook site of \(width) bytes cannot hold a relative jump."))}@@ -364,7 +359,7 @@ enum NtdllPatcher {guard let displacement = Int32(exactly: delta) else {throw StepFailure(step: step,- detail: "The cave is \(delta) bytes from the hook site, which a relative jump cannot reach."+ detail: L10n.tr("The cave is \(delta) bytes from the hook site, which a relative jump cannot reach."))}@@ -388,20 +383,19 @@ enum NtdllPatcher {guard patch.caveSize == sectionSize, imageSize == patch.caveRVA else {throw StepFailure(step: step,- detail: "The \(patch.arch.rawValue) ntdll image ends at \(hex(imageSize)), and the detour "- + "section was pinned at \(hex(patch.caveRVA))."+ detail: L10n.tr("The \(patch.arch.rawValue) ntdll image ends at \(hex(imageSize)), and the detour section was pinned at \(hex(patch.caveRVA))."))}guard header + 40 <= headersSize, bytes[header ..< header + 40].allSatisfy({ $0 == 0 }) else {throw StepFailure(step: step,- detail: "The \(patch.arch.rawValue) ntdll has no free section header slot for the detour."+ detail: L10n.tr("The \(patch.arch.rawValue) ntdll has no free section header slot for the detour."))}guard fileAlignment > 0, fileAlignment & (fileAlignment - 1) == 0 else {throw StepFailure(step: step,- detail: "The \(patch.arch.rawValue) ntdll file alignment \(hex(fileAlignment)) is not a power of two."+ detail: L10n.tr("The \(patch.arch.rawValue) ntdll file alignment \(hex(fileAlignment)) is not a power of two."))}@@ -432,7 +426,7 @@ enum NtdllPatcher {let pe = Int(try u32(bytes, 0x3c))guard try u32(bytes, pe) == 0x0000_4550 else {throw StepFailure(- step: step, detail: "The \(patch.arch.rawValue) ntdll has no PE header where its DOS stub points."+ step: step, detail: L10n.tr("The \(patch.arch.rawValue) ntdll has no PE header where its DOS stub points."))}@@ -440,8 +434,7 @@ enum NtdllPatcher {guard machine == patch.machine else {throw StepFailure(step: step,- detail: "The \(patch.arch.rawValue) ntdll is machine \(hex(Int(machine))), "- + "expected \(hex(Int(patch.machine)))."+ detail: L10n.tr("The \(patch.arch.rawValue) ntdll is machine \(hex(Int(machine))), expected \(hex(Int(patch.machine)))."))}@@ -449,8 +442,7 @@ enum NtdllPatcher {guard magic == patch.magic else {throw StepFailure(step: step,- detail: "The \(patch.arch.rawValue) ntdll optional header is \(hex(Int(magic))), "- + "expected \(hex(Int(patch.magic)))."+ detail: L10n.tr("The \(patch.arch.rawValue) ntdll optional header is \(hex(Int(magic))), expected \(hex(Int(patch.magic)))."))}@@ -460,8 +452,7 @@ enum NtdllPatcher {guard imageBase == patch.imageBase else {throw StepFailure(step: step,- detail: "The \(patch.arch.rawValue) ntdll is based at \(hex(imageBase)), "- + "and the detour was linked against \(hex(patch.imageBase))."+ detail: L10n.tr("The \(patch.arch.rawValue) ntdll is based at \(hex(imageBase)), and the detour was linked against \(hex(patch.imageBase))."))}}@@ -487,14 +478,13 @@ enum NtdllPatcher {guard rva >= virtualAddress, rva < virtualAddress + span else { continue }let offset = rawOffset + (rva - virtualAddress)- try requireRange(offset, 1, in: bytes, describing: "The \(what)")+ try requireRange(offset, 1, in: bytes, describing: L10n.tr("The \(what)"))return offset}throw StepFailure(step: step,- detail: "RVA \(hex(rva)) falls in no mapped section of the \(patch.arch.rawValue) ntdll, "- + "so the \(what) cannot be located."+ detail: L10n.tr("RVA \(hex(rva)) falls in no mapped section of the \(patch.arch.rawValue) ntdll, so the \(what) cannot be located."))}@@ -504,26 +494,25 @@ enum NtdllPatcher {guard offset >= 0, length >= 0, offset <= bytes.count - length else {throw StepFailure(step: step,- detail: "\(what) at \(hex(offset)) spans \(length) bytes, past the end of a "- + "\(bytes.count) byte file."+ detail: L10n.tr("\(what) at \(hex(offset)) spans \(length) bytes, past the end of a \(bytes.count) byte file."))}}private static func u16(_ bytes: [UInt8], _ offset: Int) throws -> UInt16 {- try requireRange(offset, 2, in: bytes, describing: "A header field")+ try requireRange(offset, 2, in: bytes, describing: L10n.tr("A header field"))return UInt16(bytes[offset]) | UInt16(bytes[offset + 1]) << 8}private static func u32(_ bytes: [UInt8], _ offset: Int) throws -> UInt32 {- try requireRange(offset, 4, in: bytes, describing: "A header field")+ try requireRange(offset, 4, in: bytes, describing: L10n.tr("A header field"))var value: UInt32 = 0for index in (0 ..< 4).reversed() { value = value << 8 | UInt32(bytes[offset + index]) }return value}private static func u64(_ bytes: [UInt8], _ offset: Int) throws -> UInt64 {- try requireRange(offset, 8, in: bytes, describing: "A header field")+ try requireRange(offset, 8, in: bytes, describing: L10n.tr("A header field"))var value: UInt64 = 0for index in (0 ..< 8).reversed() { value = value << 8 | UInt64(bytes[offset + index]) }return value@@ -541,7 +530,7 @@ enum NtdllPatcher {guard let url = Bundle.module.url(forResource: patch.payloadResource, withExtension: "bin") else {throw StepFailure(step: step,- detail: "\(patch.payloadResource).bin is missing from the app's resources."+ detail: L10n.tr("\(patch.payloadResource).bin is missing from the app's resources."))}@@ -551,7 +540,7 @@ enum NtdllPatcher {} catch {throw StepFailure(step: step,- detail: "\(patch.payloadResource).bin could not be read. \(error.localizedDescription)"+ detail: L10n.tr("\(patch.payloadResource).bin could not be read. \(error.localizedDescription)"))}@@ -559,8 +548,7 @@ enum NtdllPatcher {guard hash == patch.payloadSHA256 else {throw StepFailure(step: step,- detail: "\(patch.payloadResource).bin hashes \(hash.prefix(16)) and should hash "- + "\(patch.payloadSHA256.prefix(16)), so the shipped detour is not the one that was built."+ detail: L10n.tr("\(patch.payloadResource).bin hashes \(hash.prefix(16)) and should hash \(patch.payloadSHA256.prefix(16)), so the shipped detour is not the one that was built."))}return data@@ -579,21 +567,19 @@ enum NtdllPatcher {else {throw StepFailure(step: step,- detail: "Build \(build.bundleVersion) records no \(patch.arch.rawValue) ntdll hashes."+ detail: L10n.tr("Build \(build.bundleVersion) records no \(patch.arch.rawValue) ntdll hashes."))}guard let inputHash = Digest.sha256IfPresent(source) else {throw StepFailure(- step: step, detail: "There is no ntdll to patch at \(source.path(percentEncoded: false))."+ step: step, detail: L10n.tr("There is no ntdll to patch at \(source.path(percentEncoded: false))."))}guard inputHash == expectedInput else {throw StepFailure(step: step,- detail: "The \(patch.arch.rawValue) ntdll at \(source.path(percentEncoded: false)) hashes "- + "\(inputHash.prefix(16)) and build \(build.bundleVersion) expects "- + "\(expectedInput.prefix(16)). It is already patched, or from another CrossOver build."+ detail: L10n.tr("The \(patch.arch.rawValue) ntdll at \(source.path(percentEncoded: false)) hashes \(inputHash.prefix(16)) and build \(build.bundleVersion) expects \(expectedInput.prefix(16)). It is already patched, or from another CrossOver build."))}@@ -603,7 +589,7 @@ enum NtdllPatcher {} catch {throw StepFailure(step: step,- detail: "\(source.path(percentEncoded: false)) could not be read. \(error.localizedDescription)"+ detail: L10n.tr("\(source.path(percentEncoded: false)) could not be read. \(error.localizedDescription)"))}@@ -613,8 +599,7 @@ enum NtdllPatcher {guard outputHash == expectedOutput else {throw StepFailure(step: step,- detail: "The patched \(patch.arch.rawValue) ntdll hashes \(outputHash.prefix(16)) and build "- + "\(build.bundleVersion) expects \(expectedOutput.prefix(16)). Nothing was written."+ detail: L10n.tr("The patched \(patch.arch.rawValue) ntdll hashes \(outputHash.prefix(16)) and build \(build.bundleVersion) expects \(expectedOutput.prefix(16)). Nothing was written."))}diff --git a/app/Sources/NotProtonApp/Model/PayloadManifest.swift b/app/Sources/NotProtonApp/Model/PayloadManifest.swiftindex 1492b3c..3d0066e 100644--- a/app/Sources/NotProtonApp/Model/PayloadManifest.swift+++ b/app/Sources/NotProtonApp/Model/PayloadManifest.swift@@ -31,8 +31,8 @@ struct PayloadManifest: Sendable {forResource: resourceName, withExtension: resourceExtension) else {throw StepFailure(- step: "Read the component list",- detail: "\(resourceName).\(resourceExtension) is missing from the app's resources."+ step: L10n.tr("Read the component list"),+ detail: L10n.tr("\(resourceName).\(resourceExtension) is missing from the app's resources."))}return try load(from: url)@@ -44,8 +44,8 @@ struct PayloadManifest: Sendable {data = try Data(contentsOf: url)} catch {throw StepFailure(- step: "Read the component list",- detail: "\(url.path(percentEncoded: false)) could not be read. \(error.localizedDescription)"+ step: L10n.tr("Read the component list"),+ detail: L10n.tr("\(url.path(percentEncoded: false)) could not be read. \(error.localizedDescription)"))}return try parse(String(decoding: data, as: UTF8.self))@@ -63,23 +63,22 @@ struct PayloadManifest: Sendable {let number = index + 1guard fields.count == 2 else {throw StepFailure(- step: "Read the component list",- detail: "Line \(number) is not an origin and a path: \(line)"+ step: L10n.tr("Read the component list"),+ detail: L10n.tr("Line \(number) is not an origin and a path: \(line)"))}guard let origin = PayloadOrigin(rawValue: String(fields[0])) else {throw StepFailure(- step: "Read the component list",- detail: "Line \(number) has an unknown origin \(fields[0]). "- + "Known: \(PayloadOrigin.allCases.map(\.rawValue).joined(separator: ", "))."+ step: L10n.tr("Read the component list"),+ detail: L10n.tr("Line \(number) has an unknown origin \(fields[0]). Known: \(PayloadOrigin.allCases.map(\.rawValue).joined(separator: ", "))."))}let path = String(fields[1])guard seen.insert(path).inserted else {throw StepFailure(- step: "Read the component list",- detail: "Line \(number) repeats \(path)."+ step: L10n.tr("Read the component list"),+ detail: L10n.tr("Line \(number) repeats \(path)."))}@@ -87,7 +86,7 @@ struct PayloadManifest: Sendable {}guard !entries.isEmpty else {- throw StepFailure(step: "Read the component list", detail: "The component list has no entries.")+ throw StepFailure(step: L10n.tr("Read the component list"), detail: L10n.tr("The component list has no entries."))}return PayloadManifest(entries: entries)diff --git a/app/Sources/NotProtonApp/Model/PrefixPrompt.swift b/app/Sources/NotProtonApp/Model/PrefixPrompt.swiftindex 88ba45b..6e8cfea 100644--- a/app/Sources/NotProtonApp/Model/PrefixPrompt.swift+++ b/app/Sources/NotProtonApp/Model/PrefixPrompt.swift@@ -7,105 +7,104 @@ enum PrefixPrompt {static func deleteTitle(_ targets: [WinePrefix]) -> String {switch targets.count {- case 0: "Delete prefix?"- case 1: "Delete the prefix for \(targets[0].title)?"- default: "Delete \(targets.count) prefixes?"+ case 0: L10n.tr("Delete prefix?")+ case 1: L10n.tr("Delete the prefix for \(targets[0].title)?")+ default: L10n.tr("Delete \(targets.count) prefixes?")}}static func deleteButton(_ targets: [WinePrefix]) -> String {- targets.count > 1 ? "Delete \(targets.count) Prefixes" : "Delete Prefix"+ targets.count > 1 ? L10n.tr("Delete \(targets.count) Prefixes") : L10n.tr("Delete Prefix")}static func deleteMessage(_ targets: [WinePrefix]) -> String {guard targets.count > 1 else {return sentences([- "This will DELETE the game's prefix.",- "The game SAVE DATA inside the prefix WILL BE LOST.",- "Are you sure you want to do this?",+ L10n.tr("This will DELETE the game's prefix."),+ L10n.tr("The game SAVE DATA inside the prefix WILL BE LOST."),+ L10n.tr("Are you sure you want to do this?"),])}return sentences([- "This will DELETE the prefixes for \(targets.count) games.",- "The game SAVE DATA inside them WILL BE LOST.",- "Are you sure you want to do this?",+ L10n.tr("This will DELETE the prefixes for \(targets.count) games."),+ L10n.tr("The game SAVE DATA inside them WILL BE LOST."),+ L10n.tr("Are you sure you want to do this?"),])}static func rebuildTitle(_ targets: [WinePrefix], for tool: InstalledTool? = nil) -> String {- let with = tool.map { " with \($0.display)" } ?? ""+ let with = tool.map { L10n.tr(" with \($0.display)") } ?? ""switch targets.count {- case 0: return "Rebuild prefix\(with)?"- case 1: return "Rebuild the prefix for \(targets[0].title)\(with)?"- default: return "Rebuild \(targets.count) prefixes\(with)?"+ case 0: return L10n.tr("Rebuild prefix\(with)?")+ case 1: return L10n.tr("Rebuild the prefix for \(targets[0].title)\(with)?")+ default: return L10n.tr("Rebuild \(targets.count) prefixes\(with)?")}}static func rebuildButton(_ targets: [WinePrefix]) -> String {- targets.count > 1 ? "Rebuild \(targets.count) Prefixes" : "Rebuild Prefix"+ targets.count > 1 ? L10n.tr("Rebuild \(targets.count) Prefixes") : L10n.tr("Rebuild Prefix")}static func rebuildWithBackupButton(_ targets: [WinePrefix]) -> String {targets.count > 1- ? "Back Up and Rebuild \(targets.count) Prefixes" : "Back Up and Rebuild"+ ? L10n.tr("Back Up and Rebuild \(targets.count) Prefixes") : L10n.tr("Back Up and Rebuild")}static func rebuildWithoutBackupButton(_ targets: [WinePrefix]) -> String {targets.count > 1- ? "Rebuild \(targets.count) Prefixes Without Backing Up"- : "Rebuild Without Backing Up"+ ? L10n.tr("Rebuild \(targets.count) Prefixes Without Backing Up")+ : L10n.tr("Rebuild Without Backing Up")}static func backUpTitle(_ targets: [WinePrefix]) -> String {switch targets.count {- case 0: "Back up prefix?"- case 1: "Back up the prefix for \(targets[0].title)?"- default: "Back up \(targets.count) prefixes?"+ case 0: L10n.tr("Back up prefix?")+ case 1: L10n.tr("Back up the prefix for \(targets[0].title)?")+ default: L10n.tr("Back up \(targets.count) prefixes?")}}static func backUpButton(_ targets: [WinePrefix]) -> String {- targets.count > 1 ? "Back Up \(targets.count) Prefixes" : "Back Up Prefix"+ targets.count > 1 ? L10n.tr("Back Up \(targets.count) Prefixes") : L10n.tr("Back Up Prefix")}static func backUpMessage(_ targets: [WinePrefix] = []) -> String {targets.count > 1- ? "Are you sure you want to back up these prefixes?"- : "Are you sure you want to back up this prefix?"+ ? L10n.tr("Are you sure you want to back up these prefixes?")+ : L10n.tr("Are you sure you want to back up this prefix?")}static func rebuildMessage() -> String {sentences([- "This tool is intended to repair a prefix after switching between Rosetta/FEX CrossOver.",- "It will replace the DLLs used by CrossOver with ones that match your compatibility tool.",- "This can also fix issues where a game previously started/worked and does not work now, "- + "even if you did not switch CrossOver types.",- "You will not lose saves by using this tool.",+ L10n.tr("This tool is intended to repair a prefix after switching between Rosetta/FEX CrossOver."),+ L10n.tr("It will replace the DLLs used by CrossOver with ones that match your compatibility tool."),+ L10n.tr("This can also fix issues where a game previously started/worked and does not work now, even if you did not switch CrossOver types."),+ L10n.tr("You will not lose saves by using this tool."),])}static func deleteBackupsTitle(_ targets: [PrefixBackup]) -> String {switch targets.count {- case 0: "Delete backup?"- case 1: "Delete the backup for \(targets[0].title)?"- default: "Delete \(targets.count) backups?"+ case 0: L10n.tr("Delete backup?")+ case 1: L10n.tr("Delete the backup for \(targets[0].title)?")+ default: L10n.tr("Delete \(targets.count) backups?")}}static func deleteBackupsButton(_ targets: [PrefixBackup]) -> String {- targets.count > 1 ? "Delete \(targets.count) Backups" : "Delete Backup"+ targets.count > 1 ? L10n.tr("Delete \(targets.count) Backups") : L10n.tr("Delete Backup")}static func deleteBackupsMessage(_ targets: [PrefixBackup] = []) -> String {guard targets.count > 1 else {return sentences([- "Are you sure you want to delete this backup?",- "Any data in it will be lost.",+ L10n.tr("Are you sure you want to delete this backup?"),+ L10n.tr("Any data in it will be lost."),])}return sentences([- "Are you sure you want to delete these \(targets.count) backups?",- "Any data in them will be lost.",+ L10n.tr("Are you sure you want to delete these \(targets.count) backups?"),+ L10n.tr("Any data in them will be lost."),])}diff --git a/app/Sources/NotProtonApp/Model/PrefixRebuild.swift b/app/Sources/NotProtonApp/Model/PrefixRebuild.swiftindex 6dba9a2..97f6fda 100644--- a/app/Sources/NotProtonApp/Model/PrefixRebuild.swift+++ b/app/Sources/NotProtonApp/Model/PrefixRebuild.swift@@ -29,8 +29,8 @@ extension PrefixTools {) throws -> URL? {guard !PrefixStore.isInUse(prefix) else {throw StepFailure(- step: "Recreate prefix",- detail: "\(prefix.title) is running. Quit the game first."+ step: L10n.tr("Recreate prefix"),+ detail: L10n.tr("\(prefix.title) is running. Quit the game first."))}@@ -39,19 +39,16 @@ extension PrefixTools {atPath: prefix.pfx.appending(path: "user.reg").path(percentEncoded: false)){throw StepFailure(- step: "Recreate prefix",- detail: "\(held.path(percentEncoded: false)) is left from a rebuild that did not "- + "finish and may hold the only copy of the saves. Move it somewhere safe, "- + "then try again."+ step: L10n.tr("Recreate prefix"),+ detail: L10n.tr("\(held.path(percentEncoded: false)) is left from a rebuild that did not finish and may hold the only copy of the saves. Move it somewhere safe, then try again."))}let loader = loader(runner: runner, flavor: flavor)guard FileManager.default.isExecutableFile(atPath: loader.path(percentEncoded: false)) else {throw StepFailure(- step: "Recreate prefix",- detail: "No compatibility tool at \(loader.path(percentEncoded: false)). "- + "Use Set Up Compatibility Tool first."+ step: L10n.tr("Recreate prefix"),+ detail: L10n.tr("No compatibility tool at \(loader.path(percentEncoded: false)). Use Set Up Compatibility Tool first."))}@@ -75,10 +72,8 @@ extension PrefixTools {if let first = carry.lost.first {AppLog.note("rebuild \(prefix.appID) refused, did not carry: \(carry.lost.joined(separator: ", "))")throw StepFailure(- step: "Recreate prefix",- detail: "\(first) could not be copied out of the prefix. The prefix has been "- + "left as it was and nothing has been lost. Check free space and "- + "permissions, then try again."+ step: L10n.tr("Recreate prefix"),+ detail: L10n.tr("\(first) could not be copied out of the prefix. The prefix has been left as it was and nothing has been lost. Check free space and permissions, then try again."))}@@ -105,16 +100,16 @@ extension PrefixTools {static func backUp(_ prefix: WinePrefix, now: Date = .now) throws -> URL {guard !PrefixStore.isInUse(prefix) else {throw StepFailure(- step: "Back up prefix",- detail: "\(prefix.title) is running. Quit the game first."+ step: L10n.tr("Back up prefix"),+ detail: L10n.tr("\(prefix.title) is running. Quit the game first."))}let fm = FileManager.defaultguard fm.fileExists(atPath: prefix.pfx.path(percentEncoded: false)) else {throw StepFailure(- step: "Back up prefix",- detail: "\(prefix.title) does not appear to have a prefix to back up."+ step: L10n.tr("Back up prefix"),+ detail: L10n.tr("\(prefix.title) does not appear to have a prefix to back up."))}diff --git a/app/Sources/NotProtonApp/Model/PrefixStore.swift b/app/Sources/NotProtonApp/Model/PrefixStore.swiftindex e93424f..7ee3fd0 100644--- a/app/Sources/NotProtonApp/Model/PrefixStore.swift+++ b/app/Sources/NotProtonApp/Model/PrefixStore.swift@@ -42,7 +42,7 @@ struct WinePrefix: Sendable, Hashable, Identifiable {var id: String { "\(library.root.path(percentEncoded: false))#\(appID)" }- var title: String { name ?? "App \(appID)" }+ var title: String { name ?? L10n.tr("App \(appID)") }}struct PrefixUsage: Sendable {diff --git a/app/Sources/NotProtonApp/Model/PrefixTools.swift b/app/Sources/NotProtonApp/Model/PrefixTools.swiftindex 5d15e5c..45785ec 100644--- a/app/Sources/NotProtonApp/Model/PrefixTools.swift+++ b/app/Sources/NotProtonApp/Model/PrefixTools.swift@@ -12,9 +12,9 @@ enum WineTool: String, CaseIterable, Sendable {var label: String {switch self {- case .winecfg: "Wine Configuration"- case .regedit: "Registry Editor"- case .taskmgr: "Task Manager"+ case .winecfg: L10n.tr("Wine Configuration")+ case .regedit: L10n.tr("Registry Editor")+ case .taskmgr: L10n.tr("Task Manager")}}}@@ -55,12 +55,12 @@ enum PrefixTools {return PrefixBuildRecord(build: build, display: nil)}}- return PrefixBuildRecord(build: "", display: "another version of CrossOver")+ return PrefixBuildRecord(build: "", display: L10n.tr("another version of CrossOver"))}static func writeBuildRecord(_ tool: InstalledTool, for prefix: WinePrefix) throws {let file = prefix.root.appending(path: buildRecordName)- try atomicReplace(file, with: Data("\(tool.build)\n\(tool.display)\n".utf8), step: "Record prefix build")+ try atomicReplace(file, with: Data("\(tool.build)\n\(tool.display)\n".utf8), step: L10n.tr("Record prefix build"))}static func tool(@@ -88,11 +88,10 @@ enum PrefixTools {if let record = lastBuild(of: prefix) {throw StepFailure(step: step,- detail: "\(prefix.title) was last run by \(record.display ?? "build \(record.build)"), "- + "which is no longer set up. Rebuild the prefix first."+ detail: L10n.tr("\(prefix.title) was last run by \(record.display ?? "build \(record.build)"), which is no longer set up. Rebuild the prefix first."))}- throw StepFailure(step: step, detail: "No compatibility tool is set up.")+ throw StepFailure(step: step, detail: L10n.tr("No compatibility tool is set up."))}static func syncBackend(prefix: WinePrefix) -> String {@@ -160,21 +159,20 @@ enum PrefixTools {guard FileManager.default.isExecutableFile(atPath: loader.path(percentEncoded: false)) else {throw StepFailure(step: step,- detail: "No compatibility tool at \(loader.path(percentEncoded: false)). "- + "Use Set Up Compatibility Tool first."+ detail: L10n.tr("No compatibility tool at \(loader.path(percentEncoded: false)). Use Set Up Compatibility Tool first."))}guard FileManager.default.fileExists(atPath: prefix.pfx.path(percentEncoded: false)) else {throw StepFailure(step: step,- detail: "\(prefix.title) has no prefix at \(prefix.pfx.path(percentEncoded: false))."+ detail: L10n.tr("\(prefix.title) has no prefix at \(prefix.pfx.path(percentEncoded: false))."))}return loader}static func launch(_ tool: WineTool, in prefix: WinePrefix) throws {- let chosen = try resolvedTool(step: "Open \(tool.label)", for: prefix)+ let chosen = try resolvedTool(step: L10n.tr("Open \(tool.label)"), for: prefix)try launch(tool, in: prefix, runner: SupportPaths.clonedRoot(forBuild: chosen.build),flavor: chosen.tool.flavor@@ -185,7 +183,7 @@ enum PrefixTools {_ tool: WineTool, in prefix: WinePrefix, runner: URL, flavor: CompatTool.Flavor = .fex) throws {let loader = try readyLoader(- step: "Open \(tool.label)", prefix: prefix, runner: runner, flavor: flavor+ step: L10n.tr("Open \(tool.label)"), prefix: prefix, runner: runner, flavor: flavor)try Shell.detach(loader.path(percentEncoded: false),@@ -195,7 +193,7 @@ enum PrefixTools {}static func run(_ executable: URL, in prefix: WinePrefix) throws {- let chosen = try resolvedTool(step: "Run \(executable.lastPathComponent)", for: prefix)+ let chosen = try resolvedTool(step: L10n.tr("Run \(executable.lastPathComponent)"), for: prefix)try run(executable, in: prefix, runner: SupportPaths.clonedRoot(forBuild: chosen.build),flavor: chosen.tool.flavor@@ -208,16 +206,15 @@ enum PrefixTools {runner: URL,flavor: CompatTool.Flavor = .fex) throws {- let step = "Run \(executable.lastPathComponent)"+ let step = L10n.tr("Run \(executable.lastPathComponent)")let loader = try readyLoader(step: step, prefix: prefix, runner: runner, flavor: flavor)guard FileManager.default.fileExists(atPath: executable.path(percentEncoded: false)) else {- throw StepFailure(step: step, detail: "No file at \(executable.path(percentEncoded: false)).")+ throw StepFailure(step: step, detail: L10n.tr("No file at \(executable.path(percentEncoded: false))."))}guard let arguments = arguments(for: executable) else {throw StepFailure(step: step,- detail: "\(executable.lastPathComponent) is not a Windows program. "- + "Pick an exe, msi, bat or cmd file."+ detail: L10n.tr("\(executable.lastPathComponent) is not a Windows program. Pick an exe, msi, bat or cmd file."))}@@ -265,8 +262,8 @@ enum PrefixTools {static func delete(_ prefix: WinePrefix) throws {guard !PrefixStore.isInUse(prefix) else {throw StepFailure(- step: "Delete prefix",- detail: "\(prefix.title) is running. Quit the game first."+ step: L10n.tr("Delete prefix"),+ detail: L10n.tr("\(prefix.title) is running. Quit the game first."))}try WriteRefused.catching(prefix.root) {diff --git a/app/Sources/NotProtonApp/Model/RunnerInstaller.swift b/app/Sources/NotProtonApp/Model/RunnerInstaller.swiftindex ca13e80..9789027 100644--- a/app/Sources/NotProtonApp/Model/RunnerInstaller.swift+++ b/app/Sources/NotProtonApp/Model/RunnerInstaller.swift@@ -5,7 +5,7 @@ import Foundationenum RunnerInstaller {- static let step = "Clone CrossOver"+ static let step = L10n.tr("Clone CrossOver")static func clone(from install: CrossOverInstall,@@ -15,7 +15,7 @@ enum RunnerInstaller {guard case .supported(let build) = install.support else {throw StepFailure(step: step,- detail: "\(install.name) is not a supported build. Supported: \(SupportedRunners.versionList)."+ detail: L10n.tr("\(install.name) is not a supported build. Supported: \(SupportedRunners.versionList)."))}@@ -42,7 +42,7 @@ enum RunnerInstaller {return build}- static let removeStep = "Remove build"+ static let removeStep = L10n.tr("Remove build")@discardableResultstatic func removeClone(@@ -58,12 +58,12 @@ enum RunnerInstaller {let path = target.path(percentEncoded: false)guard FileManager.default.fileExists(atPath: path) else {- throw StepFailure(step: removeStep, detail: "Build \(build) is not set up.")+ throw StepFailure(step: removeStep, detail: L10n.tr("Build \(build) is not set up."))}guard !running(target) else {throw StepFailure(step: removeStep,- detail: "A game or Wine tool is still running on build \(build). Quit it first."+ detail: L10n.tr("A game or Wine tool is still running on build \(build). Quit it first."))}@@ -158,7 +158,7 @@ enum RunnerInstaller {} catch {failures.append(StepFailure(step: removeStep,- detail: "Could not remove prefix template \(folder.appending(path: name).path(percentEncoded: false)): \(error.localizedDescription) Refresh to retry."+ detail: L10n.tr("Could not remove prefix template \(folder.appending(path: name).path(percentEncoded: false)): \(error.localizedDescription) Refresh to retry.")))}}@@ -168,7 +168,7 @@ enum RunnerInstaller {} catch {failures.append(StepFailure(step: removeStep,- detail: "Could not clean prefix templates at \(folder.path(percentEncoded: false)): \(error.localizedDescription) Refresh to retry."+ detail: L10n.tr("Could not clean prefix templates at \(folder.path(percentEncoded: false)): \(error.localizedDescription) Refresh to retry.")))}}@@ -258,7 +258,7 @@ enum RunnerInstaller {guard copied.status == 0 else {throw StepFailure(step: step,- detail: "Copying \(source) failed. \(copied.stderr.trimmingCharacters(in: .whitespacesAndNewlines))"+ detail: L10n.tr("Copying \(source) failed. \(copied.stderr.trimmingCharacters(in: .whitespacesAndNewlines))"))}scrubDownloadMarkers(at: landing)@@ -273,13 +273,12 @@ enum RunnerInstaller {static func verifyClone(build: RunnerBuild, root: URL) throws {let loader = Clean.copy(of: CrossOverSource.unixLoader(inRoot: root))guard let hash = Digest.sha256IfPresent(loader) else {- throw StepFailure(step: step, detail: "The clone has no Wine loader at \(loader.lastPathComponent).")+ throw StepFailure(step: step, detail: L10n.tr("The clone has no Wine loader at \(loader.lastPathComponent)."))}guard hash == build.loaderSHA256 else {throw StepFailure(step: step,- detail: "The cloned Wine loader at \(loader.lastPathComponent) does not match build "- + "\(build.id). Expected \(build.loaderSHA256.prefix(16)), found \(hash.prefix(16))."+ detail: L10n.tr("The cloned Wine loader at \(loader.lastPathComponent) does not match build \(build.id). Expected \(build.loaderSHA256.prefix(16)), found \(hash.prefix(16))."))}diff --git a/app/Sources/NotProtonApp/Model/RunnerPatcher.swift b/app/Sources/NotProtonApp/Model/RunnerPatcher.swiftindex cd3c8c0..383d570 100644--- a/app/Sources/NotProtonApp/Model/RunnerPatcher.swift+++ b/app/Sources/NotProtonApp/Model/RunnerPatcher.swift@@ -4,7 +4,7 @@ import Foundationenum RunnerPatcher {- static let step = "Patch the compatibility tool"+ static let step = L10n.tr("Patch the compatibility tool")private static let dyldEntitlement = "com.apple.security.cs.allow-dyld-environment-variables"@@ -55,25 +55,25 @@ enum RunnerPatcher {guard let expected = build.patchedNtdll[arch] else { continue }let live = root.appending(path: "lib/wine/\(arch.rawValue)/ntdll.dll")guard let actual = Digest.sha256IfPresent(live) else {- wrong.append("\(arch.rawValue)/ntdll.dll is missing")+ wrong.append(L10n.tr("\(arch.rawValue)/ntdll.dll is missing"))continue}if actual != expected {- wrong.append("\(arch.rawValue)/ntdll.dll is not the patched copy")+ wrong.append(L10n.tr("\(arch.rawValue)/ntdll.dll is not the patched copy"))}}for builtin in builtins(in: root) {let installed = Digest.sha256IfPresent(root.appending(path: "lib/wine/\(builtin.arch)/\(builtin.name)"))guard let installed else {- wrong.append("\(builtin.arch)/\(builtin.name) is missing")+ wrong.append(L10n.tr("\(builtin.arch)/\(builtin.name) is missing"))continue}let staged = Digest.sha256IfPresent(bridge.appending(path: "\(builtin.arch)/\(builtin.name)"))if let staged, staged != installed {- wrong.append("\(builtin.arch)/\(builtin.name) is out of date")+ wrong.append(L10n.tr("\(builtin.arch)/\(builtin.name) is out of date"))}}@@ -81,10 +81,10 @@ enum RunnerPatcher {let granted = entitlements(of: loader)if granted?.contains(restrictedEntitlement) == true {if !signatureIsValid(signingTarget(for: loader)) {- wrong.append("\(name(of: loader)) has a broken signature")+ wrong.append(L10n.tr("\(name(of: loader)) has a broken signature"))}} else if granted?.contains(dyldEntitlement) != true {- wrong.append("\(name(of: loader)) is missing the dyld entitlement")+ wrong.append(L10n.tr("\(name(of: loader)) is missing the dyld entitlement"))}}@@ -103,7 +103,7 @@ enum RunnerPatcher {guard Digest.sha256IfPresent(staged) == expected else {throw StepFailure(step: step,- detail: "The patched \(arch.rawValue) ntdll has not been copied into place."+ detail: L10n.tr("The patched \(arch.rawValue) ntdll has not been copied into place."))}@@ -126,8 +126,7 @@ enum RunnerPatcher {guard FileManager.default.fileExists(atPath: source.path(percentEncoded: false)) else {throw StepFailure(step: step,- detail: "\(builtin.arch)/\(builtin.name) is not in the bridge. "- + "Install NotProton first."+ detail: L10n.tr("\(builtin.arch)/\(builtin.name) is not in the bridge. Install NotProton first."))}@@ -153,7 +152,7 @@ enum RunnerPatcher {guard let existing, !existing.isEmpty else {throw StepFailure(step: step,- detail: "\(name(of: loader)) carries no entitlements to extend."+ detail: L10n.tr("\(name(of: loader)) carries no entitlements to extend."))}@@ -224,7 +223,7 @@ enum RunnerPatcher {guard entitlements(of: loader)?.contains(dyldEntitlement) == true else {throw StepFailure(step: step,- detail: "\(name(of: loader)) was re-signed without the dyld entitlement."+ detail: L10n.tr("\(name(of: loader)) was re-signed without the dyld entitlement."))}}@@ -262,7 +261,7 @@ enum RunnerPatcher {guard result.status == 0 else {throw StepFailure(step: step,- detail: "Keeping the shipped \(file.lastPathComponent) failed. "+ detail: L10n.tr("Keeping the shipped \(file.lastPathComponent) failed. ")+ result.stderr.trimmingCharacters(in: .whitespacesAndNewlines))}diff --git a/app/Sources/NotProtonApp/Model/RunnerSetup.swift b/app/Sources/NotProtonApp/Model/RunnerSetup.swiftindex a1eda68..17f49bd 100644--- a/app/Sources/NotProtonApp/Model/RunnerSetup.swift+++ b/app/Sources/NotProtonApp/Model/RunnerSetup.swift@@ -12,10 +12,10 @@ enum RunnerSetup {var label: String {switch self {- case .cloning: "Copying CrossOver"- case .staging: "Patching"- case .patching: "Installing compatibility tool"- case .finished: "Done"+ case .cloning: L10n.tr("Copying CrossOver")+ case .staging: L10n.tr("Patching")+ case .patching: L10n.tr("Installing compatibility tool")+ case .finished: L10n.tr("Done")}}}@@ -41,7 +41,7 @@ enum RunnerSetup {return try prepare(build, report: report)}- static let prepareStep = "Set up compatibility tool"+ static let prepareStep = L10n.tr("Set up compatibility tool")static func prepare(_ build: RunnerBuild,@@ -62,14 +62,14 @@ enum RunnerSetup {) throws -> Outcome {guard RunnerInstaller.hasClone(forBuild: build.id, runners: runners) else {throw StepFailure(- step: prepareStep, detail: "Build \(build.displayVersion) has not been set up."+ step: prepareStep, detail: L10n.tr("Build \(build.displayVersion) has not been set up."))}let root = SupportPaths.clonedRoot(forBuild: build.id, runners: runners)let status = license(root)guard status.licensed else {- throw StepFailure(step: "Verify CrossOver license", detail: status.detail)+ throw StepFailure(step: L10n.tr("Verify CrossOver license"), detail: status.detail)}try verify(build, root)diff --git a/app/Sources/NotProtonApp/Model/RunnerStore.swift b/app/Sources/NotProtonApp/Model/RunnerStore.swiftindex 46e365a..d6ec422 100644--- a/app/Sources/NotProtonApp/Model/RunnerStore.swift+++ b/app/Sources/NotProtonApp/Model/RunnerStore.swift@@ -160,7 +160,7 @@ enum CompatToolList {try FileManager.default.createDirectory(at: file.deletingLastPathComponent(), withIntermediateDirectories: true)- try atomicReplace(file, with: Data(text.utf8), step: "Update compatibility tools")+ try atomicReplace(file, with: Data(text.utf8), step: L10n.tr("Update compatibility tools"))}prune(keeping: Set(builds.map(\.id)), runners: runners, bridge: bridge, compatTools: compatTools)return changeddiff --git a/app/Sources/NotProtonApp/Model/SteamBundle.swift b/app/Sources/NotProtonApp/Model/SteamBundle.swiftindex c8ea23c..411a0a9 100644--- a/app/Sources/NotProtonApp/Model/SteamBundle.swift+++ b/app/Sources/NotProtonApp/Model/SteamBundle.swift@@ -101,7 +101,7 @@ enum SteamBundle {guard !isRunning else {throw StepFailure(step: step,- detail: "Steam is running, please close Steam."+ detail: L10n.tr("Steam is running, please close Steam."))}@@ -116,8 +116,7 @@ enum SteamBundle {}static func register(_ app: URL = SupportPaths.Steam.app) {- let lsregister = "/System/Library/Frameworks/CoreServices.framework/Frameworks"- + "/LaunchServices.framework/Support/lsregister"+ let lsregister = "/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister"_ = try? Shell.run(lsregister, ["-f", app.path(percentEncoded: false)])}diff --git a/app/Sources/NotProtonApp/Model/SteamInstaller.swift b/app/Sources/NotProtonApp/Model/SteamInstaller.swiftindex 4034ab6..5e00d6b 100644--- a/app/Sources/NotProtonApp/Model/SteamInstaller.swift+++ b/app/Sources/NotProtonApp/Model/SteamInstaller.swift@@ -17,17 +17,17 @@ enum InstallPhase: Sendable {var label: String {switch self {- case .checkingPayload: "Preparing"- case .stagingBridge: "Staging components"- case .preflight: "Checking Steam"- case .stoppingClient: "Stopping Steam"- case .copyingDylib: "Installing"- case .installingSignatures: "Installing signatures"- case .installingOverlayShim: "Installing components"- case .settingInsert: "Configuring Steam"- case .signing: "Signing"- case .registering: "Finishing up"- case .finished: "Done"+ case .checkingPayload: L10n.tr("Preparing")+ case .stagingBridge: L10n.tr("Staging components")+ case .preflight: L10n.tr("Checking Steam")+ case .stoppingClient: L10n.tr("Stopping Steam")+ case .copyingDylib: L10n.tr("Installing")+ case .installingSignatures: L10n.tr("Installing signatures")+ case .installingOverlayShim: L10n.tr("Installing components")+ case .settingInsert: L10n.tr("Configuring Steam")+ case .signing: L10n.tr("Signing")+ case .registering: L10n.tr("Finishing up")+ case .finished: L10n.tr("Done")}}}@@ -42,7 +42,7 @@ struct InstallOutcome: Sendable {}enum SteamInstaller {- static let step = "Install NotProton"+ static let step = L10n.tr("Install NotProton")typealias ClientStopper = @Sendable (URL, () -> Void) throws -> Booltypealias BundleRegistrar = @Sendable (URL) -> Void@@ -89,7 +89,7 @@ enum SteamInstaller {let installationLock = holdingInstallationLock ? -1 : try DeploymentContent.acquireInstallationLock(for: app)defer { if installationLock >= 0 { FileLock.release(installationLock) } }guard let dylibHashes = try MachOBuild.hashesIgnoringSignature(of: payload.dylib) else {- throw StepFailure(step: step, detail: "The bundled NotProton dylib is invalid.")+ throw StepFailure(step: step, detail: L10n.tr("The bundled NotProton dylib is invalid."))}let build = DeploymentContent.Build(version: version, builtAt: payload.builtAt,dylibHashes: dylibHashes)@@ -105,11 +105,11 @@ enum SteamInstaller {let content = try DeploymentContent.inspect(files: files, bundled: build, installed: previousBuild,legacyVersion: SteamBundle.deployedVersion(at: deployedVersion))guard content != .newerInstalled else {- throw StepFailure(step: step, detail: "A newer NotProton build is installed. Use that build to update or repair the installed files.")+ throw StepFailure(step: step, detail: L10n.tr("A newer NotProton build is installed. Use that build to update or repair the installed files."))}func refuseRunningRunners() throws {for id in RunnerStore.clonedBuilds(in: runners) where runnerIsRunning(SupportPaths.runnerRoot(forBuild: id, runners: runners)) {- throw StepFailure(step: step, detail: "A game or Wine tool is running on build \(id). Quit it before updating NotProton.")+ throw StepFailure(step: step, detail: L10n.tr("A game or Wine tool is running on build \(id). Quit it before updating NotProton."))}}try refuseRunningRunners()@@ -183,14 +183,13 @@ enum SteamInstaller {AppLog.note("install: bundle declares \(landed ?? "no insert")")throw StepFailure(step: step,- detail: "Steam is set up to inject a different dylib. Please repair Steam "- + "before installing NotProton."+ detail: L10n.tr("Steam is set up to inject a different dylib. Please repair Steam before installing NotProton."))}let remaining = try files.filter { try !$0.matches() }.map(\.name)guard remaining.isEmpty else {- throw StepFailure(step: step, detail: "These files did not update: \(remaining.joined(separator: ", ")).")+ throw StepFailure(step: step, detail: L10n.tr("These files did not update: \(remaining.joined(separator: ", "))."))}report(.finished)@@ -211,7 +210,7 @@ enum SteamInstaller {) throws {guard isCurrent(outcome.version) else {throw StepFailure(step: step,- detail: "Installed content could not be verified. Refresh the Status view for the files that still need attention.")+ detail: L10n.tr("Installed content could not be verified. Refresh the Status view for the files that still need attention."))}try write(outcome.version, to: deployedVersion)try atomicReplace(DeploymentContent.record(beside: deployedVersion),@@ -244,7 +243,7 @@ enum SteamInstaller {guard FileManager.default.fileExists(atPath: app.path(percentEncoded: false)) else {throw StepFailure(step: step,- detail: "\(app.path(percentEncoded: false)) is not there, so there is nothing to install into."+ detail: L10n.tr("\(app.path(percentEncoded: false)) is not there, so there is nothing to install into."))}}@@ -257,8 +256,7 @@ enum SteamInstaller {guard foreign.isEmpty else {throw StepFailure(step: step,- detail: "Another dylib is present. Repair your Steam install before "- + "installing NotProton."+ detail: L10n.tr("Another dylib is present. Repair your Steam install before installing NotProton."))}}@@ -284,12 +282,10 @@ enum SteamInstaller {}private static let mismatchAcrossAccounts =- "Steam has a different copy of NotProton, installed by another account on this Mac. "- + "Update NotProton from that account, then try again."+ L10n.tr("Steam has a different copy of NotProton, installed by another account on this Mac. Update NotProton from that account, then try again.")private static let unpatchedAcrossAccounts =- "Steam has not been set up for NotProton, and this account cannot change it. "- + "Install from the account that owns Steam."+ L10n.tr("Steam has not been set up for NotProton, and this account cannot change it. Install from the account that owns Steam.")static func assertBundleIsWritable(_ app: URL) throws {let directory = app.appending(path: "Contents/MacOS")@@ -302,7 +298,7 @@ enum SteamInstaller {} catch {throw StepFailure(step: step,- detail: "\(directory.path(percentEncoded: false)) could not be written. "+ detail: L10n.tr("\(directory.path(percentEncoded: false)) could not be written. ")+ error.localizedDescription)}@@ -342,7 +338,7 @@ enum SteamInstaller {guard var dict = SteamBundle.readInfoPlist(at: plist) else {throw StepFailure(step: step,- detail: "\(plist.path(percentEncoded: false)) could not be read as a property list."+ detail: L10n.tr("\(plist.path(percentEncoded: false)) could not be read as a property list."))}@@ -364,7 +360,7 @@ enum SteamInstaller {guard result.succeeded else {throw StepFailure(step: step,- detail: "\(path) could not be signed. "+ detail: L10n.tr("\(path) could not be signed. ")+ result.stderr.trimmingCharacters(in: .whitespacesAndNewlines))}diff --git a/app/Sources/NotProtonApp/Model/SteamRepair.swift b/app/Sources/NotProtonApp/Model/SteamRepair.swiftindex a063db6..acbcf95 100644--- a/app/Sources/NotProtonApp/Model/SteamRepair.swift+++ b/app/Sources/NotProtonApp/Model/SteamRepair.swift@@ -16,14 +16,14 @@ enum RepairPhase: Sendable {var label: String {switch self {case .downloading(let progress): progress.label- case .unpacking: "Unpacking"- case .checking: "Verifying"- case .stoppingClient: "Stopping Steam"- case .replacing: "Restoring Steam"- case .clearingInsert: "Cleaning up"- case .removingUpdateBlock: "Cleaning up"- case .registering: "Finishing up"- case .finished: "Done"+ case .unpacking: L10n.tr("Unpacking")+ case .checking: L10n.tr("Verifying")+ case .stoppingClient: L10n.tr("Stopping Steam")+ case .replacing: L10n.tr("Restoring Steam")+ case .clearingInsert: L10n.tr("Cleaning up")+ case .removingUpdateBlock: L10n.tr("Cleaning up")+ case .registering: L10n.tr("Finishing up")+ case .finished: L10n.tr("Done")}}}@@ -41,7 +41,7 @@ enum SteamRepair {static let valveTeam = "MXGJJ98X76"static let valveIdentifier = "com.valvesoftware.steam"- private static let step = "Repair Steam"+ private static let step = L10n.tr("Repair Steam")static func run(manifest suppliedManifest: ValvePackageManifest? = nil,@@ -56,7 +56,7 @@ enum SteamRepair {guard let bundle = manifest.bundle else {throw StepFailure(step: step,- detail: "This copy of NotProton cannot repair Steam. Please reinstall NotProton."+ detail: L10n.tr("This copy of NotProton cannot repair Steam. Please reinstall NotProton."))}@@ -85,7 +85,7 @@ enum SteamRepair {AppLog.note("repair: restored bundle still declares \(insert)")throw StepFailure(step: step,- detail: "Steam could not be fully restored. Please run Repair Steam again."+ detail: L10n.tr("Steam could not be fully restored. Please run Repair Steam again."))}@@ -134,7 +134,7 @@ enum SteamRepair {guard files.fileExists(atPath: staged.path(percentEncoded: false)) else {throw StepFailure(step: step,- detail: "\(bundle.innerArchive) did not contain \(bundle.bundleName)."+ detail: L10n.tr("\(bundle.innerArchive) did not contain \(bundle.bundleName)."))}return staged@@ -147,7 +147,7 @@ enum SteamRepair {guard strict.succeeded else {throw StepFailure(step: step,- detail: "\(path) does not verify against its own signature. "+ detail: L10n.tr("\(path) does not verify against its own signature. ")+ strict.stderr.trimmingCharacters(in: .whitespacesAndNewlines))}@@ -164,13 +164,13 @@ enum SteamRepair {guard fields.contains("TeamIdentifier=\(valveTeam)") else {throw StepFailure(step: step,- detail: "\(path) is not signed by Valve. Expected TeamIdentifier=\(valveTeam)."+ detail: L10n.tr("\(path) is not signed by Valve. Expected TeamIdentifier=\(valveTeam)."))}guard fields.contains("Identifier=\(valveIdentifier)") else {throw StepFailure(step: step,- detail: "\(path) is not the Steam bundle. Expected Identifier=\(valveIdentifier)."+ detail: L10n.tr("\(path) is not the Steam bundle. Expected Identifier=\(valveIdentifier)."))}}diff --git a/app/Sources/NotProtonApp/Model/Uninstall.swift b/app/Sources/NotProtonApp/Model/Uninstall.swiftindex 33aef3b..09e0b99 100644--- a/app/Sources/NotProtonApp/Model/Uninstall.swift+++ b/app/Sources/NotProtonApp/Model/Uninstall.swift@@ -11,11 +11,11 @@ enum UninstallPhase: Sendable {var label: String {switch self {- case .stoppingClient: "Stopping Steam"- case .detaching: "Detaching from Steam"+ case .stoppingClient: L10n.tr("Stopping Steam")+ case .detaching: L10n.tr("Detaching from Steam")case .restoring(let phase): phase.label- case .removing: "Removing files"- case .finished: "Done"+ case .removing: L10n.tr("Removing files")+ case .finished: L10n.tr("Done")}}}@@ -31,7 +31,7 @@ struct UninstallOutcome: Sendable {}enum Uninstall {- static let step = "Remove NotProton"+ static let step = L10n.tr("Remove NotProton")typealias Repair = @Sendable (@escaping @Sendable (RepairPhase) -> Void) async throws -> Voiddiff --git a/app/Sources/NotProtonApp/Model/UpdateBlock.swift b/app/Sources/NotProtonApp/Model/UpdateBlock.swiftindex e21b4bc..1fac621 100644--- a/app/Sources/NotProtonApp/Model/UpdateBlock.swift+++ b/app/Sources/NotProtonApp/Model/UpdateBlock.swift@@ -4,7 +4,7 @@import Foundationenum UpdateBlock {- static let step = "Block client updates"+ static let step = L10n.tr("Block client updates")static let key = "BootStrapperInhibitUpdateOnLaunch"static let contents = "\(key)=enable\n"@@ -73,7 +73,7 @@ enum UpdateBlock {} catch {throw StepFailure(step: step,- detail: "\(required.path(percentEncoded: false)) could not be written. "+ detail: L10n.tr("\(required.path(percentEncoded: false)) could not be written. ")+ error.localizedDescription)}diff --git a/app/Sources/NotProtonApp/Model/ValveFetcher.swift b/app/Sources/NotProtonApp/Model/ValveFetcher.swiftindex ca51b36..4ddd494 100644--- a/app/Sources/NotProtonApp/Model/ValveFetcher.swift+++ b/app/Sources/NotProtonApp/Model/ValveFetcher.swift@@ -14,10 +14,10 @@ enum ValveFetcher {var label: String {switch self {case .downloading(let progress): progress.label- case .extracting: "Extracting"- case .verifying: "Verifying"- case .installing: "Installing"- case .finished: "Done"+ case .extracting: L10n.tr("Extracting")+ case .verifying: L10n.tr("Verifying")+ case .installing: L10n.tr("Installing")+ case .finished: L10n.tr("Done")}}}@@ -29,7 +29,7 @@ enum ValveFetcher {var wroteNothing: Bool { installed.isEmpty }}- private static let step = "Fetch the Valve binaries"+ private static let step = L10n.tr("Fetch the Valve binaries")static func run(manifest suppliedManifest: ValvePackageManifest? = nil,@@ -55,12 +55,10 @@ enum ValveFetcher {report(.verifying)let wrong = manifest.files.filter { Digest.sha256IfPresent(extracted.appending(path: $0.innerPath)) != $0.sha256 }guard wrong.isEmpty else {- AppLog.note("valve fetch: \(wrong.count) of \(manifest.files.count) files missed their "- + "pinned hash: \(wrong.map(\.bridgePath).joined(separator: ", "))")+ AppLog.note("valve fetch: \(wrong.count) of \(manifest.files.count) files missed their pinned hash: \(wrong.map(\.bridgePath).joined(separator: ", "))")throw StepFailure(step: step,- detail: "Something is wrong with the downloaded files. "- + "Please check for a NotProton update."+ detail: L10n.tr("Something is wrong with the downloaded files. Please check for a NotProton update."))}diff --git a/app/Sources/NotProtonApp/Model/ValvePackageManifest.swift b/app/Sources/NotProtonApp/Model/ValvePackageManifest.swiftindex 81e4ad2..7db061d 100644--- a/app/Sources/NotProtonApp/Model/ValvePackageManifest.swift+++ b/app/Sources/NotProtonApp/Model/ValvePackageManifest.swift@@ -42,7 +42,7 @@ struct ValvePackageManifest: Sendable {static let resourceName = "valve-packages"static let resourceExtension = "manifest"- private static let step = "Read the Valve file list"+ private static let step = L10n.tr("Read the Valve file list")static func bundled() throws -> ValvePackageManifest {guard let url = Bundle.module.url(@@ -50,7 +50,7 @@ struct ValvePackageManifest: Sendable {) else {throw StepFailure(step: step,- detail: "\(resourceName).\(resourceExtension) is missing from the app's resources."+ detail: L10n.tr("\(resourceName).\(resourceExtension) is missing from the app's resources."))}return try load(from: url)@@ -63,7 +63,7 @@ struct ValvePackageManifest: Sendable {} catch {throw StepFailure(step: step,- detail: "\(url.path(percentEncoded: false)) could not be read. \(error.localizedDescription)"+ detail: L10n.tr("\(url.path(percentEncoded: false)) could not be read. \(error.localizedDescription)"))}return try parse(String(decoding: data, as: UTF8.self))@@ -86,63 +86,61 @@ struct ValvePackageManifest: Sendable {switch fields[0] {case "base":- try expect(fields.count == 2, number, "a base and one URL", line)+ try expect(fields.count == 2, number, L10n.tr("a base and one URL"), line)guard let url = URL(string: fields[1]), url.scheme == "https", url.host() != nil else {- throw fail(number, "does not hold an https URL: \(fields[1])")+ throw fail(number, L10n.tr("does not hold an https URL: \(fields[1])"))}bases.append(url)case "package":- try expect(fields.count == 4, number, "a package, an id, a filename and a sha256", line)+ try expect(fields.count == 4, number, L10n.tr("a package, an id, a filename and a sha256"), line)try expectHash(fields[3], number)guard packageIDs.insert(fields[1]).inserted else {- throw fail(number, "repeats the package id \(fields[1]).")+ throw fail(number, L10n.tr("repeats the package id \(fields[1])."))}packages.append(ValvePackage(id: fields[1], file: fields[2], sha256: fields[3]))case "file":- try expect(fields.count == 5, number, "a file, a bridge path, a package id, an inner path and a sha256", line)+ try expect(fields.count == 5, number, L10n.tr("a file, a bridge path, a package id, an inner path and a sha256"), line)try expectHash(fields[4], number)guard bridgePaths.insert(fields[1]).inserted else {- throw fail(number, "repeats the bridge path \(fields[1]).")+ throw fail(number, L10n.tr("repeats the bridge path \(fields[1])."))}files.append(ValveFile(bridgePath: fields[1], package: fields[2], innerPath: fields[3], sha256: fields[4]))case "bundle":try expect(fields.count == 5, number,- "a bundle, a filename, a sha256, an inner archive and a bundle name", line)+ L10n.tr("a bundle, a filename, a sha256, an inner archive and a bundle name"), line)try expectHash(fields[2], number)guard bundle == nil else {- throw fail(number, "declares a second bundle. One is the most that can be installed.")+ throw fail(number, L10n.tr("declares a second bundle. One is the most that can be installed."))}bundle = ValveBundle(file: fields[1], sha256: fields[2], innerArchive: fields[3], bundleName: fields[4])default:- throw fail(number, "has an unknown row kind \(fields[0]). Known: base, package, file, bundle.")+ throw fail(number, L10n.tr("has an unknown row kind \(fields[0]). Known: base, package, file, bundle."))}}- guard !bases.isEmpty else { throw fail(nil, "names no CDN host to fetch from.") }- guard !packages.isEmpty else { throw fail(nil, "names no package.") }- guard !files.isEmpty else { throw fail(nil, "names no file.") }+ guard !bases.isEmpty else { throw fail(nil, L10n.tr("names no CDN host to fetch from.")) }+ guard !packages.isEmpty else { throw fail(nil, L10n.tr("names no package.")) }+ guard !files.isEmpty else { throw fail(nil, L10n.tr("names no file.")) }for file in files where !packageIDs.contains(file.package) {- throw fail(nil, "\(file.bridgePath) names the package \(file.package), which is not declared. "- + "Declared: \(packages.map(\.id).joined(separator: ", ")).")+ throw fail(nil, L10n.tr("\(file.bridgePath) names the package \(file.package), which is not declared. Declared: \(packages.map(\.id).joined(separator: ", "))."))}for package in packages where !files.contains(where: { $0.package == package.id }) {- throw fail(nil, "declares the package \(package.id), which no file row uses.")+ throw fail(nil, L10n.tr("declares the package \(package.id), which no file row uses."))}var hashByInner: [String: (path: String, sha: String)] = [:]for file in files {let key = "\(file.package)/\(file.innerPath)"if let first = hashByInner[key], first.sha != file.sha256 {- throw fail(nil, "\(first.path) and \(file.bridgePath) both come from \(key) "- + "but pin different hashes.")+ throw fail(nil, L10n.tr("\(first.path) and \(file.bridgePath) both come from \(key) but pin different hashes."))}hashByInner[key] = (file.bridgePath, file.sha256)}@@ -151,17 +149,17 @@ struct ValvePackageManifest: Sendable {}private static func expect(_ condition: Bool, _ line: Int, _ shape: String, _ text: String) throws {- guard condition else { throw fail(line, "is not \(shape): \(text)") }+ guard condition else { throw fail(line, L10n.tr("is not \(shape): \(text)")) }}private static func expectHash(_ value: String, _ line: Int) throws {let hex = "0123456789abcdef"guard value.count == 64, value.allSatisfy(hex.contains) else {- throw fail(line, "does not end in a lowercase 64 character sha256: \(value)")+ throw fail(line, L10n.tr("does not end in a lowercase 64 character sha256: \(value)"))}}private static func fail(_ line: Int?, _ detail: String) -> StepFailure {- StepFailure(step: step, detail: line.map { "Line \($0) \(detail)" } ?? "The Valve file list \(detail)")+ StepFailure(step: step, detail: line.map { L10n.tr("Line \($0) \(detail)") } ?? L10n.tr("The Valve file list \(detail)"))}}diff --git a/app/Sources/NotProtonApp/PrefixesModel.swift b/app/Sources/NotProtonApp/PrefixesModel.swiftindex aac5ed1..ca4e644 100644--- a/app/Sources/NotProtonApp/PrefixesModel.swift+++ b/app/Sources/NotProtonApp/PrefixesModel.swift@@ -137,7 +137,7 @@ final class PrefixesModel {func open(_ tool: WineTool, for prefix: WinePrefix) {act(on: prefix) {try PrefixTools.launch(tool, in: prefix)- return "Opened \(tool.label) in \(prefix.title)."+ return L10n.tr("Opened \(tool.label) in \(prefix.title).")}}@@ -148,20 +148,18 @@ final class PrefixesModel {func delete(_ targets: [WinePrefix]) async {await eachInTurn(targets, { try PrefixTools.delete($0) }) { deleted inif deleted.count == 1 {- return "Deleted the prefix for \(deleted[0].prefix.title). Steam will make a new "- + "prefix if the game is launched again."+ return L10n.tr("Deleted the prefix for \(deleted[0].prefix.title). Steam will make a new prefix if the game is launched again.")}guard deleted.count > 1 else { return nil }- return "Deleted \(deleted.count) prefixes. Steam will make a new prefix if a game "- + "is launched again."+ return L10n.tr("Deleted \(deleted.count) prefixes. Steam will make a new prefix if a game is launched again.")}}func backUp(_ targets: [WinePrefix]) async {await eachInTurn(targets, makeBackup) { saved inguard let first = saved.first else { return nil }- guard saved.count == 1 else { return "Backed up \(saved.count) prefixes." }- return "Backed up the prefix for \(first.prefix.title)."+ guard saved.count == 1 else { return L10n.tr("Backed up \(saved.count) prefixes.") }+ return L10n.tr("Backed up the prefix for \(first.prefix.title).")}}@@ -178,16 +176,12 @@ final class PrefixesModel {let kept = rebuilt.compactMap(\.made)if rebuilt.count == 1 {let title = rebuilt[0].prefix.title- guard let backup = kept.first else { return "Rebuilt the prefix for \(title)." }- return "Rebuilt the prefix for \(title). The original is at "- + "\(backup.path(percentEncoded: false)). Check that your save is present in "- + "the game, then delete the backup to save space."+ guard let backup = kept.first else { return L10n.tr("Rebuilt the prefix for \(title).") }+ return L10n.tr("Rebuilt the prefix for \(title). The original is at \(backup.path(percentEncoded: false)). Check that your save is present in the game, then delete the backup to save space.")}guard rebuilt.count > 1 else { return nil }- guard !kept.isEmpty else { return "Rebuilt \(rebuilt.count) prefixes." }- return "Rebuilt \(rebuilt.count) prefixes. Each original is kept beside the game's "- + "prefix. Check that your saves are present in the games, then delete the "- + "backups to save space."+ guard !kept.isEmpty else { return L10n.tr("Rebuilt \(rebuilt.count) prefixes.") }+ return L10n.tr("Rebuilt \(rebuilt.count) prefixes. Each original is kept beside the game's prefix. Check that your saves are present in the games, then delete the backups to save space.")}}@@ -228,12 +222,12 @@ final class PrefixesModel {guard !cleared.isEmpty else { return nil }let games = Set(cleared.map(\.prefix.id)).countif cleared.count == 1 {- return "Deleted the backup for \(cleared[0].title)."+ return L10n.tr("Deleted the backup for \(cleared[0].title).")}if games == 1 {- return "Deleted \(cleared.count) backups for \(cleared[0].title)."+ return L10n.tr("Deleted \(cleared.count) backups for \(cleared[0].title).")}- return "Deleted \(cleared.count) backups across \(games) prefixes."+ return L10n.tr("Deleted \(cleared.count) backups across \(games) prefixes.")}private typealias Step<Made> = (prefix: WinePrefix, made: Made)@@ -277,8 +271,8 @@ final class PrefixesModel {panel.allowsMultipleSelection = falselet types = PrefixTools.runnableTypesif !types.isEmpty { panel.allowedContentTypes = types }- panel.prompt = "Run"- panel.message = "Choose a Windows program to run in \(prefix.title)."+ panel.prompt = L10n.tr("Run")+ panel.message = L10n.tr("Choose a Windows program to run in \(prefix.title).")panel.directoryURL = PrefixStore.installDirectory(of: prefix)?? prefix.pfx.appending(path: "drive_c")@@ -289,7 +283,7 @@ final class PrefixesModel {func run(_ executable: URL, in prefix: WinePrefix) {act(on: prefix) {try PrefixTools.run(executable, in: prefix)- return "Started \(executable.lastPathComponent) in \(prefix.title)."+ return L10n.tr("Started \(executable.lastPathComponent) in \(prefix.title).")}}diff --git a/app/Sources/NotProtonApp/Resources/Localization/zh-Hans.lproj/Localizable.strings b/app/Sources/NotProtonApp/Resources/Localization/zh-Hans.lproj/Localizable.stringsnew file mode 100644index 0000000..f878496--- /dev/null+++ b/app/Sources/NotProtonApp/Resources/Localization/zh-Hans.lproj/Localizable.strings@@ -0,0 +1,402 @@+// NotProton UI. {0}, {1}, … are positional interpolation values.+" NotProton can be deployed, but the CrossOver compatibility tool cannot be installed without a valid license." = " 可以部署 NotProton,但没有有效许可证时无法安装 CrossOver 兼容工具。";+" with {0}" = "(使用 {0})";+", copy damaged" = ",副本已损坏";+", not patched" = ",尚未修补";+", not set up" = ",尚未设置";+", not set up or activated" = ",尚未设置或激活";+", not supported" = ",不受支持";+"1 backup" = "1 个备份";+"A Steam client update may break NotProton." = "Steam 客户端更新可能导致 NotProton 无法使用。";+"A game or Wine tool is running on build {0}. Quit it before updating NotProton." = "有游戏或 Wine 工具正在使用构建版本 {0}。请先退出,再更新 NotProton。";+"A game or Wine tool is running. Quit it before updating NotProton." = "有游戏或 Wine 工具正在运行。请先退出,再更新 NotProton。";+"A game or Wine tool is still running on build {0}. Quit it first." = "仍有游戏或 Wine 工具正在使用构建版本 {0}。请先退出。";+"A header field" = "头字段";+"A hook site of {0} bytes cannot hold a branch and link." = "{0} 字节的挂钩位置无法容纳分支链接指令。";+"A hook site of {0} bytes cannot hold a relative jump." = "{0} 字节的挂钩位置无法容纳相对跳转指令。";+"A newer NotProton build is installed. Use that build to update or repair the installed files." = "已安装较新的 NotProton 版本。请使用该版本更新或修复已安装的文件。";+"A newer build is installed." = "已安装较新的版本。";+"A prefix appears here once a Windows game has been launched through NotProton." = "通过 NotProton 启动 Windows 游戏后,对应的游戏容器就会显示在这里。";+"Add" = "添加";+"Add CrossOver…" = "添加 CrossOver…";+"Add a copy of CrossOver from another folder." = "从其他文件夹添加 CrossOver 应用。";+"Allow Client Updates" = "允许客户端更新";+"Allowing Steam client updates" = "正在允许 Steam 客户端更新";+"Another dylib is present." = "检测到其他动态库。";+"Another dylib is present. Repair your Steam install before installing NotProton." = "检测到其他动态库。请先修复 Steam,再安装 NotProton。";+"Another installation operation is changing files here. Wait for it to finish." = "另一项安装操作正在修改此处的文件。请等待该操作完成。";+"Any data in it will be lost." = "其中的所有数据都将丢失。";+"Any data in them will be lost." = "这些备份中的所有数据都将丢失。";+"App ID" = "应用 ID";+"App {0}" = "应用 {0}";+"Are you sure you want to back up these prefixes?" = "确定要备份这些游戏容器吗?";+"Are you sure you want to back up this prefix?" = "确定要备份此游戏容器吗?";+"Are you sure you want to delete these {0} backups?" = "确定要删除这 {0} 个备份吗?";+"Are you sure you want to delete this backup?" = "确定要删除此备份吗?";+"Are you sure you want to do this?" = "确定要继续吗?";+"Back Up Prefix" = "备份游戏容器";+"Back Up and Rebuild" = "备份并重建";+"Back Up and Rebuild {0} Prefixes" = "备份并重建 {0} 个游戏容器";+"Back Up {0} Prefixes" = "备份 {0} 个游戏容器";+"Back up prefix" = "备份游戏容器";+"Back up prefix?" = "备份游戏容器?";+"Back up the prefix for {0}?" = "备份“{0}”的游戏容器?";+"Back up {0} prefixes?" = "备份 {0} 个游戏容器?";+"Backed up" = "备份时间";+"Backed up the prefix for {0}." = "已备份“{0}”的游戏容器。";+"Backed up {0} prefixes." = "已备份 {0} 个游戏容器。";+"Block Client Updates" = "阻止客户端更新";+"Block Steam client updates" = "阻止 Steam 客户端更新";+"Block Steam client updates?" = "阻止 Steam 客户端更新?";+"Block Updates" = "阻止更新";+"Block client updates" = "阻止客户端更新";+"Blocking Steam client updates" = "正在阻止 Steam 客户端更新";+"Build {0}" = "构建版本 {0}";+"Build {0} has not been set up." = "尚未设置构建版本 {0}。";+"Build {0} is not set up." = "尚未设置构建版本 {0}。";+"Build {0} records no {1} ntdll hashes." = "构建版本 {0} 未记录 {1} ntdll 的哈希值。";+"Calculating…" = "正在计算…";+"Cancel" = "取消";+"Check for Updates…" = "检查更新…";+"Check installed files" = "检查已安装的文件";+"Check permissions, make sure your user owns the folder." = "请检查权限,确认当前用户拥有该文件夹。";+"Checking" = "正在检查";+"Checking Steam" = "正在检查 Steam";+"Choose a Windows program to run in {0}." = "选择要在“{0}”中运行的 Windows 程序。";+"Cleaning up" = "正在清理";+"Clear Steam's controller permission so macOS asks for it again." = "清除 Steam 的控制器权限,让 macOS 重新询问授权。";+"Clone CrossOver" = "复制 CrossOver";+"Close Steam before continuing." = "请先关闭 Steam,再继续。";+"Compatibility Tool" = "兼容工具";+"Compatibility tool is already set up." = "兼容工具已设置,无需重复操作。";+"Compatibility tool ready." = "兼容工具已就绪。";+"Compatibility tool ready. {0}" = "兼容工具已就绪。{0}";+"Component list unreadable." = "无法读取组件列表。";+"Components" = "组件";+"Configuring Steam" = "正在配置 Steam";+"Continue Anyway" = "仍然继续";+"Controller permission" = "控制器权限";+"Controller permission reset. Restart Steam so macOS asks again." = "控制器权限已重置。请重启 Steam,让 macOS 重新询问权限。";+"Controller permission reset. macOS asks again when Steam starts." = "控制器权限已重置。下次启动 Steam 时,macOS 将重新询问权限。";+"Copies on other drives {0}" = "其他磁盘上的副本 {0}";+"Copy the built bridge files" = "复制已构建的桥接文件";+"Copy {0} again." = "重新复制 {0}。";+"Copy {0} and set up its compatibility tool." = "复制 {0} 并设置其兼容工具。";+"Copying CrossOver" = "正在复制 CrossOver";+"Copying {0} failed. {1}" = "复制 {0} 失败。{1}";+"Could not check installed files." = "无法检查已安装的文件。";+"Could not clean prefix templates at {0}: {1} Refresh to retry." = "无法清理 {0} 处的容器模板:{1} 请刷新后重试。";+"Could not lock the installation at {0}: {1}." = "无法锁定 {0} 处的安装:{1}。";+"Could not remove prefix template {0}: {1} Refresh to retry." = "无法移除容器模板 {0}:{1} 请刷新后重试。";+"Could not write files." = "无法写入文件。";+"CrossOver app not found." = "未找到 CrossOver 应用。";+"CrossOver does not appear to be activated." = "CrossOver 似乎尚未激活。";+"CrossOver is activated." = "CrossOver 已激活。";+"CrossOver itself is not removed." = "不会移除 CrossOver 原应用。";+"Delete" = "删除";+"Delete All" = "全部删除";+"Delete Backup" = "删除备份";+"Delete NotProton's copy of this build." = "删除 NotProton 保存的此版本副本。";+"Delete Prefix" = "删除游戏容器";+"Delete backup?" = "删除备份?";+"Delete every backup that rebuilds have kept." = "删除重建时保留的所有备份。";+"Delete prefix" = "删除游戏容器";+"Delete prefix?" = "删除游戏容器?";+"Delete the backup for {0}?" = "删除“{0}”的备份?";+"Delete the prefix for {0}?" = "删除“{0}”的游戏容器?";+"Delete the selected backups." = "删除所选备份。";+"Delete {0} Backups" = "删除 {0} 个备份";+"Delete {0} Prefixes" = "删除 {0} 个游戏容器";+"Delete {0} backups?" = "删除 {0} 个备份?";+"Delete {0} prefixes?" = "删除 {0} 个游戏容器?";+"Deleted the backup for {0}." = "已删除“{0}”的备份。";+"Deleted the prefix for {0}. Steam will make a new prefix if the game is launched again." = "已删除“{0}”的游戏容器。下次启动该游戏时,Steam 将创建新容器。";+"Deleted {0} backups across {1} prefixes." = "已删除 {1} 个游戏容器的 {0} 个备份。";+"Deleted {0} backups for {1}." = "已删除“{1}”的 {0} 个备份。";+"Deleted {0} prefixes. Steam will make a new prefix if a game is launched again." = "已删除 {0} 个游戏容器。下次启动游戏时,Steam 将创建新容器。";+"Detaching from Steam" = "正在解除与 Steam 的关联";+"Done" = "已完成";+"Download missing Valve binaries." = "下载缺失的 Valve 组件。";+"Downloaded missing components." = "已下载缺失的组件。";+"Downloading from {0}" = "正在从 {0} 下载";+"Downloading missing components" = "正在下载缺失的组件";+"Extracting" = "正在解压";+"Failed" = "操作失败";+"Fetch Valve Binaries" = "下载 Valve 组件";+"Fetch the Valve binaries" = "下载 Valve 组件";+"Find NotProton's components" = "查找 NotProton 组件";+"Finishing up" = "正在完成收尾工作";+"Game" = "游戏";+"Install" = "安装";+"Install NotProton" = "安装 NotProton";+"Install NotProton into Steam." = "将 NotProton 安装到 Steam。";+"Installation is blocked. Refresh Status and use the NotProton app that installed this build." = "安装已被阻止。请刷新“状态”页面,并使用此前安装此版本的 NotProton 应用。";+"Installed" = "已安装";+"Installed content could not be verified. Refresh the Status view for the files that still need attention." = "无法验证已安装的内容。请刷新“状态”页面,查看仍需处理的文件。";+"Installed files differ from this build." = "已安装的文件与此版本不一致。";+"Installed, but not for this account." = "已安装,但当前账户尚未配置。";+"Installing" = "正在安装";+"Installing compatibility tool" = "正在安装兼容工具";+"Installing components" = "正在安装组件";+"Installing signatures" = "正在安装签名数据库";+"It will replace the DLLs used by CrossOver with ones that match your compatibility tool." = "它会将 CrossOver 使用的 DLL 替换为与当前兼容工具匹配的版本。";+"Its output was still open when it exited, so none was captured." = "进程退出后输出通道仍未关闭,因此未能捕获输出。";+"Keeping the shipped {0} failed. " = "无法保留随附的 {0}。";+"Last used" = "上次使用";+"Library" = "游戏库";+"Line {0} has an unknown origin {1}. Known: {2}." = "第 {0} 行包含未知来源 {1}。已知来源:{2}。";+"Line {0} is not an origin and a path: {1}" = "第 {0} 行不是有效的来源和路径:{1}";+"Line {0} repeats {1}." = "第 {0} 行重复声明了 {1}。";+"Line {0} {1}" = "第 {0} 行:{1}";+"List the backups again and update their sizes." = "重新列出备份并更新大小。";+"List the prefixes again and update their sizes." = "重新列出游戏容器并更新大小。";+"Looking for backups" = "正在查找备份";+"Looking for prefixes" = "正在查找游戏容器";+"Missing components: {0}. Run make app-payload and build the app again." = "缺少组件:{0}。请运行 make app-payload,然后重新构建应用。";+"Missing." = "缺失。";+"More" = "更多";+"More actions" = "更多操作";+"More actions, {0}" = "更多操作,{0}";+"Needs rebuilding" = "需要重建";+"Never" = "从未使用";+"No Backups" = "暂无备份";+"No Prefixes" = "暂无游戏容器";+"No compatibility tool at {0}. Use Set Up Compatibility Tool first." = "{0} 处没有兼容工具。请先执行“设置兼容工具”。";+"No compatibility tool is set up." = "尚未设置兼容工具。";+"No file at {0}." = "{0} 处没有文件。";+"No longer installed" = "已卸载";+"No supported copy of CrossOver found." = "未找到受支持的 CrossOver 应用。";+"None" = "无";+"Not found. Supported: {0}." = "未找到。支持的版本:{0}。";+"Not installed." = "尚未安装。";+"Not yet deployed." = "尚未部署。";+"NotProton Components" = "NotProton 组件";+"NotProton carries no components." = "NotProton 未包含任何组件。";+"NotProton could not download the files it needs from Valve. Please try again later." = "NotProton 无法从 Valve 下载所需文件。请稍后重试。";+"NotProton could not reach Valve's servers. Please check your internet connection and try again." = "NotProton 无法连接 Valve 服务器。请检查网络连接,然后重试。";+"NotProton has been removed." = "NotProton 已移除。";+"NotProton has been removed. Steam could not be restored. Reinstall Steam from steampowered.com before using it again." = "NotProton 已移除,但需要重新下载 Steam。请联网后再次执行“修复 Steam”。";+"NotProton needs the App Management permission." = "NotProton 需要“App 管理”权限。";+"NotProton successfully installed." = "NotProton 安装成功。";+"OK" = "好";+"Open CrossOver to activate it." = "请打开 CrossOver 完成激活。";+"Open System Settings" = "打开系统设置";+"Open {0}" = "打开{0}";+"Opened {0} in {1}." = "已在“{1}”中打开{0}。";+"Overlay shim" = "游戏叠加层适配组件";+"Patch ntdll" = "修补 ntdll";+"Patch the compatibility tool" = "修补兼容工具";+"Patched components are missing." = "缺少已修补的组件。";+"Patching" = "正在应用补丁";+"Please run CrossOver and try again." = "请先运行 CrossOver,然后重试。";+"Prefix" = "游戏容器";+"Prefix Backups" = "容器备份";+"Prefixes" = "游戏容器";+"Preparing" = "正在准备";+"Private Size" = "独占空间";+"RVA {0} falls in no mapped section of the {1} ntdll, so the {2} cannot be located." = "RVA {0} 不在 {1} ntdll 的任何已映射节内,无法定位{2}。";+"Read the Valve file list" = "读取 Valve 文件列表";+"Read the component list" = "读取组件列表";+"Ready." = "已就绪。";+"Rebuild Prefix" = "重建游戏容器";+"Rebuild Without Backing Up" = "不备份,直接重建";+"Rebuild prefix{0}?" = "重建游戏容器{0}?";+"Rebuild the prefix for {0}{1}?" = "重建“{0}”的游戏容器{1}?";+"Rebuild {0} Prefixes" = "重建 {0} 个游戏容器";+"Rebuild {0} Prefixes Without Backing Up" = "不备份,直接重建 {0} 个游戏容器";+"Rebuild {0} prefixes{1}?" = "重建 {0} 个游戏容器{1}?";+"Rebuilt the prefix for {0}." = "已重建“{0}”的游戏容器。";+"Rebuilt the prefix for {0}. The original is at {1}. Check that your save is present in the game, then delete the backup to save space." = "已重建“{0}”的游戏容器。原容器保存在 {1}。请先进入游戏确认存档正常,再删除备份以释放空间。";+"Rebuilt {0} prefixes." = "已重建 {0} 个游戏容器。";+"Rebuilt {0} prefixes. Each original is kept beside the game's prefix. Check that your saves are present in the games, then delete the backups to save space." = "已重建 {0} 个游戏容器。各原容器均保存在对应游戏容器旁。请先进入游戏确认存档正常,再删除备份以释放空间。";+"Record prefix build" = "记录容器版本";+"Recreate prefix" = "重建游戏容器";+"Refresh" = "刷新";+"Registry Editor" = "注册表编辑器";+"Reinstall" = "重新安装";+"Remove" = "移除";+"Remove Copy" = "移除副本";+"Remove Copy…" = "移除副本…";+"Remove Everything" = "全部移除";+"Remove NotProton" = "移除 NotProton";+"Remove NotProton and restore Steam to its original state." = "移除 NotProton 并将 Steam 恢复原状。";+"Remove build" = "移除构建版本";+"Remove everything NotProton has created?" = "移除 NotProton 创建的所有内容?";+"Remove from List" = "从列表中移除";+"Remove the {0} copy?" = "移除 {0} 的副本?";+"Removed build {0}." = "已移除构建版本 {0}。";+"Remove…" = "移除…";+"Removing files" = "正在移除文件";+"Repair" = "修复";+"Repair Steam" = "修复 Steam";+"Repair your Steam install before installing NotProton." = "请先修复 Steam,再安装 NotProton。";+"Replace Steam" = "替换 Steam";+"Replace Steam with Valve's bundle?" = "使用 Valve 原版应用包替换 Steam?";+"Replacing {0} failed. {1}" = "替换 {0} 失败。{1}";+"Reset" = "重置";+"Reset controller permission" = "重置控制器权限";+"Resetting Steam's controller permission" = "正在重置 Steam 的控制器权限";+"Restart Steam to update its list of compatibility tools." = "请重启 Steam,以更新兼容工具列表。";+"Restore Steam to its original state." = "将 Steam 恢复原状。";+"Restore the files included with this app." = "使用此应用附带的文件恢复安装。";+"Restoring Steam" = "正在恢复 Steam";+"Reveal Log in Finder" = "在访达中显示日志";+"Reveal in Finder" = "在访达中显示";+"Run" = "运行";+"Run Program…" = "运行程序…";+"Run a program or open a Wine tool in the selected prefix." = "在所选游戏容器中运行程序或打开 Wine 工具。";+"Run {0}" = "运行 {0}";+"Runner {0}" = "运行环境 {0}";+"Select a copy of CrossOver." = "请选择一份 CrossOver 应用。";+"Set Up" = "设置";+"Set Up Compatibility Tool" = "设置兼容工具";+"Set up compatibility tool" = "设置兼容工具";+"Set up the compatibility tool again." = "重新设置兼容工具。";+"Setting up compatibility tool" = "正在设置兼容工具";+"Setup" = "安装与设置";+"Show in Finder" = "在访达中显示";+"Show the selected backup in the Finder." = "在访达中显示所选备份。";+"Show the selected prefix in the Finder." = "在访达中显示所选游戏容器。";+"Signature database" = "签名数据库";+"Signing" = "正在签名";+"Something is wrong with the downloaded files. Please check for a NotProton update." = "下载的文件存在问题。请检查是否有新版 NotProton。";+"Staging components" = "正在准备组件";+"Started {0} in {1}." = "已在“{1}”中启动 {0}。";+"Status" = "状态";+"Steam client updates are allowed." = "已允许 Steam 客户端更新。";+"Steam client updates are blocked." = "已阻止 Steam 客户端更新。";+"Steam client updates may break NotProton." = "Steam 客户端更新可能导致 NotProton 无法使用。";+"Steam client updates may break NotProton. If you don't want to wait for NotProton to be updated to be compatible with future Steam versions at the cost of not getting updates to the Steam client, you can stop the Steam client from updating itself." = "Steam 客户端更新可能导致 NotProton 无法使用。你可以阻止 Steam 自动更新,避免等待 NotProton 适配新版本,但这也意味着无法及时获得 Steam 客户端的功能改进和安全更新。";+"Steam could not be fully restored. Please run Repair Steam again." = "未能完全恢复 Steam。请再次执行“修复 Steam”。";+"Steam has a different copy of NotProton, installed by another account on this Mac. Update NotProton from that account, then try again." = "Steam 中的另一份 NotProton 是由本机其他账户安装的。请使用该账户更新 NotProton,然后重试。";+"Steam has not been set up for NotProton, and this account cannot change it. Install from the account that owns Steam." = "Steam 尚未配置 NotProton,当前账户无权修改。请使用安装 Steam 的账户执行安装。";+"Steam is restored to its unmodified state and NotProton is removed, including the compatibility tool that lives inside the Steam folder. Windows games and Steam Play prefixes are not removed." = "此操作会将 Steam 恢复为未修改的状态,并移除 NotProton(包括 Steam 文件夹内的兼容工具)。不会删除 Windows 游戏及 Steam Play 游戏容器。";+"Steam is running" = "Steam 正在运行";+"Steam is running, please close Steam." = "Steam 正在运行,请先关闭 Steam。";+"Steam is set up for NotProton, but this account is missing its components. Install to add them." = "Steam 已配置 NotProton,但当前账户缺少所需组件。请点击“安装”添加组件。";+"Steam is set up to inject a different dylib. Please repair Steam before installing NotProton." = "Steam 已配置为注入其他动态库。请先修复 Steam,再安装 NotProton。";+"Steam not found." = "未找到 Steam。";+"Steam restored to its original state." = "Steam 已恢复原状。";+"Steam was installed by another account on this Mac. Only that account can modify it. Log in to macOS with that account to reinstall NotProton." = "Steam 由这台 Mac 上的其他账户安装,只有该账户可以修改。请登录该账户,重新安装 NotProton。";+"Steam was stopped, so start it again." = "Steam 已停止,请重新启动。";+"Steam's installed dylib does not match this account's build record. Finish or repair its installation with the NotProton app that last installed it." = "Steam 中已安装的动态库与当前账户的版本记录不一致。请使用上次执行安装的 NotProton 应用完成或修复安装。";+"Stopping Steam" = "正在停止 Steam";+"Task Manager" = "任务管理器";+"Template cleanup incomplete" = "模板清理未完成";+"Templates {0}" = "模板 {0}";+"The Steam client will not update itself." = "Steam 客户端将不会自动更新。";+"The Valve file list {0}" = "Valve 文件列表:{0}";+"The bundled NotProton dylib is invalid." = "随附的 NotProton 动态库无效。";+"The cave" = "代码空隙";+"The cave is {0} bytes from the hook site, which a relative jump cannot reach." = "代码空隙距挂钩位置 {0} 字节,超出相对跳转指令的范围。";+"The clone has no Wine loader at {0}." = "副本的 {0} 处没有 Wine 加载器。";+"The cloned Wine loader at {0} does not match build {1}. Expected {2}, found {3}." = "复制到 {0} 的 Wine 加载器与构建版本 {1} 不匹配。预期为 {2},实际为 {3}。";+"The compatibility tool was not set up because CrossOver is not activated." = "CrossOver 尚未激活,因此未能设置兼容工具。";+"The component list has no entries." = "组件列表为空。";+"The detour is {0} bytes from the hook site, which a branch and link cannot reach." = "跳转补丁距挂钩位置 {0} 字节,超出分支链接指令的范围。";+"The game SAVE DATA inside the prefix WILL BE LOST." = "容器内的游戏存档将永久丢失!";+"The game SAVE DATA inside them WILL BE LOST." = "这些容器内的游戏存档将永久丢失!";+"The hook site" = "挂钩位置";+"The installed build record is invalid." = "已安装版本的记录无效。";+"The patched {0} ntdll has not been copied into place." = "修补后的 {0} ntdll 尚未复制到目标位置。";+"The patched {0} ntdll hashes {1} and build {2} expects {3}. Nothing was written." = "修补后的 {0} ntdll 哈希值为 {1},但构建版本 {2} 预期为 {3}。未写入任何内容。";+"The {0}" = "{0}";+"The {0} cave at {1} is not empty. This ntdll is either already patched or not the build its hash claimed." = "{0} 在 {1} 处的代码空隙非空。此 ntdll 可能已修补,或并非哈希值所对应的版本。";+"The {0} detour goes to {1}, below its cave at {2}, so writing it would land in live code." = "{0} 跳转目标为 {1},位于 {2} 处的代码空隙之前;写入会覆盖现有代码,已拒绝操作。";+"The {0} detour is {1} bytes and the cave holds {2}, so writing it would overrun into live code." = "{0} 跳转补丁有 {1} 字节,但代码空隙仅容纳 {2} 字节;写入会覆盖现有代码,已拒绝操作。";+"The {0} hook site at {1} holds {2} instead of {3}, so the offsets do not belong to this ntdll." = "{0} 在 {1} 处的挂钩位置内容为 {2},而非 {3},偏移量与此 ntdll 不匹配。";+"The {0} ntdll at {1} hashes {2} and build {3} expects {4}. It is already patched, or from another CrossOver build." = "{1} 处的 {0} ntdll 的哈希值为 {2},但构建版本 {3} 预期为 {4}。该文件可能已修补,或来自其他 CrossOver 版本。";+"The {0} ntdll file alignment {1} is not a power of two." = "{0} ntdll 的文件对齐值 {1} 不是 2 的幂。";+"The {0} ntdll has no PE header where its DOS stub points." = "{0} ntdll 的 DOS 存根所指向的位置没有 PE 头。";+"The {0} ntdll has no free section header slot for the detour." = "{0} ntdll 没有可供跳转补丁使用的空闲节头槽位。";+"The {0} ntdll image ends at {1}, and the detour section was pinned at {2}." = "{0} ntdll 映像结束于 {1},但跳转补丁节固定在 {2}。";+"The {0} ntdll is based at {1}, and the detour was linked against {2}." = "{0} ntdll 的基址为 {1},但跳转补丁链接时使用的基址为 {2}。";+"The {0} ntdll is machine {1}, expected {2}." = "{0} ntdll 的机器类型为 {1},预期为 {2}。";+"The {0} ntdll optional header is {1}, expected {2}." = "{0} ntdll 的可选头为 {1},预期为 {2}。";+"There is no ntdll to patch at {0}." = "{0} 处没有可修补的 ntdll。";+"These components are missing: {0}. Run make app-payload and build the app again." = "缺少以下组件:{0}。请运行 make app-payload,然后重新构建应用。";+"These files did not update: {0}." = "以下文件未能更新:{0}。";+"This app includes newer files than those installed for Steam." = "此应用包含的文件比 Steam 中已安装的文件更新。";+"This app includes updated files for Steam." = "此应用包含适用于 Steam 的更新文件。";+"This build of NotProton carries no components at all." = "此版本的 NotProton 未包含任何组件。";+"This can also fix issues where a game previously started/worked and does not work now, even if you did not switch CrossOver types." = "即使没有切换 CrossOver 类型,也可能修复游戏之前能运行、现在却无法运行的问题。";+"This copy of NotProton cannot repair Steam. Please reinstall NotProton." = "此 NotProton 副本无法修复 Steam。请重新安装 NotProton。";+"This tool is intended to repair a prefix after switching between Rosetta/FEX CrossOver." = "此工具用于修复在 Rosetta 与 FEX 版 CrossOver 之间切换后的游戏容器。";+"This will DELETE the game's prefix." = "此操作将删除该游戏的容器。";+"This will DELETE the prefixes for {0} games." = "此操作将删除 {0} 个游戏的容器。";+"This will restore Steam itself to its original state but does not remove the support components used by NotProton." = "此操作会将 Steam 恢复原状,但不会移除 NotProton 使用的支持组件。";+"Tool" = "兼容工具";+"Tools" = "工具";+"Unknown" = "未知";+"Unpacking" = "正在解包";+"Update" = "更新";+"Update available ({0})." = "有可用更新({0})。";+"Update available." = "有可用更新。";+"Update compatibility tools" = "更新兼容工具";+"Use the newer NotProton app to update or repair the installed files." = "请使用较新版的 NotProton 更新或修复已安装的文件。";+"Verify CrossOver" = "验证 CrossOver";+"Verify CrossOver license" = "验证 CrossOver 许可证";+"Verifying" = "正在验证";+"Version {0} not supported (supported: {1})" = "不支持版本 {0}(支持:{1})";+"Wine Configuration" = "Wine 配置";+"You will not lose saves by using this tool." = "使用此工具不会删除游戏存档。";+"a base and one URL" = "base 字段和一个 URL";+"a bundle, a filename, a sha256, an inner archive and a bundle name" = "bundle 字段、文件名、SHA-256 值、内部归档和应用包名称";+"a file, a bridge path, a package id, an inner path and a sha256" = "file 字段、桥接路径、软件包 ID、内部路径和 SHA-256 值";+"a package, an id, a filename and a sha256" = "package 字段、ID、文件名和 SHA-256 值";+"another version of CrossOver" = "其他版本的 CrossOver";+"declares a second bundle. One is the most that can be installed." = "声明了第二个应用包,但最多只能安装一个。";+"declares the package {0}, which no file row uses." = "声明的软件包 {0} 未被任何文件行使用。";+"does not end in a lowercase 64 character sha256: {0}" = "末尾不是 64 位小写 SHA-256 值:{0}";+"does not hold an https URL: {0}" = "不包含有效的 HTTPS URL:{0}";+"has an unknown row kind {0}. Known: base, package, file, bundle." = "包含未知行类型 {0}。已知类型:base、package、file、bundle。";+"hook site" = "挂钩位置";+"is not {0}: {1}" = "不符合格式“{0}”:{1}";+"macOS did not reset {0} for Steam." = "macOS 未能重置 Steam 的 {0} 权限。";+"names no CDN host to fetch from." = "未指定下载所需的 CDN 主机。";+"names no file." = "未指定任何文件。";+"names no package." = "未指定任何软件包。";+"repeats the bridge path {0}." = "重复声明了桥接路径 {0}。";+"repeats the package id {0}." = "重复声明了软件包 ID {0}。";+"{0} and {1} both come from {2} but pin different hashes." = "{0} 和 {1} 均来自 {2},但指定了不同的哈希值。";+"{0} at {1} spans {2} bytes, past the end of a {3} byte file." = "{1} 处的{0}占用 {2} 字节,超出了文件的 {3} 字节长度。";+"{0} backups" = "{0} 个备份";+"{0} carries no entitlements to extend." = "{0} 不包含可扩展的授权项。";+"{0} could not be copied out of the prefix. The prefix has been left as it was and nothing has been lost. Check free space and permissions, then try again." = "无法从容器中复制 {0}。容器保持原样,未丢失任何内容。请检查剩余空间和权限,然后重试。";+"{0} could not be read as a property list." = "无法将 {0} 读取为属性列表。";+"{0} could not be read. {1}" = "无法读取 {0}。{1}";+"{0} could not be signed. " = "无法对 {0} 签名。";+"{0} could not be written. " = "无法写入 {0}。";+"{0} did not contain {1}." = "{0} 中不包含 {1}。";+"{0} does not appear to have a prefix to back up." = "{0} 似乎没有可备份的游戏容器。";+"{0} does not verify against its own signature. " = "{0} 未通过自身签名验证。";+"{0} failed with status {1}." = "{0} 执行失败,状态码为 {1}。";+"{0} failed with status {1}: {2}" = "{0} 执行失败,状态码为 {1}:{2}";+"{0} has a broken signature" = "{0} 的签名损坏";+"{0} has no prefix at {1}." = "{0} 在 {1} 处没有游戏容器。";+"{0} is already listed." = "{0} 已在列表中。";+"{0} is left from a rebuild that did not finish and may hold the only copy of the saves. Move it somewhere safe, then try again." = "{0} 是上次未完成重建留下的文件,可能保存着唯一的游戏存档。请先将其移到安全位置,然后重试。";+"{0} is missing the dyld entitlement" = "{0} 缺少 dyld 授权项";+"{0} is not a Windows program. Pick an exe, msi, bat or cmd file." = "{0} 不是 Windows 程序。请选择 exe、msi、bat 或 cmd 文件。";+"{0} is not a supported build. Supported: {1}." = "不支持构建版本 {0}。支持的版本:{1}。";+"{0} is not a valid copy of CrossOver." = "{0} 不是有效的 CrossOver 应用。";+"{0} is not signed by Valve. Expected TeamIdentifier={1}." = "{0} 并非由 Valve 签名。预期 TeamIdentifier={1}。";+"{0} is not the Steam bundle. Expected Identifier={1}." = "{0} 不是 Steam 应用包。预期 Identifier={1}。";+"{0} is not there, so there is nothing to install into." = "{0} 不存在,无法安装。";+"{0} is running. Quit the game first." = "{0} 正在运行。请先退出游戏。";+"{0} names the package {1}, which is not declared. Declared: {2}." = "{0} 指定了未声明的软件包 {1}。已声明:{2}。";+"{0} templates {1}" = "{0} 模板 {1}";+"{0} was last run by {1}, which is no longer set up. Rebuild the prefix first." = "{0} 上次使用 {1} 运行,但该兼容工具已不可用。请先重建游戏容器。";+"{0} was re-signed without the dyld entitlement." = "{0} 重新签名后缺少 dyld 授权项。";+"{0}, {1} private size" = "{0},独占空间 {1}";+"{0}.bin could not be read. {1}" = "无法读取 {0}.bin。{1}";+"{0}.bin hashes {1} and should hash {2}, so the shipped detour is not the one that was built." = "{0}.bin 的哈希值为 {1},预期为 {2};附带的跳转补丁与构建结果不一致。";+"{0}.bin is missing from the app's resources." = "应用资源中缺少 {0}.bin。";+"{0}.{1} is missing from the app's resources." = "应用资源中缺少 {0}.{1}。";+"{0}/ntdll.dll is missing" = "缺少 {0}/ntdll.dll";+"{0}/ntdll.dll is missing from {1}." = "{1} 中缺少 {0}/ntdll.dll。";+"{0}/ntdll.dll is not the patched copy" = "{0}/ntdll.dll 不是已修补的副本";+"{0}/{1} is missing" = "缺少 {0}/{1}";+"{0}/{1} is not in the bridge. Install NotProton first." = "桥接组件中没有 {0}/{1}。请先安装 NotProton。";+"{0}/{1} is not the build {2} copy. Expected {3}, found {4}." = "{0}/{1} 不属于构建版本 {2}。预期为 {3},实际为 {4}。";+"{0}/{1} is out of date" = "{0}/{1} 已过期";diff --git a/app/Sources/NotProtonApp/Support/AtomicReplace.swift b/app/Sources/NotProtonApp/Support/AtomicReplace.swiftindex 8cbace4..eb02f72 100644--- a/app/Sources/NotProtonApp/Support/AtomicReplace.swift+++ b/app/Sources/NotProtonApp/Support/AtomicReplace.swift@@ -21,7 +21,7 @@ func atomicReplace(_ destination: URL, from source: URL, step: String) throws {let reason = String(cString: strerror(code))throw StepFailure(step: step,- detail: "Replacing \(destination.path(percentEncoded: false)) failed. \(reason)"+ detail: L10n.tr("Replacing \(destination.path(percentEncoded: false)) failed. \(reason)"))}}@@ -39,7 +39,7 @@ func atomicReplace(_ destination: URL, with data: Data, step: String) throws {} catch {throw StepFailure(step: step,- detail: "\(staging.path(percentEncoded: false)) could not be written. "+ detail: L10n.tr("\(staging.path(percentEncoded: false)) could not be written. ")+ error.localizedDescription)}@@ -51,7 +51,7 @@ func atomicReplace(_ destination: URL, with data: Data, step: String) throws {try? fm.removeItem(at: staging)throw StepFailure(step: step,- detail: "Replacing \(destination.path(percentEncoded: false)) failed. \(reason)"+ detail: L10n.tr("Replacing \(destination.path(percentEncoded: false)) failed. \(reason)"))}}diff --git a/app/Sources/NotProtonApp/Support/L10n.swift b/app/Sources/NotProtonApp/Support/L10n.swiftnew file mode 100644index 0000000..43656e6--- /dev/null+++ b/app/Sources/NotProtonApp/Support/L10n.swift@@ -0,0 +1,57 @@+import Foundation++// SwiftUI only localizes literals, so model strings go through here. The key is the English text with+// {0}, {1}... where values were interpolated.+enum L10n {+ struct Message: ExpressibleByStringLiteral, ExpressibleByStringInterpolation {+ let key: String+ let arguments: [String]++ init(stringLiteral value: String) {+ key = value+ arguments = []+ }++ init(stringInterpolation: StringInterpolation) {+ key = stringInterpolation.key+ arguments = stringInterpolation.arguments+ }++ struct StringInterpolation: StringInterpolationProtocol {+ var key = ""+ var arguments: [String] = []++ init(literalCapacity: Int, interpolationCount: Int) {+ key.reserveCapacity(literalCapacity)+ arguments.reserveCapacity(interpolationCount)+ }++ mutating func appendLiteral(_ literal: String) { key += literal }++ mutating func appendInterpolation<T>(_ value: T) {+ key += "{\(arguments.count)}"+ arguments.append(String(describing: value))+ }+ }+ }++ static func tr(_ message: Message, in bundle: Bundle = .module) -> String {+ render(bundle.localizedString(forKey: message.key, value: message.key, table: nil), arguments: message.arguments)+ }++ // One pass, so a value containing "{1}" is never substituted again.+ static func render(_ template: String, arguments: [String]) -> String {+ var result = ""+ var position = template.startIndex+ for match in template.matches(of: /\{([0-9]+)\}/) {+ result += template[position ..< match.range.lowerBound]+ if let index = Int(match.1), arguments.indices.contains(index) {+ result += arguments[index]+ } else {+ result += template[match.range]+ }+ position = match.range.upperBound+ }+ return result + template[position...]+ }+}diff --git a/app/Sources/NotProtonApp/Support/PinnedDownload.swift b/app/Sources/NotProtonApp/Support/PinnedDownload.swiftindex 02bb019..d53c9a2 100644--- a/app/Sources/NotProtonApp/Support/PinnedDownload.swift+++ b/app/Sources/NotProtonApp/Support/PinnedDownload.swift@@ -10,8 +10,8 @@ enum PinnedDownload {var label: String {switch self {- case .reusing: "Preparing"- case .fetching(let host): "Downloading from \(host)"+ case .reusing: L10n.tr("Preparing")+ case .fetching(let host): L10n.tr("Downloading from \(host)")}}}@@ -76,12 +76,11 @@ enum PinnedDownload {private static func reason(_ kinds: Set<Refusal>) -> String {if kinds == [.mismatch] {- return "Something is wrong with the downloaded files. Please check for a NotProton update."+ return L10n.tr("Something is wrong with the downloaded files. Please check for a NotProton update.")}if kinds == [.unreachable] {- return "NotProton could not reach Valve's servers. Please check your internet "- + "connection and try again."+ return L10n.tr("NotProton could not reach Valve's servers. Please check your internet connection and try again.")}- return "NotProton could not download the files it needs from Valve. Please try again later."+ return L10n.tr("NotProton could not download the files it needs from Valve. Please try again later.")}}diff --git a/app/Sources/NotProtonApp/Support/Shell.swift b/app/Sources/NotProtonApp/Support/Shell.swiftindex fd30585..768e796 100644--- a/app/Sources/NotProtonApp/Support/Shell.swift+++ b/app/Sources/NotProtonApp/Support/Shell.swift@@ -25,8 +25,8 @@ struct CommandFailure: LocalizedError {var errorDescription: String? {let detail = stderr.trimmingCharacters(in: .whitespacesAndNewlines)- if detail.isEmpty { return "\(command) failed with status \(status)." }- return "\(command) failed with status \(status): \(detail)"+ if detail.isEmpty { return L10n.tr("\(command) failed with status \(status).") }+ return L10n.tr("\(command) failed with status \(status): \(detail)")}}@@ -100,7 +100,7 @@ enum Shell {command: (executable as NSString).lastPathComponent,status: result.status,stderr: reason.isEmpty && result.outputLost- ? "Its output was still open when it exited, so none was captured."+ ? L10n.tr("Its output was still open when it exited, so none was captured."): reason)}diff --git a/app/Sources/NotProtonApp/Support/WriteRefused.swift b/app/Sources/NotProtonApp/Support/WriteRefused.swiftindex dab6526..b626377 100644--- a/app/Sources/NotProtonApp/Support/WriteRefused.swift+++ b/app/Sources/NotProtonApp/Support/WriteRefused.swift@@ -6,7 +6,7 @@ import Foundationstruct WriteRefused: LocalizedError {let path: String- var errorDescription: String? { "Could not write files." }+ var errorDescription: String? { L10n.tr("Could not write files.") }}extension WriteRefused {@@ -34,15 +34,14 @@ enum Remedy: Hashable {var advice: String {switch self {- case .appManagement: "NotProton needs the App Management permission."+ case .appManagement: L10n.tr("NotProton needs the App Management permission.")case .otherAccount:- "Steam was installed by another account on this Mac. Only that account can modify it. "- + "Log in to macOS with that account to reinstall NotProton."- case .ownership: "Check permissions, make sure your user owns the folder."+ L10n.tr("Steam was installed by another account on this Mac. Only that account can modify it. Log in to macOS with that account to reinstall NotProton.")+ case .ownership: L10n.tr("Check permissions, make sure your user owns the folder.")}}- static let settingsButton = "Open System Settings"+ static let settingsButton = L10n.tr("Open System Settings")private static let appManagementPane ="x-apple.systempreferences:com.apple.settings.PrivacySecurity.extension?Privacy_AppBundles"diff --git a/app/Sources/NotProtonApp/SystemStatus.swift b/app/Sources/NotProtonApp/SystemStatus.swiftindex 0a5d543..a901ad4 100644--- a/app/Sources/NotProtonApp/SystemStatus.swift+++ b/app/Sources/NotProtonApp/SystemStatus.swift@@ -247,7 +247,7 @@ final class SystemStatus {let changed = try await Task.detached(priority: .userInitiated) {try RunnerInstaller.removeClone(forBuild: build)}.value- let removed = "Removed build \(SupportedRunners.displayVersion(forID: build))."+ let removed = L10n.tr("Removed build \(SupportedRunners.displayVersion(forID: build)).")return changed && SteamBundle.isRunning ? "\(removed) \(Self.toolsRestartHint)" : removed}}@@ -258,8 +258,8 @@ final class SystemStatus {panel.canChooseDirectories = falsepanel.allowsMultipleSelection = falsepanel.allowedContentTypes = [.application]- panel.prompt = "Add"- panel.message = "Select a copy of CrossOver."+ panel.prompt = L10n.tr("Add")+ panel.message = L10n.tr("Select a copy of CrossOver.")panel.directoryURL = URL(filePath: "/Applications", directoryHint: .isDirectory)guard panel.runModal() == .OK, let picked = panel.url else { return }@@ -268,7 +268,7 @@ final class SystemStatus {outcome = nilguard CrossOverSource.looksLikeCrossOver(picked) else {- setFailure("\(picked.lastPathComponent) is not a valid copy of CrossOver.")+ setFailure(L10n.tr("\(picked.lastPathComponent) is not a valid copy of CrossOver."))AppLog.note("crossOver choice refused: \(picked.path(percentEncoded: false))")return}@@ -285,7 +285,7 @@ final class SystemStatus {}private func highlight(_ row: CrossOverRow) {- AccessibilityNotification.Announcement("\(row.title) is already listed.").post()+ AccessibilityNotification.Announcement(L10n.tr("\(row.title) is already listed.")).post()highlightReset?.cancel()highlightedRow = row.idhighlightReset = Task { [weak self] in@@ -304,12 +304,12 @@ final class SystemStatus {await refresh()}- private static let toolsRestartHint = "Restart Steam to update its list of compatibility tools."+ private static let toolsRestartHint = L10n.tr("Restart Steam to update its list of compatibility tools.")private func runnerOutcome(_ result: RunnerSetup.Outcome) -> String {- if result.stagedNothing { return "Compatibility tool is already set up." }- guard result.toolsChanged, SteamBundle.isRunning else { return "Compatibility tool ready." }- return "Compatibility tool ready. \(Self.toolsRestartHint)"+ if result.stagedNothing { return L10n.tr("Compatibility tool is already set up.") }+ guard result.toolsChanged, SteamBundle.isRunning else { return L10n.tr("Compatibility tool ready.") }+ return L10n.tr("Compatibility tool ready. \(Self.toolsRestartHint)")}func perform(@@ -341,7 +341,7 @@ final class SystemStatus {private func setUpRunner(from install: CrossOverInstall?, replacingExisting: Bool = false) async {guard let install else {- setFailure("No supported copy of CrossOver found.")+ setFailure(L10n.tr("No supported copy of CrossOver found."))AppLog.note("run refused: no supported CrossOver")outcome = nilreturn@@ -368,14 +368,14 @@ final class SystemStatus {defer { FileLock.release(lock) }try await requireInstallableContent()let result = try await ValveFetcher.run { progress($0.label) }- return result.wroteNothing ? nil : "Downloaded missing components."+ return result.wroteNothing ? nil : L10n.tr("Downloaded missing components.")}}- private static let restartHint = "Steam was stopped, so start it again."+ private static let restartHint = L10n.tr("Steam was stopped, so start it again.")private static let toolNotActivated =- "The compatibility tool was not set up because CrossOver is not activated."+ L10n.tr("The compatibility tool was not set up because CrossOver is not activated.")private func requireInstallableContent() async throws {try await requireUnblockedContent()@@ -385,7 +385,7 @@ final class SystemStatus {}}.valueguard !running else {- throw StepFailure(step: SteamInstaller.step, detail: "A game or Wine tool is running. Quit it before updating NotProton.")+ throw StepFailure(step: SteamInstaller.step, detail: L10n.tr("A game or Wine tool is running. Quit it before updating NotProton."))}}@@ -397,7 +397,7 @@ final class SystemStatus {snapshot?.installContent = contentguard !content.blocksInstallation else {throw StepFailure(step: SteamInstaller.step,- detail: "Installation is blocked. Refresh Status and use the NotProton app that installed this build.")+ detail: L10n.tr("Installation is blocked. Refresh Status and use the NotProton app that installed this build."))}}@@ -409,7 +409,7 @@ final class SystemStatus {try SteamInstaller.run(holdingInstallationLock: true, report: { progress($0.label) })}.value- var parts = ["NotProton successfully installed."]+ var parts = [L10n.tr("NotProton successfully installed.")]if result.stoppedClient { parts.append(Self.restartHint) }let install = usableCrossOverlet state = await Task.detached(priority: .userInitiated) {@@ -419,7 +419,7 @@ final class SystemStatus {}.valueif let install, state.license?.licensed == true, state.runner == .none {- progress("Setting up compatibility tool")+ progress(L10n.tr("Setting up compatibility tool"))// A tool that came up is the expected case and goes unsaid. Failure// throws, and an unactivated CrossOver is reported below._ = try await Task.detached(priority: .userInitiated) {@@ -436,7 +436,7 @@ final class SystemStatus {valve.files.contains { Digest.sha256IfPresent(SupportPaths.bridge.appending(path: $0.bridgePath)) != $0.sha256 }}.valueif needsValve {- progress("Downloading missing components")+ progress(L10n.tr("Downloading missing components"))_ = try await ValveFetcher.run { progress($0.label) }}@@ -449,15 +449,15 @@ final class SystemStatus {}func setUpdateBlock(_ blocked: Bool) async {- await perform(from: blocked ? "Blocking Steam client updates"- : "Allowing Steam client updates") { _ in+ await perform(from: blocked ? L10n.tr("Blocking Steam client updates")+ : L10n.tr("Allowing Steam client updates")) { _ inif blocked {try UpdateBlock.write()- return "Steam client updates are blocked."+ return L10n.tr("Steam client updates are blocked.")}try UpdateBlock.remove()- return "Steam client updates are allowed."+ return L10n.tr("Steam client updates are allowed.")}}@@ -467,24 +467,24 @@ final class SystemStatus {defer { FileLock.release(lock) }let result = try await SteamRepair.run { progress($0.label) }- var parts = ["Steam restored to its original state."]+ var parts = [L10n.tr("Steam restored to its original state.")]if result.stoppedClient { parts.append(Self.restartHint) }return parts.joined(separator: " ")}}func resetControllerPermission() async {- await perform(from: "Resetting Steam's controller permission") { _ in+ await perform(from: L10n.tr("Resetting Steam's controller permission")) { _ inlet failed = SteamInstaller.failedInputAccessResets()guard failed.isEmpty else {throw StepFailure(- step: "Reset controller permission",- detail: "macOS did not reset \(failed.joined(separator: ", ")) for Steam."+ step: L10n.tr("Reset controller permission"),+ detail: L10n.tr("macOS did not reset \(failed.joined(separator: ", ")) for Steam."))}return SteamBundle.isRunning- ? "Controller permission reset. Restart Steam so macOS asks again."- : "Controller permission reset. macOS asks again when Steam starts."+ ? L10n.tr("Controller permission reset. Restart Steam so macOS asks again.")+ : L10n.tr("Controller permission reset. macOS asks again when Steam starts.")}}@@ -495,9 +495,8 @@ final class SystemStatus {let result = try await Uninstall.run { progress($0.label) }return result.steamNeedsRedownload- ? "NotProton has been removed. Steam could not be restored. "- + "Reinstall Steam from steampowered.com before using it again."- : "NotProton has been removed."+ ? L10n.tr("NotProton has been removed. Steam could not be restored. Reinstall Steam from steampowered.com before using it again.")+ : L10n.tr("NotProton has been removed.")}}diff --git a/app/Sources/NotProtonApp/Views/BackupsView.swift b/app/Sources/NotProtonApp/Views/BackupsView.swiftindex 37819e9..7ee1553 100644--- a/app/Sources/NotProtonApp/Views/BackupsView.swift+++ b/app/Sources/NotProtonApp/Views/BackupsView.swift@@ -8,11 +8,11 @@ struct BackupsView: View {var body: some View {Group {if !model.hasLoaded {- ProgressView("Looking for backups")+ ProgressView(L10n.tr("Looking for backups")).frame(maxWidth: .infinity, maxHeight: .infinity)} else if model.backups.isEmpty {ContentUnavailableView(- "No Backups",+ L10n.tr("No Backups"),systemImage: "externaldrive.badge.timemachine").frame(maxWidth: .infinity, maxHeight: .infinity)@@ -20,13 +20,13 @@ struct BackupsView: View {table}}- .navigationTitle("Prefix Backups")+ .navigationTitle(L10n.tr("Prefix Backups")).navigationSubtitle(summary).safeAreaInset(edge: .bottom) {if let failed = model.report {report(StatusRow(- title: "Failed",+ title: L10n.tr("Failed"),value: failed.message,tone: .bad,action: failed.settingsPane.map { pane in@@ -35,7 +35,7 @@ struct BackupsView: View {))} else if let outcome = model.outcome {- report(StatusRow(title: "Done", value: outcome, tone: .ok))+ report(StatusRow(title: L10n.tr("Done"), value: outcome, tone: .ok))}}.toolbar {@@ -60,7 +60,7 @@ struct BackupsView: View {model.pendingConfirmation = nilTask { await model.deleteBackups(targets) }}- Button("Cancel", role: .cancel) { model.pendingConfirmation = nil }+ Button(L10n.tr("Cancel"), role: .cancel) { model.pendingConfirmation = nil }.keyboardShortcut(.defaultAction)} message: {Text(PrefixPrompt.deleteBackupsMessage(clearing))@@ -70,8 +70,8 @@ struct BackupsView: View {private var summary: String {guard !model.backups.isEmpty else { return "" }let size = model.backupBytes.formatted(.byteCount(style: .file))- let count = model.backups.count == 1 ? "1 backup" : "\(model.backups.count) backups"- return "\(count), \(size) private size"+ let count = model.backups.count == 1 ? L10n.tr("1 backup") : L10n.tr("\(model.backups.count) backups")+ return L10n.tr("\(count), \(size) private size")}private var selected: [PrefixBackup] {@@ -99,29 +99,29 @@ struct BackupsView: View {@ViewBuilderprivate var strip: some View {- Button("Reveal in Finder", systemImage: "folder") {+ Button(L10n.tr("Reveal in Finder"), systemImage: "folder") {if let backup = selected.first, selected.count == 1 { model.reveal(backup) }}.disabled(selected.count != 1)- .help("Show the selected backup in the Finder.")+ .help(L10n.tr("Show the selected backup in the Finder."))- Button("Delete", systemImage: "trash") {+ Button(L10n.tr("Delete"), systemImage: "trash") {ask(selected)}.disabled(selected.isEmpty || model.isLoading)- .help("Delete the selected backups.")+ .help(L10n.tr("Delete the selected backups."))- Button("Delete All", systemImage: "externaldrive.badge.minus") {+ Button(L10n.tr("Delete All"), systemImage: "externaldrive.badge.minus") {ask(model.backups)}.disabled(model.backups.isEmpty || model.isLoading)- .help("Delete every backup that rebuilds have kept.")+ .help(L10n.tr("Delete every backup that rebuilds have kept."))- Button("Refresh", systemImage: "arrow.clockwise") {+ Button(L10n.tr("Refresh"), systemImage: "arrow.clockwise") {Task { await model.load() }}.disabled(model.isLoading)- .help("List the backups again and update their sizes.")+ .help(L10n.tr("List the backups again and update their sizes."))}private var gameWidth: CGFloat {@@ -138,31 +138,31 @@ struct BackupsView: View {private var table: some View {Table(model.backups, selection: $selection) {- TableColumn("Game") { backup in+ TableColumn(L10n.tr("Game")) { backup inText(backup.title).help(backup.title)}.width(min: 60, ideal: gameWidth)- TableColumn("App ID") { backup in+ TableColumn(L10n.tr("App ID")) { backup inText(backup.prefix.appID).monospacedDigit().foregroundStyle(.secondary)}.width(min: 50, ideal: 80)- TableColumn("Library") { backup in+ TableColumn(L10n.tr("Library")) { backup inText(backup.prefix.library.displayName).foregroundStyle(.secondary).help(backup.prefix.library.displayName)}.width(min: 44, ideal: libraryWidth)- TableColumn("Private Size") { backup in+ TableColumn(L10n.tr("Private Size")) { backup inText(backup.bytes.formatted(.byteCount(style: .file))).monospacedDigit().foregroundStyle(.secondary)}.width(min: 56, ideal: 90)- TableColumn("Backed up") { backup in+ TableColumn(L10n.tr("Backed up")) { backup inText(taken(backup)).foregroundStyle(.secondary).help(taken(backup))@@ -182,7 +182,7 @@ struct BackupsView: View {let targets = model.backups.filter { ids.contains($0.id) }Group {if targets.count == 1, let backup = targets.first {- Button("Reveal in Finder") { model.reveal(backup) }+ Button(L10n.tr("Reveal in Finder")) { model.reveal(backup) }Divider()}if !targets.isEmpty {@@ -195,7 +195,7 @@ struct BackupsView: View {}private func taken(_ backup: PrefixBackup) -> String {- guard let taken = backup.taken else { return "Unknown" }+ guard let taken = backup.taken else { return L10n.tr("Unknown") }return taken.formatted(date: .abbreviated, time: .shortened)}diff --git a/app/Sources/NotProtonApp/Views/PrefixesView.swift b/app/Sources/NotProtonApp/Views/PrefixesView.swiftindex 45d6b0e..1163320 100644--- a/app/Sources/NotProtonApp/Views/PrefixesView.swift+++ b/app/Sources/NotProtonApp/Views/PrefixesView.swift@@ -11,14 +11,14 @@ struct PrefixesView: View {var body: some View {Group {if !model.hasLoaded {- ProgressView("Looking for prefixes")+ ProgressView(L10n.tr("Looking for prefixes")).frame(maxWidth: .infinity, maxHeight: .infinity)} else if model.prefixes.isEmpty {ContentUnavailableView(- "No Prefixes",+ L10n.tr("No Prefixes"),systemImage: "externaldrive",description: Text(- "A prefix appears here once a Windows game has been launched through NotProton."+ L10n.tr("A prefix appears here once a Windows game has been launched through NotProton."))).frame(maxWidth: .infinity, maxHeight: .infinity)@@ -26,12 +26,12 @@ struct PrefixesView: View {table}}- .navigationTitle("Prefixes")+ .navigationTitle(L10n.tr("Prefixes")).safeAreaInset(edge: .bottom) {if let failed = model.report {report(StatusRow(- title: "Failed",+ title: L10n.tr("Failed"),value: failed.message,tone: .bad,action: failed.settingsPane.map { pane in@@ -42,7 +42,7 @@ struct PrefixesView: View {} else if let outcome = model.outcome {report(StatusRow(- title: "Done",+ title: L10n.tr("Done"),value: outcome,tone: .ok)@@ -68,7 +68,7 @@ struct PrefixesView: View {model.pendingConfirmation = nilTask { await model.delete(targets) }}- Button("Cancel", role: .cancel) { model.pendingConfirmation = nil }+ Button(L10n.tr("Cancel"), role: .cancel) { model.pendingConfirmation = nil }.keyboardShortcut(.defaultAction)} message: {Text(PrefixPrompt.deleteMessage(deleting))@@ -85,7 +85,7 @@ struct PrefixesView: View {Button(PrefixPrompt.rebuildWithoutBackupButton(rebuilding)) {model.confirmRebuild(keepBackup: false)}- Button("Cancel", role: .cancel) { model.pendingConfirmation = nil }+ Button(L10n.tr("Cancel"), role: .cancel) { model.pendingConfirmation = nil }} message: {Text(PrefixPrompt.rebuildMessage())}@@ -100,7 +100,7 @@ struct PrefixesView: View {Task { await model.backUp(targets) }}.keyboardShortcut(.defaultAction)- Button("Cancel", role: .cancel) { model.pendingConfirmation = nil }+ Button(L10n.tr("Cancel"), role: .cancel) { model.pendingConfirmation = nil }} message: {Text(PrefixPrompt.backUpMessage(backingUp))}@@ -153,26 +153,26 @@ struct PrefixesView: View {Menu {toolButtons(for: model.selectedPrefix)} label: {- Label("Tools", systemImage: "wrench.and.screwdriver")+ Label(L10n.tr("Tools"), systemImage: "wrench.and.screwdriver")}.disabled(model.selectedPrefix == nil || model.isBusy)- .help("Run a program or open a Wine tool in the selected prefix.")+ .help(L10n.tr("Run a program or open a Wine tool in the selected prefix."))- Button("Reveal in Finder", systemImage: "folder") {+ Button(L10n.tr("Reveal in Finder"), systemImage: "folder") {if let prefix = model.selectedPrefix { model.reveal(prefix) }}.disabled(model.selectedPrefix == nil)- .help("Show the selected prefix in the Finder.")+ .help(L10n.tr("Show the selected prefix in the Finder."))- Button("Refresh", systemImage: "arrow.clockwise") {+ Button(L10n.tr("Refresh"), systemImage: "arrow.clockwise") {Task { await model.load() }}.disabled(model.isLoading)- .help("List the prefixes again and update their sizes.")+ .help(L10n.tr("List the prefixes again and update their sizes."))}private func lastUsed(_ prefix: WinePrefix) -> String {- prefix.lastUsed?.formatted(date: .abbreviated, time: .omitted) ?? "Never"+ prefix.lastUsed?.formatted(date: .abbreviated, time: .omitted) ?? L10n.tr("Never")}private var libraryWidth: CGFloat {@@ -192,7 +192,7 @@ struct PrefixesView: View {var width = TextWidth.of(prefix.title)if model.isStale(prefix) { width += 22 }if prefix.name == nil {- width += TextWidth.of("No longer installed", size: NSFont.smallSystemFontSize) + 6+ width += TextWidth.of(L10n.tr("No longer installed"), size: NSFont.smallSystemFontSize) + 6}return width}@@ -230,7 +230,7 @@ struct PrefixesView: View {private var table: some View {@Bindable var model = modelreturn Table(rows, selection: $model.selection, sortOrder: $sortOrder) {- TableColumn("Game", value: \.title) { row in+ TableColumn(L10n.tr("Game"), value: \.title) { row inlet prefix = row.prefixHStack(spacing: 6) {if model.isStale(prefix) {@@ -244,11 +244,11 @@ struct PrefixesView: View {.menuIndicator(.hidden).fixedSize().disabled(model.isBusy || model.tools.isEmpty)- .accessibilityLabel("Needs rebuilding")+ .accessibilityLabel(L10n.tr("Needs rebuilding"))}Text(prefix.title).help(prefix.title)if prefix.name == nil {- Text("No longer installed")+ Text(L10n.tr("No longer installed")).font(.caption).foregroundStyle(.secondary)}@@ -259,42 +259,42 @@ struct PrefixesView: View {}.width(min: 60, ideal: gameWidth)- TableColumn("Tool", value: \.tool) { row in+ TableColumn(L10n.tr("Tool"), value: \.tool) { row inlet prefix = row.prefixif let tool = model.lastTool(prefix) {Text(tool).foregroundStyle(.secondary).help(tool)} else {- Text("None")+ Text(L10n.tr("None")).foregroundStyle(contrast == .increased ? .secondary : .tertiary)}}.width(min: 60, ideal: toolWidth)- TableColumn("App ID", value: \.appID) { row in+ TableColumn(L10n.tr("App ID"), value: \.appID) { row inText(row.prefix.appID).monospacedDigit().foregroundStyle(.secondary)}.width(min: 50, ideal: 80)- TableColumn("Library", value: \.library) { row in+ TableColumn(L10n.tr("Library"), value: \.library) { row inText(row.library).foregroundStyle(.secondary).help(row.library)}.width(min: 44, ideal: libraryWidth)- TableColumn("Private Size", value: \.size) { row in+ TableColumn(L10n.tr("Private Size"), value: \.size) { row inif let usage = model.usage[row.id] {Text(usage.bytes.formatted(.byteCount(style: .file))).monospacedDigit().foregroundStyle(.secondary)} else {- Text("Calculating…")+ Text(L10n.tr("Calculating…")).foregroundStyle(contrast == .increased ? .secondary : .tertiary)}}.width(min: 56, ideal: 90)- TableColumn("Last used", value: \.lastUsed) { row in+ TableColumn(L10n.tr("Last used"), value: \.lastUsed) { row inText(lastUsed(row.prefix)).foregroundStyle(.secondary).help(lastUsed(row.prefix))@@ -320,7 +320,7 @@ struct PrefixesView: View {if let prefix = single(ids) {toolButtons(for: prefix)Divider()- Button("Reveal in Finder") { model.reveal(prefix) }+ Button(L10n.tr("Reveal in Finder")) { model.reveal(prefix) }}if !targets.isEmpty {Divider()@@ -351,7 +351,7 @@ struct PrefixesView: View {@ViewBuilderprivate func toolButtons(for prefix: WinePrefix?) -> some View {- Button("Run Program…") {+ Button(L10n.tr("Run Program…")) {if let prefix { model.chooseExecutable(for: prefix) }}Divider()diff --git a/app/Sources/NotProtonApp/Views/RootView.swift b/app/Sources/NotProtonApp/Views/RootView.swiftindex 51ef6d1..e8d79e7 100644--- a/app/Sources/NotProtonApp/Views/RootView.swift+++ b/app/Sources/NotProtonApp/Views/RootView.swift@@ -9,9 +9,9 @@ enum Pane: String, CaseIterable, Identifiable, Hashable {var label: String {switch self {- case .status: "Status"- case .prefixes: "Prefixes"- case .backups: "Prefix Backups"+ case .status: L10n.tr("Status")+ case .prefixes: L10n.tr("Prefixes")+ case .backups: L10n.tr("Prefix Backups")}}diff --git a/app/Sources/NotProtonApp/Views/StatusView.swift b/app/Sources/NotProtonApp/Views/StatusView.swiftindex ff800d6..7d5292d 100644--- a/app/Sources/NotProtonApp/Views/StatusView.swift+++ b/app/Sources/NotProtonApp/Views/StatusView.swift@@ -116,15 +116,15 @@ struct StatusRow: View {Menu {menuItems(menu, hidingUnavailable: false)} label: {- Label("More", systemImage: "ellipsis")+ Label(L10n.tr("More"), systemImage: "ellipsis").labelStyle(.iconOnly)}.menuStyle(.button).buttonStyle(.bordered).menuIndicator(.hidden).fixedSize()- .help("More actions")- .accessibilityLabel("More actions, \(title)")+ .help(L10n.tr("More actions"))+ .accessibilityLabel(L10n.tr("More actions, \(title)")).padding(.leading, action == nil ? 0 : 8)}}@@ -162,21 +162,18 @@ struct StatusView: View {@Environment(SystemStatus.self) private var statusprivate static let updateBlockPrompt =- "Steam client updates may break NotProton. If you don't want to wait for "- + "NotProton to be updated to be compatible with future Steam versions at the "- + "cost of not getting updates to the Steam client, you can stop the Steam "- + "client from updating itself."+ L10n.tr("Steam client updates may break NotProton. If you don't want to wait for NotProton to be updated to be compatible with future Steam versions at the cost of not getting updates to the Steam client, you can stop the Steam client from updating itself.")var body: some View {Group {if let snapshot = status.snapshot {statusForm(snapshot)} else {- ProgressView("Checking")+ ProgressView(L10n.tr("Checking")).frame(maxWidth: .infinity, maxHeight: .infinity)}}- .navigationTitle("Status")+ .navigationTitle(L10n.tr("Status")).toolbar {if #available(macOS 26.1, *) {ToolbarItem(placement: .primaryAction) { refreshButton }@@ -186,60 +183,57 @@ struct StatusView: View {}}.confirmationDialog(- "Block Steam client updates?",+ L10n.tr("Block Steam client updates?"),isPresented: asking(.blockUpdates),titleVisibility: .visible) {- Button("Block Updates", role: .destructive) {+ Button(L10n.tr("Block Updates"), role: .destructive) {Task { await status.setUpdateBlock(true) }}- Button("Cancel", role: .cancel) {}+ Button(L10n.tr("Cancel"), role: .cancel) {}} message: {Text(Self.updateBlockPrompt)}.confirmationDialog(- "Replace Steam with Valve's bundle?",+ L10n.tr("Replace Steam with Valve's bundle?"),isPresented: asking(.replaceSteam),titleVisibility: .visible) {- Button("Replace Steam", role: .destructive) {+ Button(L10n.tr("Replace Steam"), role: .destructive) {Task { await status.repairSteam() }}- Button("Cancel", role: .cancel) {}+ Button(L10n.tr("Cancel"), role: .cancel) {}} message: {Text(- "This will restore Steam itself to its original state but does not remove "- + "the support components used by NotProton."+ L10n.tr("This will restore Steam itself to its original state but does not remove the support components used by NotProton."))}.confirmationDialog(status.pendingRemoval.map {- "Remove the \(SupportedRunners.displayVersion(forID: $0)) copy?"+ L10n.tr("Remove the \(SupportedRunners.displayVersion(forID: $0)) copy?")} ?? "",isPresented: asking(.removeBuild),titleVisibility: .visible) {- Button("Remove Copy", role: .destructive) {+ Button(L10n.tr("Remove Copy"), role: .destructive) {Task { await status.removePendingBuild() }}- Button("Cancel", role: .cancel) { status.cancelBuildRemoval() }+ Button(L10n.tr("Cancel"), role: .cancel) { status.cancelBuildRemoval() }} message: {- Text("CrossOver itself is not removed.")+ Text(L10n.tr("CrossOver itself is not removed."))}.confirmationDialog(- "Remove everything NotProton has created?",+ L10n.tr("Remove everything NotProton has created?"),isPresented: asking(.removeEverything),titleVisibility: .visible) {- Button("Remove Everything", role: .destructive) {+ Button(L10n.tr("Remove Everything"), role: .destructive) {Task { await status.removeEverything() }}- Button("Cancel", role: .cancel) {}+ Button(L10n.tr("Cancel"), role: .cancel) {}} message: {Text(- "Steam is restored to its unmodified state and NotProton is removed, including "- + "the compatibility tool that lives inside the Steam folder. Windows games "- + "and Steam Play prefixes are not removed."+ L10n.tr("Steam is restored to its unmodified state and NotProton is removed, including the compatibility tool that lives inside the Steam folder. Windows games and Steam Play prefixes are not removed."))}.confirmationDialog(@@ -247,15 +241,14 @@ struct StatusView: View {isPresented: asking(.installUnlicensed),titleVisibility: .visible) {- Button("Continue Anyway") {+ Button(L10n.tr("Continue Anyway")) {Task { await status.installIntoSteam() }}- Button("Cancel", role: .cancel) {}+ Button(L10n.tr("Cancel"), role: .cancel) {}} message: {Text(CrossOverLicense.notActivatedAdvice- + " NotProton can be deployed, but the CrossOver compatibility tool "- + "cannot be installed without a valid license."+ + L10n.tr(" NotProton can be deployed, but the CrossOver compatibility tool cannot be installed without a valid license."))}.task { if status.snapshot == nil { await status.refresh() } }@@ -264,7 +257,7 @@ struct StatusView: View {isPresented: asking(.toolUnlicensed),titleVisibility: .visible) {- Button("OK", role: .cancel) {}+ Button(L10n.tr("OK"), role: .cancel) {}} message: {Text(CrossOverLicense.notActivatedAdvice)}@@ -295,7 +288,7 @@ struct StatusView: View {Form {if let failure = status.failure {StatusRow(- title: "Failed",+ title: L10n.tr("Failed"),value: failure,tone: .bad,action: status.failureRemedy?.settingsPane.map { pane in@@ -305,11 +298,11 @@ struct StatusView: View {})} else if let outcome = status.outcome {- StatusRow(title: "Done", value: outcome, tone: .ok)+ StatusRow(title: L10n.tr("Done"), value: outcome, tone: .ok)}if let failure = status.templateCleanupFailure {- StatusRow(title: "Template cleanup incomplete", value: failure, tone: .warning)+ StatusRow(title: L10n.tr("Template cleanup incomplete"), value: failure, tone: .warning)}if let activity = status.activity {@@ -325,17 +318,17 @@ struct StatusView: View {steamRow(snapshot.steam, payload: snapshot.payload)if snapshot.steamRunning {StatusRow(- title: "Steam is running",- value: "Close Steam before continuing.",+ title: L10n.tr("Steam is running"),+ value: L10n.tr("Close Steam before continuing."),tone: .info)}updateBlockRow(snapshot.updateBlocked)StatusRow(- title: "Controller permission",- value: "Clear Steam's controller permission so macOS asks for it again.",+ title: L10n.tr("Controller permission"),+ value: L10n.tr("Clear Steam's controller permission so macOS asks for it again."),action: StatusAction(- label: "Reset",+ label: L10n.tr("Reset"),isEnabled: status.isIdle) { Task { await status.resetControllerPermission() } })@@ -348,9 +341,9 @@ struct StatusView: View {} footer: {HStack {Spacer()- Button("Add CrossOver\u{2026}") { Task { await status.addCrossOver() } }+ Button(L10n.tr("Add CrossOver\u{2026}")) { Task { await status.addCrossOver() } }.disabled(!status.isIdle)- .help("Add a copy of CrossOver from another folder.")+ .help(L10n.tr("Add a copy of CrossOver from another folder."))}}@@ -364,19 +357,19 @@ struct StatusView: View {private var dangerSection: some View {Section {StatusRow(- title: "Repair Steam",- value: "Restore Steam to its original state.",+ title: L10n.tr("Repair Steam"),+ value: L10n.tr("Restore Steam to its original state."),action: StatusAction(- label: "Repair",+ label: L10n.tr("Repair"),role: .destructive,isEnabled: status.isIdle) { status.pendingConfirmation = .replaceSteam })StatusRow(- title: "Remove Everything",- value: "Remove NotProton and restore Steam to its original state.",+ title: L10n.tr("Remove Everything"),+ value: L10n.tr("Remove NotProton and restore Steam to its original state."),action: StatusAction(- label: "Remove",+ label: L10n.tr("Remove"),role: .destructive,isEnabled: status.isIdle) { status.pendingConfirmation = .removeEverything }@@ -385,17 +378,17 @@ struct StatusView: View {}private var refreshButton: some View {- Button("Refresh", systemImage: "arrow.clockwise") {+ Button(L10n.tr("Refresh"), systemImage: "arrow.clockwise") {Task { await status.refresh() }}.disabled(!status.isIdle)}- private func installAction(prominent: Bool, label: String = "Install") -> StatusAction {+ private func installAction(prominent: Bool, label: String = L10n.tr("Install")) -> StatusAction {StatusAction(label: label,isProminent: prominent,- help: "Install NotProton into Steam.",+ help: L10n.tr("Install NotProton into Steam."),isEnabled: status.canInstall) {Task { await status.requestInstall() }@@ -433,24 +426,24 @@ struct StatusView: View {}deploymentRow(.installed(version: version), payload: payload)case .newerInstalled:- StatusRow(title: "NotProton", value: "A newer build is installed.", tone: .neutral,- detail: "Use the newer NotProton app to update or repair the installed files.")+ StatusRow(title: "NotProton", value: L10n.tr("A newer build is installed."), tone: .neutral,+ detail: L10n.tr("Use the newer NotProton app to update or repair the installed files."))case .unavailable(let reason):- StatusRow(title: "NotProton", value: "Could not check installed files.", tone: .warning, detail: reason)+ StatusRow(title: "NotProton", value: L10n.tr("Could not check installed files."), tone: .warning, detail: reason)case .update(let files):- StatusRow(title: "NotProton", value: "Update available.", tone: .warning,- detail: "This app includes newer files than those installed for Steam.",- action: installAction(prominent: true, label: "Update"))+ StatusRow(title: "NotProton", value: L10n.tr("Update available."), tone: .warning,+ detail: L10n.tr("This app includes newer files than those installed for Steam."),+ action: installAction(prominent: true, label: L10n.tr("Update"))).help(files.joined(separator: "\n"))case .repair(let files):- StatusRow(title: "NotProton", value: "Installed files differ from this build.", tone: .warning,- detail: "Restore the files included with this app.",- action: installAction(prominent: true, label: "Repair"))+ StatusRow(title: "NotProton", value: L10n.tr("Installed files differ from this build."), tone: .warning,+ detail: L10n.tr("Restore the files included with this app."),+ action: installAction(prominent: true, label: L10n.tr("Repair"))).help(files.joined(separator: "\n"))case .unrecorded(let files):- StatusRow(title: "NotProton", value: "Update available.", tone: .warning,- detail: "This app includes updated files for Steam.",- action: installAction(prominent: true, label: "Update"))+ StatusRow(title: "NotProton", value: L10n.tr("Update available."), tone: .warning,+ detail: L10n.tr("This app includes updated files for Steam."),+ action: installAction(prominent: true, label: L10n.tr("Update"))).help(files.joined(separator: "\n"))}}@@ -459,11 +452,11 @@ struct StatusView: View {private func deploymentRow(_ deployment: SteamDeployment, payload: PayloadState) -> some View {switch deployment {case .steamMissing:- StatusRow(title: "NotProton", value: "Steam not found.", tone: .bad)+ StatusRow(title: "NotProton", value: L10n.tr("Steam not found."), tone: .bad)case .notInstalled:StatusRow(title: "NotProton",- value: "Not installed.",+ value: L10n.tr("Not installed."),tone: .neutral,action: installAction(prominent: true))@@ -471,46 +464,45 @@ struct StatusView: View {if payload.isComplete {StatusRow(title: "NotProton",- value: "Installed" + (version.map { " (\($0))" } ?? ""),+ value: L10n.tr("Installed") + (version.map { " (\($0))" } ?? ""),tone: .ok)} else {StatusRow(title: "NotProton",- value: "Installed, but not for this account.",+ value: L10n.tr("Installed, but not for this account."),tone: .warning,- detail: "Steam is set up for NotProton, but this account is missing its "- + "components. Install to add them.",+ detail: L10n.tr("Steam is set up for NotProton, but this account is missing its components. Install to add them."),action: installAction(prominent: true))}case .outdated(_, let bundled):StatusRow(title: "NotProton",- value: "Update available (\(bundled)).",+ value: L10n.tr("Update available (\(bundled))."),tone: .warning,action: installAction(prominent: true))case .foreign:StatusRow(title: "NotProton",- value: "Another dylib is present.",+ value: L10n.tr("Another dylib is present."),tone: .warning,- detail: "Repair your Steam install before installing NotProton."+ detail: L10n.tr("Repair your Steam install before installing NotProton."))}}private func updateBlockRow(_ blocked: Bool) -> some View {StatusRow(- title: "Block Steam client updates",+ title: L10n.tr("Block Steam client updates"),value: blocked- ? "The Steam client will not update itself."- : "A Steam client update may break NotProton.",+ ? L10n.tr("The Steam client will not update itself.")+ : L10n.tr("A Steam client update may break NotProton."),toggle: blockUpdates).disabled(!status.isIdle)- .help("Steam client updates may break NotProton.")+ .help(L10n.tr("Steam client updates may break NotProton."))}private var blockUpdates: Binding<Bool> {@@ -532,7 +524,7 @@ struct StatusView: View {if rows.isEmpty {StatusRow(title: "CrossOver",- value: "Not found. Supported: \(SupportedRunners.versionList).",+ value: L10n.tr("Not found. Supported: \(SupportedRunners.versionList)."),tone: .bad)}@@ -558,13 +550,13 @@ struct StatusView: View {}if case .ready = snapshot.runner, !snapshot.payload.missing(origin: .patched).isEmpty {StatusRow(- title: "Compatibility Tool",- value: "Patched components are missing.",+ title: L10n.tr("Compatibility Tool"),+ value: L10n.tr("Patched components are missing."),tone: .warning,action: StatusAction(- label: "Repair",+ label: L10n.tr("Repair"),isProminent: true,- help: "Set up the compatibility tool again.",+ help: L10n.tr("Set up the compatibility tool again."),isEnabled: status.isIdle && status.setupSource != nil) { Task { await status.requestCompatibilityTool() } })@@ -573,15 +565,15 @@ struct StatusView: View {private func crossOverValue(_ row: CrossOverRow) -> String {if let version = row.unsupportedVersion {- return "Version \(version) not supported (supported: \(SupportedRunners.versionList))"+ return L10n.tr("Version \(version) not supported (supported: \(SupportedRunners.versionList))")}- let build = "Build \(SupportedRunners.displayVersion(forID: row.buildID))"+ let build = L10n.tr("Build \(SupportedRunners.displayVersion(forID: row.buildID))")switch row.copy {case .ready: return build- case .none: return build + (row.licensed == false ? ", not set up or activated" : ", not set up")- case .unpatched: return build + ", not patched"- case .damaged: return build + ", copy damaged"- case .unsupported: return build + ", not supported"+ case .none: return build + (row.licensed == false ? L10n.tr(", not set up or activated") : L10n.tr(", not set up"))+ case .unpatched: return build + L10n.tr(", not patched")+ case .damaged: return build + L10n.tr(", copy damaged")+ case .unsupported: return build + L10n.tr(", not supported")}}@@ -600,13 +592,13 @@ struct StatusView: View {let names = tools.filter { $0.build == row.buildID }.map(\.display)lines.append(contentsOf: names)}- if row.copy == .none, row.licensed == false { lines.append("Open CrossOver to activate it.") }+ if row.copy == .none, row.licensed == false { lines.append(L10n.tr("Open CrossOver to activate it.")) }if let install = row.install {var path = install.bundle.path(percentEncoded: false)if path.count > 1, path.hasSuffix("/") { path.removeLast() }lines.append(path)} else if row.copy != .unsupported {- lines.append("CrossOver app not found.")+ lines.append(L10n.tr("CrossOver app not found."))}return lines.isEmpty ? nil : lines.joined(separator: "\n")}@@ -616,20 +608,20 @@ struct StatusView: View {switch row.copy {case .none where row.canSetUp:return StatusAction(- label: "Set Up",+ label: L10n.tr("Set Up"),isProminent: prominent,- help: "Copy \(row.title) and set up its compatibility tool.",+ help: L10n.tr("Copy \(row.title) and set up its compatibility tool."),isEnabled: status.canInstall) { Task { await status.requestCompatibilityTool(from: install) } }case .unpatched where row.canSetUp, .damaged where row.canSetUp:return StatusAction(- label: "Repair",+ label: L10n.tr("Repair"),isProminent: true,- help: "Copy \(row.title) again.",+ help: L10n.tr("Copy \(row.title) again."),isEnabled: status.canInstall) { Task { await status.requestCompatibilityTool(from: install) } }case .unsupported:- return removeCopyAction(row.buildID, label: "Remove\u{2026}")+ return removeCopyAction(row.buildID, label: L10n.tr("Remove\u{2026}"))default:return nil}@@ -640,26 +632,26 @@ struct StatusView: View {let install = row.installif row.copy == .ready {items.append(StatusAction(- label: "Reinstall",- help: "Copy \(row.title) again.",+ label: L10n.tr("Reinstall"),+ help: L10n.tr("Copy \(row.title) again."),isEnabled: status.canInstall && row.canSetUp) { Task { await status.requestCompatibilityTool(from: install, replacingExisting: true) } })}let shown = install?.bundle?? (row.copy == .none ? nil : SupportPaths.runnerRoot(forBuild: row.buildID))if let shown {- items.append(StatusAction(label: "Show in Finder") {+ items.append(StatusAction(label: L10n.tr("Show in Finder")) {NSWorkspace.shared.activateFileViewerSelecting([shown])})}if [.ready, .unpatched, .damaged].contains(row.copy) {- var remove = removeCopyAction(row.buildID, label: "Remove Copy\u{2026}")+ var remove = removeCopyAction(row.buildID, label: L10n.tr("Remove Copy\u{2026}"))remove.startsGroup = trueitems.append(remove)}if let install, row.isManual {items.append(StatusAction(- label: "Remove from List",+ label: L10n.tr("Remove from List"),isEnabled: status.isIdle,startsGroup: !items.contains(where: \.startsGroup)) { Task { await status.removeFromList(install) } })@@ -678,20 +670,20 @@ struct StatusView: View {if flavors.count > 1 {lines = flavors.compactMap { flavor inguard let bytes = templates[flavor], bytes > 0 else { return nil }- return "\(flavor.name) templates \(bytes.formatted(.byteCount(style: .file)))"+ return L10n.tr("\(flavor.name) templates \(bytes.formatted(.byteCount(style: .file)))")}} else {let bytes = templates.values.reduce(0, +)- lines = bytes > 0 ? ["Templates \(bytes.formatted(.byteCount(style: .file)))"] : []+ lines = bytes > 0 ? [L10n.tr("Templates \(bytes.formatted(.byteCount(style: .file)))")] : []}- return (["Runner \(runner.formatted(.byteCount(style: .file)))"] + lines).joined(separator: "\n")+ return ([L10n.tr("Runner \(runner.formatted(.byteCount(style: .file)))")] + lines).joined(separator: "\n")}private func removeCopyAction(_ build: String, label: String) -> StatusAction {StatusAction(label: label,role: .destructive,- help: "Delete NotProton's copy of this build.",+ help: L10n.tr("Delete NotProton's copy of this build."),isEnabled: status.canInstall) {status.requestBuildRemoval(build)@@ -700,9 +692,9 @@ struct StatusView: View {private func fetchAction() -> StatusAction {StatusAction(- label: "Fetch Valve Binaries",+ label: L10n.tr("Fetch Valve Binaries"),isProminent: true,- help: "Download missing Valve binaries.",+ help: L10n.tr("Download missing Valve binaries."),isEnabled: status.canInstall) { Task { await status.fetchValveBinaries() } }}@@ -710,29 +702,29 @@ struct StatusView: View {@ViewBuilderprivate func componentsSection(_ payload: PayloadState) -> some View {if let problem = payload.manifestProblem {- Section("NotProton Components") {- StatusRow(title: "Components", value: "Component list unreadable.", tone: .bad, detail: problem)+ Section(L10n.tr("NotProton Components")) {+ StatusRow(title: L10n.tr("Components"), value: L10n.tr("Component list unreadable."), tone: .bad, detail: problem)}} else if payload.isComplete {- Section("NotProton Components") {+ Section(L10n.tr("NotProton Components")) {StatusRow(- title: "Components", value: "Ready.", tone: .ok,+ title: L10n.tr("Components"), value: L10n.tr("Ready."), tone: .ok,trailing: status.bridgeCopyBytes > 0- ? "Copies on other drives \(status.bridgeCopyBytes.formatted(.byteCount(style: .file)))" : nil+ ? L10n.tr("Copies on other drives \(status.bridgeCopyBytes.formatted(.byteCount(style: .file)))") : nil)}} else if payload.isEmpty {- Section("NotProton Components") {- StatusRow(title: "Components", value: "Not yet deployed.", tone: .neutral)+ Section(L10n.tr("NotProton Components")) {+ StatusRow(title: L10n.tr("Components"), value: L10n.tr("Not yet deployed."), tone: .neutral)}} else {- Section("NotProton Components") {+ Section(L10n.tr("NotProton Components")) {if !payload.missing.isEmpty {let names = payload.missing.map {URL(filePath: $0.path).lastPathComponent}.joined(separator: ", ")StatusRow(- title: "Missing.",+ title: L10n.tr("Missing."),value: names,tone: .bad,action: payload.missing.contains(where: { $0.origin.isFetchable })@@ -740,10 +732,10 @@ struct StatusView: View {)}if !payload.overlayShimPresent {- StatusRow(title: "Overlay shim", value: "Missing.", tone: .bad)+ StatusRow(title: L10n.tr("Overlay shim"), value: L10n.tr("Missing."), tone: .bad)}if payload.signatureDatabase == nil {- StatusRow(title: "Signature database", value: "Missing.", tone: .bad)+ StatusRow(title: L10n.tr("Signature database"), value: L10n.tr("Missing."), tone: .bad)}}}diff --git a/app/Tests/NotProtonAppTests/LocalizationTests.swift b/app/Tests/NotProtonAppTests/LocalizationTests.swiftnew file mode 100644index 0000000..9f3659e--- /dev/null+++ b/app/Tests/NotProtonAppTests/LocalizationTests.swift@@ -0,0 +1,28 @@+import Foundation+import Testing++@testable import NotProtonApp++@Suite("Localization")+struct LocalizationTests {+ let chinese = Bundle.module.path(forResource: "zh-Hans", ofType: "lproj").flatMap(Bundle.init(path:))++ @Test("Chinese text is looked up with interpolated values in place")+ func chineseLookup() throws {+ let zh = try #require(chinese)+ #expect(L10n.tr("Status", in: zh) == "状态")+ #expect(L10n.tr("Delete \(3) prefixes?", in: zh) == "删除 3 个游戏容器?")+ }++ @Test("Missing translations fall back to the English text")+ func fallback() throws {+ let zh = try #require(chinese)+ #expect(L10n.tr("Untranslated \(42)", in: zh) == "Untranslated 42")+ }++ @Test("Interpolated values are inserted once and never reinterpreted")+ func valuesStayLiteral() {+ #expect(L10n.render("{1}/{0}/{1}", arguments: ["{1}", "100%"]) == "100%/{1}/100%")+ #expect(L10n.render("{9} {0}", arguments: ["safe"]) == "{9} safe")+ }+}diff --git a/dylib/feats/webpatch.c b/dylib/feats/webpatch.cindex 5312eef..5564932 100644--- a/dylib/feats/webpatch.c+++ b/dylib/feats/webpatch.c@@ -160,6 +160,20 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {"return{p:G[0].start,e:G.slice(0,n<0?G.length:n)}})(),"// CrossOver options panel. Not in great shape, but it'll do+#define NP_WEB_IS_ZH \+ "(()=>{const l=(globalThis.document?.documentElement?.lang||" \+ "globalThis.navigator?.language||\"\").toLowerCase().replace(/_/g,\"-\");" \+ "return /^(zh(-hans(-[a-z0-9]+)*|-cn|-sg)?|schinese)$/.test(l)})()"++#define NP_WEB_TEXT(EN, ZH) "(" NP_WEB_IS_ZH "?\"" ZH "\":\"" EN "\")"++#define NP_COMPAT_HINT NP_WEB_TEXT( \+ "Enable CrossOver under Properties > Compatibility to install and run the Windows version.", \+ "请在“属性 > 兼容性”中启用 CrossOver,以安装并运行 Windows 版本。")++#define NP_IMAGE_FILES_LABEL NP_WEB_TEXT( \+ "Image Files (*.tga,*.png,*.exe)", "图像文件 (*.tga,*.png,*.exe)")+#define NP_CX_OPTIONS_CSS \"\".MSCXPanel{margin-top:10px}" \".MSCXPanel .MSCXRow{display:flex;flex-direction:row;padding:9px;margin:0;" \@@ -170,6 +184,7 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {#define NP_CX_OPTIONS_BODY(ARG, RT, BARREL) \ARG "=>{" \"const t=" ARG ".details,o=t.strLaunchOptions||\"\"," \+ "npZh=" NP_WEB_IS_ZH ",npL=(en,zh)=>npZh?zh:en," \NP_CX_LAUNCH_PARSE \"g=k=>{const p=E.e.filter(w=>o.startsWith(k+\"=\",w.start)).pop();" \"return p?(p.value===null?o.slice(p.start+k.length+1,p.end):p.value.slice(k.length+1)):\"\"}," \@@ -193,12 +208,12 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {"fx=v=>fe.filter(e=>!fk(e)).concat(v?[F+v]:[]).join(\";\")," \"fv=(fe.filter(fk).pop()||\"=2\").replace(/^[^=]*=/,\"\").replace(/\"/g,\"\").trim().split(/\\s/)[0]," \"fn=Math.max(isNaN(+fv)?2:+fv,1)," \- "U=[{data:\"\",label:\"Off\"}," \+ "U=[{data:\"\",label:npL(\"Off\",\"关闭\")}," \"{data:\"1.5\",label:\"1.5x\"}," \"{data:\"1.72\",label:\"1.72x\"}," \"{data:\"2.0\",label:\"2x\"}," \"{data:\"3.0\",label:\"3x\"}]," \- "B=[{data:\"\",label:\"Automatic\"}," \+ "B=[{data:\"\",label:npL(\"Automatic\",\"自动\")}," \"{data:\"d3dmetal\",label:\"D3DMetal\"}," \"{data:\"dxmt\",label:\"DXMT\"}," \"{data:\"dxvk\",label:\"DXVK\"}," \@@ -207,27 +222,30 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {"&&!t.strCompatToolName)return null;" \"return(0," RT ".jsx)(\"div\",{className:\"MSCXPanel\",children:(0," RT ".jsxs)(" RT ".Fragment,{children:[" \"(0," RT ".jsx)(\"style\",{children:" NP_CX_OPTIONS_CSS "})," \- "(0," RT ".jsxs)(" BARREL ".XY,{label:\"Graphics\",children:[" \+ "(0," RT ".jsxs)(" BARREL ".XY,{label:npL(\"Graphics\",\"图形\"),children:[" \"(0," RT ".jsx)(" BARREL ".m,{rgOptions:B,selectedOption:b," \"onChange:v=>s([[\"CX_GRAPHICS_BACKEND\",v.data]]" \".concat(\"\"===v.data||\"d3dmetal\"===v.data?[]:[[\"D3DM_ENABLE_METALFX\",\"\"]])" \".concat(\"\"===v.data||\"dxmt\"===v.data?[]:" \"[[\"DXMT_METALFX_SPATIAL_SWAPCHAIN\",\"\"],[\"DXMT_CONFIG\",fx(\"\")]])" \".concat(\"dxmt\"===v.data?[]:[[\"DXMT_ENABLE_NVEXT\",\"\"]]))})," \- "T([\"MTL_HUD_ENABLED\"],\"Metal HUD\",\"1\")," \+ "T([\"MTL_HUD_ENABLED\"],npL(\"Metal HUD\",\"Metal 性能监视器\"),\"1\")," \"dm&&T([\"D3DM_ENABLE_METALFX\"],\"DLSS\",\"1\")," \"\"dxmt\"===b&&T([\"DXMT_ENABLE_NVEXT\"],\"DLSS\",\"1\")," \- "T([\"ROSETTA_ADVERTISE_AVX\"],\"Advertise AVX2 to Rosetta\",\"1\",\"0\")," \+ "T([\"ROSETTA_ADVERTISE_AVX\"],npL(\"Advertise AVX2 to Rosetta\",\"向 Rosetta 声明 AVX2 支持\"),\"1\",\"0\")," \"T([\"WINEMSYNC\"],\"MSync\",\"1\",\"0\")," \- "T([\"NOTPROTON_RETINA\"],\"High Resolution\",\"1\",\"0\")" \+ "T([\"NOTPROTON_RETINA\"],npL(\"High Resolution\",\"高分辨率\"),\"1\",\"0\")" \"]},\"gfx\")," \"dx&&(0," RT ".jsx)(" BARREL ".XY," \- "{label:\"MetalFX Upscaling (Samples from the resolution the game is set to)\"," \+ "{label:npL(\"MetalFX Upscaling (Samples from the resolution the game is set to)\"," \+ "\"MetalFX 超分辨率(以游戏设置的分辨率为采样来源)\")," \"children:(0," RT ".jsx)(" BARREL ".m,{rgOptions:U," \"selectedOption:sw?(U.find(u=>u.data&&+u.data===fn)||{data:String(fn)}).data:\"\"," \"onChange:v=>s([[\"DXMT_METALFX_SPATIAL_SWAPCHAIN\",v.data?\"1\":\"\"],[\"DXMT_CONFIG\",fx(v.data)]])})},\"usf\")," \- "(0," RT ".jsx)(" BARREL ".XY,{label:\"Controllers (May break Steam Input. Not recommended)\",children:" \- "T([\"NOTPROTON_RAW_CONTROLLERS\"],\"Let games read controllers directly\",\"1\",\"\")},\"ctl\")" \+ "(0," RT ".jsx)(" BARREL ".XY,{label:npL(\"Controllers (May break Steam Input. Not recommended)\"," \+ "\"控制器(可能导致 Steam Input 失效,不推荐)\"),children:" \+ "T([\"NOTPROTON_RAW_CONTROLLERS\"],npL(\"Let games read controllers directly\"," \+ "\"允许游戏直接读取控制器\"),\"1\",\"\")},\"ctl\")" \"]})})}"#define NP_CX_OPTIONS_COMPONENT \@@ -301,8 +319,7 @@ static const np_gate_t g_gates_forcetool[] = {"!s.local_per_client_data?.installed&&""s.most_available_per_client_data?.is_invalid_os_type&&(0,n.jsx)(U,{})", 1 },{ "(0,h.we)(\"#GameList_Entry_Invalid_OSType2\")",- "\"Enable CrossOver under Properties > Compatibility to install and run "- "the Windows version.\"", 1 },+ NP_COMPAT_HINT, 1 },};// Support for new compatibility tab UI in the Steam beta@@ -334,15 +351,14 @@ static const np_gate_t g_gates_selecttool[] = {NP_C1 ".most_available_per_client_data?.is_invalid_os_type&&""(0," NP_C2 ".jsx)(" NP_C3 ",{})", 1 },{ "(0," NP_C1 ".we)(\"#GameList_Entry_Invalid_OSType2\")",- "\"Enable CrossOver under Properties > Compatibility to install and run "- "the Windows version.\"", 1 },+ NP_COMPAT_HINT, 1 },};static const np_gate_t g_fixes[] = {{ "(\"#AddNonSteam_Filter_Exe_MacOS\"),rFilePatterns:[\"*.app\"]","(\"#AddNonSteam_Filter_Exe_MacOS\"),rFilePatterns:[\"*.app\",\"*.exe\"]", 1 },{ "{strFileTypeName:\"Image Files (*.tga,*.png)\",rFilePatterns:[\"*.tga\",\"*.png\"]}",- "{strFileTypeName:\"Image Files (*.tga,*.png,*.exe)\","+ "{strFileTypeName:" NP_IMAGE_FILES_LABEL ",""rFilePatterns:[\"*.tga\",\"*.png\",\"*.exe\"]}", 1 },// Makes Steam's default compatibility tool setting work{ "r=(0,s.q3)(()=>u.rV.settings.bCompatEnabled),a=function(e,t){const[r,i]=n.useState([]);"diff --git a/dylib/tests/panel-behavior/emit.c b/dylib/tests/panel-behavior/emit.cindex 2d4cbc2..e511034 100644--- a/dylib/tests/panel-behavior/emit.c+++ b/dylib/tests/panel-behavior/emit.c@@ -22,6 +22,14 @@ int main(int argc, char **argv) {fputs(NP_LAUNCH_MIGRATION, stdout);return 0;}- fputs("usage: emit component|statement|migration\n", stderr);+ if (argc == 2 && strcmp(argv[1], "compat-hint") == 0) {+ fputs(NP_COMPAT_HINT, stdout);+ return 0;+ }+ if (argc == 2 && strcmp(argv[1], "image-files-label") == 0) {+ fputs(NP_IMAGE_FILES_LABEL, stdout);+ return 0;+ }+ fputs("usage: emit component|statement|migration|compat-hint|image-files-label\n", stderr);return 2;}diff --git a/dylib/tests/panel-behavior/harness.js b/dylib/tests/panel-behavior/harness.jsindex add1a0d..77784b9 100644--- a/dylib/tests/panel-behavior/harness.js+++ b/dylib/tests/panel-behavior/harness.js@@ -25,7 +25,7 @@ const FORMS = {statement: { arg: 'statement', react: 'R0', barrel: 'B0' },};-function panel(emit, form) {+function panel(emit, form, globals = { document: { documentElement: { lang: 'en' } } }) {const raw = execFileSync(emit, [form], { encoding: 'utf8' }).trim();const src = form === 'component'? 'var ' + raw.replace(/,$/, '')@@ -35,8 +35,8 @@ function panel(emit, form) {const SteamClient = {Apps: { SetAppLaunchOptions: (appid, opts) => written.push({ appid, opts }) },};- const build = new Function(f.react, f.barrel, 'SteamClient', src + '\nreturn MSCXOpts;');- return { render: build(react, barrel, SteamClient), written };+ const build = new Function(f.react, f.barrel, 'SteamClient', 'globalThis', src + '\nreturn MSCXOpts;');+ return { render: build(react, barrel, SteamClient, globals), written };}// Function components are resolved rather than recorded, so a check sees the nodes thediff --git a/dylib/tests/panel-behavior/localization.js b/dylib/tests/panel-behavior/localization.jsnew file mode 100644index 0000000..02a2160--- /dev/null+++ b/dylib/tests/panel-behavior/localization.js@@ -0,0 +1,46 @@+'use strict';+const assert = require('node:assert/strict');+const { execFileSync } = require('node:child_process');+const { panel, walk, details, FORMS } = require('./harness');++const emit = process.argv[2];+if (!emit) throw new Error('usage: localization.js <emit>');+const doc = lang => ({ document: { documentElement: { lang } } });+const zhCases = [doc('zh-CN'), doc('zh-Hans'), doc('zh_Hans_CN'), doc('zh-SG'), doc('schinese'),+ { navigator: { language: 'zh-CN' } }, { ...doc(''), navigator: { language: 'zh-CN' } }];+const enCases = [doc('en'), doc('fr'), doc('zh-Hant'), doc('zh-TW'), doc('tchinese'), {},+ { ...doc('en'), navigator: { language: 'zh-CN' } }];++for (const form of Object.keys(FORMS)) {+ for (const [chinese, cases] of [[true, zhCases], [false, enCases]]) {+ for (const globals of cases) {+ const { render, written } = panel(emit, form, globals);+ const nodes = walk(render({ details: details('CX_GRAPHICS_BACKEND=dxmt %command%') }));+ const dropdowns = nodes.filter(n => n.type === 'Dropdown');+ assert.equal(dropdowns[0].props.rgOptions[0].label, chinese ? '自动' : 'Automatic');+ assert.equal(dropdowns[1].props.rgOptions[0].label, chinese ? '关闭' : 'Off');+ assert.deepEqual(dropdowns[0].props.rgOptions.map(o => o.data),+ ['', 'd3dmetal', 'dxmt', 'dxvk', 'wined3d']);+ assert(nodes.some(n => n.props.label === (chinese ? '图形' : 'Graphics')));+ assert(nodes.some(n => n.props.label === (chinese+ ? '控制器(可能导致 Steam Input 失效,不推荐)'+ : 'Controllers (May break Steam Input. Not recommended)')));+ const raw = nodes.find(n => n.props.label === (chinese+ ? '允许游戏直接读取控制器' : 'Let games read controllers directly'));+ raw.props.onChange(true);+ assert.equal(written.at(-1).opts, 'NOTPROTON_RAW_CONTROLLERS=1 CX_GRAPHICS_BACKEND=dxmt %command%');+ const hud = nodes.find(n => n.props.label === (chinese ? 'Metal 性能监视器' : 'Metal HUD'));+ hud.props.onChange(true);+ assert.equal(written.at(-1).opts, 'MTL_HUD_ENABLED=1 CX_GRAPHICS_BACKEND=dxmt %command%');+ for (const [mode, en, zh] of [+ ['compat-hint', 'Enable CrossOver under Properties > Compatibility to install and run the Windows version.',+ '请在“属性 > 兼容性”中启用 CrossOver,以安装并运行 Windows 版本。'],+ ['image-files-label', 'Image Files (*.tga,*.png,*.exe)', '图像文件 (*.tga,*.png,*.exe)'],+ ]) {+ const src = execFileSync(emit, [mode], { encoding: 'utf8' });+ assert.equal(new Function('globalThis', `return ${src}`)(globals), chinese ? zh : en);+ }+ }+ }+}+console.log('PASS: both panel shapes, Chinese/English locales, fallback, labels and unchanged option values');