Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 118 additions & 50 deletions assets/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@
}
}
},
"%@ · %@": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "%1$@ · %2$@"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "%1$@ · %2$@"
}
}
}
},
"A simulator is where it starts.": {
"localizations": {
"en": {
Expand Down Expand Up @@ -209,6 +225,22 @@
}
}
},
"Couldn’t Start Simulator": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Couldn’t Start Simulator"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "无法启动模拟器"
}
}
}
},
"Couldn’t check for simulators": {
"localizations": {
"en": {
Expand All @@ -225,6 +257,22 @@
}
}
},
"Couldn’t start %@.\n%@": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Couldn’t start %1$@.\n%2$@"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "无法启动 %1$@。\n%2$@"
}
}
}
},
"Create an iPhone or iPad simulator in %@.\nThen come back to find your next favorite app.": {
"localizations": {
"en": {
Expand Down Expand Up @@ -289,34 +337,6 @@
}
}
},
"Found %lld available iOS simulators.": {
"localizations": {
"en": {
"variations": {
"plural": {
"one": {
"stringUnit": {
"state": "translated",
"value": "Found %lld available iOS simulator."
}
},
"other": {
"stringUnit": {
"state": "translated",
"value": "Found %lld available iOS simulators."
}
}
}
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "找到 %lld 台可用的 iOS 模拟器。"
}
}
}
},
"Install Xcode to add iPhone and iPad simulators.": {
"localizations": {
"en": {
Expand Down Expand Up @@ -541,18 +561,18 @@
}
}
},
"SIMULATORS": {
"Runtime": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "SIMULATORS"
"value": "Runtime"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "模拟器"
"value": "运行时"
}
}
}
Expand Down Expand Up @@ -589,6 +609,54 @@
}
}
},
"Simulator": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Simulator"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "模拟器"
}
}
}
},
"Simulators": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Simulators"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "模拟器"
}
}
}
},
"Start Simulator": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Start Simulator"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "启动模拟器"
}
}
}
},
"Start with Xcode.": {
"localizations": {
"en": {
Expand All @@ -605,6 +673,22 @@
}
}
},
"Starting…": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Starting…"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "正在启动…"
}
}
}
},
"Try Again": {
"localizations": {
"en": {
Expand Down Expand Up @@ -717,34 +801,18 @@
}
}
},
"Your simulators are ready": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Your simulators are ready"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "模拟器已就绪"
}
}
}
},
"iOS %@ · %@": {
"iOS %@": {
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "iOS %@ · %@"
"value": "iOS %@"
}
},
"zh-Hans": {
"stringUnit": {
"state": "translated",
"value": "iOS %@ · %@"
"value": "iOS %@"
}
}
}
Expand Down
1 change: 0 additions & 1 deletion cmake/Localization.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ endforeach()

set(LOCALIZATION_RESOURCES
"${LOCALIZATION_OUTPUT_DIR}/en.lproj/Localizable.strings"
"${LOCALIZATION_OUTPUT_DIR}/en.lproj/Localizable.stringsdict"
"${LOCALIZATION_OUTPUT_DIR}/zh-Hans.lproj/Localizable.strings"
)
add_custom_command(OUTPUT ${LOCALIZATION_RESOURCES}
Expand Down
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
add_executable(SimStore MACOSX_BUNDLE
AppDelegate.swift
AppConfiguration.swift
Command.swift
SimStoreApp.swift
SimulatorDiscovery.swift
SimulatorControl.swift
SimulatorStore.swift
SimulatorDevicePresentation.swift
SimulatorSelectionViews.swift
ContentView.swift
SidebarView.swift
NoSimulatorsView.swift
Expand Down
43 changes: 43 additions & 0 deletions src/Command.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import Foundation

enum Command {
typealias Runner = @Sendable (String, [String]) throws -> Data

static let xcrunExecutable = "/usr/bin/xcrun"
static let simctlTool = "simctl"

static func run(_ executable: String, arguments: [String]) throws -> Data {
let process = Process()
let pipe = Pipe()
process.executableURL = URL(fileURLWithPath: executable)
process.arguments = arguments
process.standardOutput = pipe
process.standardError = pipe
try process.run()
let data = pipe.fileHandleForReading.readDataToEndOfFile()
process.waitUntilExit()
guard process.terminationReason == .exit, process.terminationStatus == 0 else {
let diagnostic = String(decoding: data, as: UTF8.self).trimmingCharacters(
in: .whitespacesAndNewlines)
throw NSError(
domain: "Command", code: Int(process.terminationStatus),
userInfo: [
NSLocalizedDescriptionKey: diagnostic.isEmpty
? String(
localized:
"\(process.executableURL!.lastPathComponent) exited with status \(process.terminationStatus)."
)
: diagnostic
])
}
return data
}

static func xcrun(_ arguments: [String], using command: Runner = run) throws -> Data {
try command(xcrunExecutable, arguments)
}

static func simctl(_ arguments: [String], using command: Runner = run) throws -> Data {
try xcrun([simctlTool] + arguments, using: command)
}
}
Loading