diff --git a/scripts/tools/adb b/scripts/tools/adb index 50fa00e..227b051 100755 --- a/scripts/tools/adb +++ b/scripts/tools/adb @@ -32,8 +32,7 @@ elif [[ -x "$managed_adb" ]]; then export ADB_SERVER_SOCKET=tcp:localhost:5039 else # The first sentence is AlvrWiredFailure.adbMissing, which the app recognizes. - print -u2 "Could not find adb; open Headset in TrailBridge and choose Get Android Platform Tools." \ - "In Russian the button is «Скачать Android Platform Tools…»." + print -u2 "Could not find adb; open Headset in TrailBridge and choose Get Android Platform Tools." exit 1 fi export ADB_MDNS_AUTO_CONNECT=0 diff --git a/streamer/Sources/BasaltManager/AppModel.swift b/streamer/Sources/BasaltManager/AppModel.swift index 1354f37..fd1cba1 100644 --- a/streamer/Sources/BasaltManager/AppModel.swift +++ b/streamer/Sources/BasaltManager/AppModel.swift @@ -1100,7 +1100,7 @@ final class BasaltAppModel: ObservableObject { } } - /// «Продолжить» in the network storage question. + /// "Continue" in the network storage question. func confirmNetworkDataFolder() async { guard let verdict = networkDataFolder else { return } networkDataFolder = nil diff --git a/streamer/Sources/BasaltManagerKit/Diagnostics.swift b/streamer/Sources/BasaltManagerKit/Diagnostics.swift index b940a05..14f91bb 100644 --- a/streamer/Sources/BasaltManagerKit/Diagnostics.swift +++ b/streamer/Sources/BasaltManagerKit/Diagnostics.swift @@ -168,7 +168,7 @@ public struct DiagnosticRedactor: Sendable { } /// A pattern for one name as text may spell it: as given, composed or - /// decomposed (file systems differ on "й"), and percent-encoded as in a + /// decomposed (file systems differ on "é"), and percent-encoded as in a /// file URL. private static func spellings(of name: String) -> String { var forms = [name, name.precomposedStringWithCanonicalMapping, diff --git a/streamer/Sources/BasaltManagerKit/Localization/AppLanguage.swift b/streamer/Sources/BasaltManagerKit/Localization/AppLanguage.swift index 864fff5..e5bd0a4 100644 --- a/streamer/Sources/BasaltManagerKit/Localization/AppLanguage.swift +++ b/streamer/Sources/BasaltManagerKit/Localization/AppLanguage.swift @@ -3,20 +3,8 @@ import Foundation public enum AppLanguage: String, CaseIterable, Codable, Sendable { case en, ru, it, de, es, fr, uk, pl, ko, ja - public var nativeName: String { - switch self { - case .en: return "English" - case .ru: return "Русский" - case .it: return "Italiano" - case .de: return "Deutsch" - case .es: return "Español" - case .fr: return "Français" - case .uk: return "Українська" - case .pl: return "Polski" - case .ko: return "한국어" - case .ja: return "日本語" - } - } + /// The language's own name, as its table spells it: "Deutsch", "日本語". + public var nativeName: String { L10n.string(.languageNativeName, language: self) } public var isReviewed: Bool { self == .en || self == .ru } public var locale: Locale { Locale(identifier: rawValue) } diff --git a/streamer/Sources/BasaltManagerKit/Localization/L10nKey.swift b/streamer/Sources/BasaltManagerKit/Localization/L10nKey.swift index ba33733..3b13b91 100644 --- a/streamer/Sources/BasaltManagerKit/Localization/L10nKey.swift +++ b/streamer/Sources/BasaltManagerKit/Localization/L10nKey.swift @@ -395,6 +395,7 @@ public enum L10nKey: String, CaseIterable, Sendable { case licensesMissing // MARK: - Settings language + case languageNativeName case settingsLanguage case settingsLanguageImmediate case settingsTranslationNotReviewed diff --git a/streamer/Sources/BasaltManagerKit/Localization/Strings+de.swift b/streamer/Sources/BasaltManagerKit/Localization/Strings+de.swift index a26d682..da4277a 100644 --- a/streamer/Sources/BasaltManagerKit/Localization/Strings+de.swift +++ b/streamer/Sources/BasaltManagerKit/Localization/Strings+de.swift @@ -609,6 +609,7 @@ final class StringsDE: LocalizationTable { .licensesTitle: "Lizenzen", .licensesMissing: "In diesem Build wurde kein Lizenztext gefunden.", // MARK: - Settings language + .languageNativeName: "Deutsch", .settingsLanguage: "Sprache", .settingsLanguageImmediate: "Die Sprache ändert sich sofort.", .settingsTranslationNotReviewed: "Übersetzung nicht geprüft", diff --git a/streamer/Sources/BasaltManagerKit/Localization/Strings+en.swift b/streamer/Sources/BasaltManagerKit/Localization/Strings+en.swift index 40d6669..3be831c 100644 --- a/streamer/Sources/BasaltManagerKit/Localization/Strings+en.swift +++ b/streamer/Sources/BasaltManagerKit/Localization/Strings+en.swift @@ -609,6 +609,7 @@ final class StringsEN: LocalizationTable { .licensesTitle: "Licenses", .licensesMissing: "License text was not found in this build.", // MARK: - Settings language + .languageNativeName: "English", .settingsLanguage: "Language", .settingsLanguageImmediate: "The language changes immediately.", .settingsTranslationNotReviewed: "translation not reviewed", diff --git a/streamer/Sources/BasaltManagerKit/Localization/Strings+es.swift b/streamer/Sources/BasaltManagerKit/Localization/Strings+es.swift index b5118f4..932ba02 100644 --- a/streamer/Sources/BasaltManagerKit/Localization/Strings+es.swift +++ b/streamer/Sources/BasaltManagerKit/Localization/Strings+es.swift @@ -609,6 +609,7 @@ final class StringsES: LocalizationTable { .licensesTitle: "Licencias", .licensesMissing: "No se encontró el texto de la licencia en esta compilación.", // MARK: - Settings language + .languageNativeName: "Español", .settingsLanguage: "Idioma", .settingsLanguageImmediate: "El idioma cambia al instante.", .settingsTranslationNotReviewed: "traducción sin revisar", diff --git a/streamer/Sources/BasaltManagerKit/Localization/Strings+fr.swift b/streamer/Sources/BasaltManagerKit/Localization/Strings+fr.swift index c242f5f..37e65ba 100644 --- a/streamer/Sources/BasaltManagerKit/Localization/Strings+fr.swift +++ b/streamer/Sources/BasaltManagerKit/Localization/Strings+fr.swift @@ -609,6 +609,7 @@ final class StringsFR: LocalizationTable { .licensesTitle: "Licences", .licensesMissing: "Le texte de la licence est introuvable dans cette version.", // MARK: - Settings language + .languageNativeName: "Français", .settingsLanguage: "Langue", .settingsLanguageImmediate: "La langue change immédiatement.", .settingsTranslationNotReviewed: "traduction non relue", diff --git a/streamer/Sources/BasaltManagerKit/Localization/Strings+it.swift b/streamer/Sources/BasaltManagerKit/Localization/Strings+it.swift index a237a88..df8b7b1 100644 --- a/streamer/Sources/BasaltManagerKit/Localization/Strings+it.swift +++ b/streamer/Sources/BasaltManagerKit/Localization/Strings+it.swift @@ -609,6 +609,7 @@ final class StringsIT: LocalizationTable { .licensesTitle: "Licenze", .licensesMissing: "Il testo della licenza non è stato trovato in questa build.", // MARK: - Settings language + .languageNativeName: "Italiano", .settingsLanguage: "Lingua", .settingsLanguageImmediate: "La lingua cambia subito.", .settingsTranslationNotReviewed: "traduzione non revisionata", diff --git a/streamer/Sources/BasaltManagerKit/Localization/Strings+ja.swift b/streamer/Sources/BasaltManagerKit/Localization/Strings+ja.swift index 651c493..360bfa2 100644 --- a/streamer/Sources/BasaltManagerKit/Localization/Strings+ja.swift +++ b/streamer/Sources/BasaltManagerKit/Localization/Strings+ja.swift @@ -609,6 +609,7 @@ final class StringsJA: LocalizationTable { .licensesTitle: "ライセンス", .licensesMissing: "このビルドにライセンスの本文が見つかりません。", // MARK: - Settings language + .languageNativeName: "日本語", .settingsLanguage: "言語", .settingsLanguageImmediate: "言語はすぐに切り替わります。", .settingsTranslationNotReviewed: "翻訳未レビュー", diff --git a/streamer/Sources/BasaltManagerKit/Localization/Strings+ko.swift b/streamer/Sources/BasaltManagerKit/Localization/Strings+ko.swift index e4d3fa5..a445a65 100644 --- a/streamer/Sources/BasaltManagerKit/Localization/Strings+ko.swift +++ b/streamer/Sources/BasaltManagerKit/Localization/Strings+ko.swift @@ -609,6 +609,7 @@ final class StringsKO: LocalizationTable { .licensesTitle: "라이선스", .licensesMissing: "이 빌드에서 라이선스 본문을 찾지 못했어요.", // MARK: - Settings language + .languageNativeName: "한국어", .settingsLanguage: "언어", .settingsLanguageImmediate: "언어가 즉시 변경돼요.", .settingsTranslationNotReviewed: "검토되지 않은 번역", diff --git a/streamer/Sources/BasaltManagerKit/Localization/Strings+pl.swift b/streamer/Sources/BasaltManagerKit/Localization/Strings+pl.swift index 1b84772..afa5b1b 100644 --- a/streamer/Sources/BasaltManagerKit/Localization/Strings+pl.swift +++ b/streamer/Sources/BasaltManagerKit/Localization/Strings+pl.swift @@ -609,6 +609,7 @@ final class StringsPL: LocalizationTable { .licensesTitle: "Licencje", .licensesMissing: "Nie znaleziono tekstu licencji w tej kompilacji.", // MARK: - Settings language + .languageNativeName: "Polski", .settingsLanguage: "Język", .settingsLanguageImmediate: "Język zmienia się od razu.", .settingsTranslationNotReviewed: "tłumaczenie niesprawdzone", diff --git a/streamer/Sources/BasaltManagerKit/Localization/Strings+ru.swift b/streamer/Sources/BasaltManagerKit/Localization/Strings+ru.swift index 0398d31..c6a0378 100644 --- a/streamer/Sources/BasaltManagerKit/Localization/Strings+ru.swift +++ b/streamer/Sources/BasaltManagerKit/Localization/Strings+ru.swift @@ -609,6 +609,7 @@ final class StringsRU: LocalizationTable { .licensesTitle: "Лицензии", .licensesMissing: "Текст лицензии не найден в этой сборке.", // MARK: - Settings language + .languageNativeName: "Русский", .settingsLanguage: "Язык", .settingsLanguageImmediate: "Язык меняется сразу.", .settingsTranslationNotReviewed: "перевод не проверен", diff --git a/streamer/Sources/BasaltManagerKit/Localization/Strings+uk.swift b/streamer/Sources/BasaltManagerKit/Localization/Strings+uk.swift index 5fb64f2..ac79cb7 100644 --- a/streamer/Sources/BasaltManagerKit/Localization/Strings+uk.swift +++ b/streamer/Sources/BasaltManagerKit/Localization/Strings+uk.swift @@ -609,6 +609,7 @@ final class StringsUK: LocalizationTable { .licensesTitle: "Ліцензії", .licensesMissing: "Текст ліцензії не знайдено в цій збірці.", // MARK: - Settings language + .languageNativeName: "Українська", .settingsLanguage: "Мова", .settingsLanguageImmediate: "Мова змінюється одразу.", .settingsTranslationNotReviewed: "переклад не перевірено", diff --git a/streamer/Sources/BasaltManagerKit/SteamGameWizard.swift b/streamer/Sources/BasaltManagerKit/SteamGameWizard.swift index a0d6418..fea754b 100644 --- a/streamer/Sources/BasaltManagerKit/SteamGameWizard.swift +++ b/streamer/Sources/BasaltManagerKit/SteamGameWizard.swift @@ -12,7 +12,7 @@ public struct VerifiedMonth: Equatable, Sendable { self.month = month } - /// "November 2026" or "ноябрь 2026 г.", in the app's language. + /// "November 2026" or "listopad 2026", in the app's language. public func text(locale: Locale) -> String { var calendar = Calendar(identifier: .gregorian) calendar.timeZone = TimeZone(secondsFromGMT: 0)! @@ -33,8 +33,6 @@ public struct SteamCatalogGame: Identifiable, Equatable, Sendable { public let name: String public let appID: String? public let environmentName: String? - public let status: String - public let note: String public let needsOpenVR: Bool /// When the game was last checked in a headset; nil when it never was. public var verifiedIn: VerifiedMonth? = nil @@ -45,32 +43,21 @@ public struct SteamCatalogGame: Identifiable, Equatable, Sendable { public static let verified: [Self] = [ .init(id: "2669380", name: "BRUTALISTICK VR", appID: "2669380", - environmentName: "brutalistick-vr", status: "Проверена в шлеме", - note: "Проверена на Mac mini M4 и Quest 3: запуск, руки, ходьба — работает стабильно.", needsOpenVR: true, - verifiedIn: november2026), + environmentName: "brutalistick-vr", needsOpenVR: true, verifiedIn: november2026), .init(id: "1032430", name: "Blood Trail", appID: "1032430", - environmentName: "blood-trail", status: "Проверена в шлеме", - note: "Проверена на Mac mini M4 и Quest 3: уровни, стрельба, частицы, сессия 54 минуты. Направление ходьбы зависит от настройки контроллера; бега на контроллерах нет.", needsOpenVR: true, - verifiedIn: november2026), + environmentName: "blood-trail", needsOpenVR: true, verifiedIn: november2026), // VTOL VR draws both eyes in one pass; GameCompatibilityFix // vtolVRSeparateEyePasses makes the right eye work. .init(id: "667970", name: "VTOL VR", appID: "667970", - environmentName: "vtol-vr", status: "Проверена в шлеме", - note: "Проверена на Mac mini M4 и Quest 3: полёт с ботами, оба глаза. TrailBridge сам меняет настройку отрисовки игры, без неё правый глаз чёрный.", needsOpenVR: true, - verifiedIn: november2026), + environmentName: "vtol-vr", needsOpenVR: true, verifiedIn: november2026), // BONELAB runs its own OpenXR loader and needs no OpenComposite. .init(id: "1592190", name: "BONELAB", appID: "1592190", - environmentName: "bonelab", status: "Проверена в шлеме", - note: "Проверена на Mac mini M4 и Quest 3: запуск и игра через собственный OpenXR игры. Проверялась короткими сеансами.", needsOpenVR: false, - verifiedIn: november2026), + environmentName: "bonelab", needsOpenVR: false, verifiedIn: november2026), .init(id: "629730", name: "Blade & Sorcery", appID: "629730", - environmentName: "blade-sorcery", status: "Проверена в шлеме", - note: "Проверена на Mac mini M4 и Quest 3: меню и игра. Проверялась короткими сеансами.", needsOpenVR: true, - verifiedIn: november2026), + environmentName: "blade-sorcery", needsOpenVR: true, verifiedIn: november2026), ] - public static let other = Self(id: "other", name: "Другая игра", appID: nil, - environmentName: nil, status: "Не проверена", - note: "В TrailBridge эта игра не проверялась. Может не запуститься или работать с ошибками.", needsOpenVR: false) + public static let other = Self(id: "other", name: "Another game", appID: nil, + environmentName: nil, needsOpenVR: false) public static let all = verified + [other] public func bottleName(custom: String = "steam-games") throws -> String { @@ -373,32 +360,10 @@ public enum SteamTrouble: Equatable, Sendable { public enum SteamSetupActivity: Equatable { case installer, updating, timedOut, cancelled, stopped, openingSignIn - public var message: String { - switch self { - case .installer: "Откроется установщик Windows. Пройдите его шаги и сами примите соглашение Steam." - case .updating: "Ждём завершения обновления Steam. После проверки откроем окно входа." - case .timedOut: "За 15 минут обновление не подтвердилось. Проверьте окно Steam и повторите проверку." - case .cancelled: "Установка отменена: Steam не найден. Можно повторить установку." - case .stopped: "Ожидание остановлено. Можно продолжить позже." - case .openingSignIn: "Закрываем Steam и ждём завершения его процессов. Затем попробуем открыть окно входа." - } - } } public enum SteamWizardStep: Int, CaseIterable { case choose = 1, create, prepare, steam, signIn, game, profile, done - public var title: String { - switch self { - case .choose: "Выберите игру" - case .create: "Создайте окружение" - case .prepare: "Подготовьте окружение" - case .steam: "Установите Steam" - case .signIn: "Войдите в Steam" - case .game: "Установите игру" - case .profile: "Добавьте игру в библиотеку" - case .done: "Игра добавлена" - } - } } public struct SteamWizardFacts { @@ -486,6 +451,5 @@ public struct SteamWizardDiskState: Sendable { } public enum SteamWizardCopy { - public static let endToEndCaveat = "Сам мастер пока не проверен от начала до конца на чистом окружении." public static func failure(_ lead: String, detail: String) -> String { lead + "\n" + detail } } diff --git a/streamer/Tests/BasaltBottleKitTests/GameFolderCopyTests.swift b/streamer/Tests/BasaltBottleKitTests/GameFolderCopyTests.swift index c865fa9..933abc5 100644 --- a/streamer/Tests/BasaltBottleKitTests/GameFolderCopyTests.swift +++ b/streamer/Tests/BasaltBottleKitTests/GameFolderCopyTests.swift @@ -340,7 +340,7 @@ final class GameFolderCopyTests: XCTestCase { } func testFolderNamesFollowWindowsRules() { - for valid in ["Beat Saber", "hello-xr", "hello_xr 2", "Игра", "COM10", "CONSOLE", + for valid in ["Beat Saber", "hello-xr", "hello_xr 2", "ゲーム", "COM10", "CONSOLE", "a.b", String(repeating: "x", count: GameFolderName.maximumLength)] { XCTAssertNil(GameFolderName.problem(with: valid), valid) XCTAssertEqual(try GameFolderName.validate(valid), valid) diff --git a/streamer/Tests/BasaltCoreTests/AlvrControlTests.swift b/streamer/Tests/BasaltCoreTests/AlvrControlTests.swift index 8a99146..75e8f1b 100644 --- a/streamer/Tests/BasaltCoreTests/AlvrControlTests.swift +++ b/streamer/Tests/BasaltCoreTests/AlvrControlTests.swift @@ -78,13 +78,13 @@ final class AlvrControlTests: XCTestCase { "U+\(String(scalar.value, radix: 16))") } // An ordinary name is untouched, in any script. - var plain = Self.acceptedPrefix(protocolId: 20, name: "Quest 3 — гостиная") + var plain = Self.acceptedPrefix(protocolId: 20, name: "Quest 3 — salón") plain.append(0) guard case .accepted(_, let plainName, _, _) = try AlvrClientConnectionDecoder.decode(plain) else { return XCTFail("expected an accepted connection") } - XCTAssertEqual(plainName, "Quest 3 — гостиная") + XCTAssertEqual(plainName, "Quest 3 — salón") } func testDecodesVideoCapabilitiesAndEmbeddedJSON() throws { diff --git a/streamer/Tests/BasaltCoreTests/HeadsetTrustTests.swift b/streamer/Tests/BasaltCoreTests/HeadsetTrustTests.swift index 8490891..5435513 100644 --- a/streamer/Tests/BasaltCoreTests/HeadsetTrustTests.swift +++ b/streamer/Tests/BasaltCoreTests/HeadsetTrustTests.swift @@ -126,7 +126,7 @@ final class DamagedHeadsetTrustTests: XCTestCase { now: { 0 }, signature: { _ in nil }, read: { _ in [name] }) .accept(hostname: name, ip: "192.0.2.1") { _ in XCTFail("an invalid name is never reported") }) } - for name in ["Quest 3", "Quest-3", "Шлем", "クエスト", "Quest at home"] { + for name in ["Quest 3", "Quest-3", "헤드셋", "クエスト", "Quest at home"] { XCTAssertTrue(HeadsetTrustStore.validHostname(name), name) } } diff --git a/streamer/Tests/BasaltManagerKitTests/DataFolderCheckTests.swift b/streamer/Tests/BasaltManagerKitTests/DataFolderCheckTests.swift index 9e4953e..63ece5c 100644 --- a/streamer/Tests/BasaltManagerKitTests/DataFolderCheckTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/DataFolderCheckTests.swift @@ -377,12 +377,16 @@ final class DataFolderCheckTests: XCTestCase { text.replacingOccurrences(of: "\u{00A0}", with: " ").replacingOccurrences(of: "\u{202F}", with: " ") } let external = DataFolderVolume(kind: .external, freeBytes: 812_000_000_000) + // The free space is written for the app's language, not always in English units. L10n.language = .ru - XCTAssertEqual(plain(external.summary), "Внешний диск · свободно 812 ГБ") - XCTAssertEqual(DataFolderVolume(kind: .network, freeBytes: nil).summary, "Сетевое хранилище") - XCTAssertEqual(DataFolderKind.thisMac.name, "Диск этого Mac") + let disk = L10n.string(.dataFolderKindExternal, language: .ru, arguments: []) + let free = Int64(812_000_000_000).formatted(.byteCount(style: .file).locale(Locale(identifier: "ru"))) + let summary = L10n.string(.dataFolderKindAndFree, language: .ru, arguments: [disk, free]) + XCTAssertEqual(plain(external.summary), plain(summary)) L10n.language = .en XCTAssertEqual(plain(external.summary), "External disk · 812 GB free") + XCTAssertEqual(DataFolderVolume(kind: .network, freeBytes: nil).summary, "Network storage") + XCTAssertEqual(DataFolderKind.thisMac.name, "This Mac’s disk") XCTAssertEqual(DataFolderVolume(kind: .thisMac, freeBytes: nil).summary, "This Mac’s disk") } @@ -407,19 +411,17 @@ final class DataFolderCheckTests: XCTestCase { XCTAssertTrue(DataFolderProblem.fat32.message.contains("FAT32"), "\(language)") XCTAssertTrue(DataFolderProblem.fat32.message.contains("exFAT"), "\(language)") } - L10n.language = .ru + L10n.language = .en XCTAssertEqual(DataFolderProblem.noSymbolicLinks.message, - "Диск с этой папкой не поддерживает символические ссылки, а без них окружения для игр " - + "не создать. Так бывает в некоторых сетевых папках. Подойдёт диск в формате APFS " - + "или Mac OS Extended.") + "The disk with this folder does not support symbolic links, and game environments cannot " + + "be created without them. This happens on some network shares. A disk formatted as APFS " + + "or Mac OS Extended will work.") XCTAssertEqual(DataFolderProblem.fat32.message, - "Диск с этой папкой в формате FAT32: в нём нельзя хранить файлы больше 4 ГБ, а у игр " - + "такие файлы есть. Подойдёт APFS, Mac OS Extended или exFAT.") - XCTAssertTrue(DataFolderProblem.accessDenied.message.contains( - "Системные настройки › Конфиденциальность и безопасность › Файлы и папки")) - L10n.language = .en - XCTAssertTrue(DataFolderProblem.accessDenied.message.contains( - "System Settings › Privacy & Security › Files and Folders")) + "The disk with this folder is formatted as FAT32: it cannot hold files larger than 4 GB, " + + "and games have such files. APFS, Mac OS Extended or exFAT will work.") + XCTAssertEqual(DataFolderProblem.accessDenied.message, + "macOS does not let TrailBridge use this folder. Allow access in " + + "System Settings › Privacy & Security › Files and Folders.") } } diff --git a/streamer/Tests/BasaltManagerKitTests/DataFolderPathTests.swift b/streamer/Tests/BasaltManagerKitTests/DataFolderPathTests.swift index 2a02f24..9b7d015 100644 --- a/streamer/Tests/BasaltManagerKitTests/DataFolderPathTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/DataFolderPathTests.swift @@ -22,7 +22,7 @@ final class DataFolderPathTests: XCTestCase { ("semicolon", "a;b&c|d>e"), ("newline", "line1\nline2"), ("emoji", "games🎮👨‍👩‍👧"), - ("cyrillic", "Игры ВР"), + ("non-latin", "ゲーム VR"), ("nfc", "caf\u{e9}"), ("nfd", "cafe\u{301}"), ("long-250", String(repeating: "x", count: 250)), @@ -83,7 +83,7 @@ final class DataFolderPathTests: XCTestCase { /// which percent-encodes `;` differently from `URL(fileURLWithPath:)`: /// two unequal URLs of one folder. `loadBottle` compares paths. func testDataFolderURLBuiltByAppendingAComponent() throws { - for (label, name) in Self.names where ["semicolon", "percent-hash", "space", "cyrillic"].contains(label) { + for (label, name) in Self.names where ["semicolon", "percent-hash", "space", "non-latin"].contains(label) { let scratch = try dataFolderScratch() let root = scratch.appendingPathComponent(name, isDirectory: true) .appendingPathComponent("Data", isDirectory: true) diff --git a/streamer/Tests/BasaltManagerKitTests/DiagnosticRedactionTests.swift b/streamer/Tests/BasaltManagerKitTests/DiagnosticRedactionTests.swift index 4b4b35f..d72ac05 100644 --- a/streamer/Tests/BasaltManagerKitTests/DiagnosticRedactionTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/DiagnosticRedactionTests.swift @@ -20,16 +20,16 @@ final class DiagnosticRedactionTests: XCTestCase { } func testReplacesDiskNamesAndKeepsTheRestOfThePath() { - let redactor = makeRedactor(volumeNames: ["Macintosh HD", "Game Disk", "Мой диск"]) + let redactor = makeRedactor(volumeNames: ["Macintosh HD", "Game Disk", "Jeux vidéo"]) let expected = [ "/Volumes/Game Disk/Games/Blood Trail/BloodTrail.exe": "/Volumes/[disk]/Games/Blood Trail/BloodTrail.exe", "The disk /Volumes/Game Disk is not available": "The disk /Volumes/[disk] is not available", - "/Volumes/Мой диск/Steam/steamapps/common/Brutalistick VR": + "/Volumes/Jeux vidéo/Steam/steamapps/common/Brutalistick VR": "/Volumes/[disk]/Steam/steamapps/common/Brutalistick VR", // The same name as the file system may spell it (decomposed). - "/Volumes/Мой диск/Steam".decomposedStringWithCanonicalMapping: + "/Volumes/Jeux vidéo/Steam".decomposedStringWithCanonicalMapping: "/Volumes/[disk]/Steam", // A disk that is not connected now: its name ends at the next slash. "cannot open /Volumes/Ada Lovelace SSD/TrailBridge/Bottles/vr": @@ -81,8 +81,8 @@ final class DiagnosticRedactionTests: XCTestCase { func testRedactsUserNamesInWineJSONAndURLForms() { let redactor = makeRedactor() let expected = [ - "/Users/ada/Library/Application Support/Игры/Blood Trail/save 1.dat": - "~/Library/Application Support/Игры/Blood Trail/save 1.dat", + "/Users/ada/Library/Application Support/ゲーム/Blood Trail/save 1.dat": + "~/Library/Application Support/ゲーム/Blood Trail/save 1.dat", #"Z:\Users\ada\Downloads\Steam Setup.exe"#: #"Z:\Users\[user]\Downloads\Steam Setup.exe"#, #"C:\users\ada\AppData\Local\Blood Trail"#: #"C:\users\[user]\AppData\Local\Blood Trail"#, // A Wine debug string as JSON holds it: four backslashes each. @@ -90,7 +90,7 @@ final class DiagnosticRedactionTests: XCTestCase { "file:///Users/ada/Library/Logs/a%20b.log": "file://~/Library/Logs/a%20b.log", // Another account, or a bottle copied from another Mac. "/Users/adam/Games/file": "/Users/[user]/Games/file", - #"C:\users\Иван\Documents"#: #"C:\users\[user]\Documents"#, + #"C:\users\José\Documents"#: #"C:\users\[user]\Documents"#, // The per-user temporary folder is as good as a name. "/private/var/folders/8k/2x4zr1tn0ld5xq_wq8kzk9mh0000gn/T/BasaltVR-command-1.log": "/private/var/folders/[user]/T/BasaltVR-command-1.log", @@ -102,15 +102,15 @@ final class DiagnosticRedactionTests: XCTestCase { XCTAssertEqual(redactor.redact(text), redacted) } - let spaced = makeRedactor(home: "/Users/Иван Петров", user: "Иван Петров") + let spaced = makeRedactor(home: "/Users/José García", user: "José García") XCTAssertEqual( - spaced.redact("/Users/Иван Петров/Library/Application Support/BasaltVR"), + spaced.redact("/Users/José García/Library/Application Support/BasaltVR"), "~/Library/Application Support/BasaltVR") XCTAssertEqual( - spaced.redact("file:///Users/%D0%98%D0%B2%D0%B0%D0%BD%20%D0%9F%D0%B5%D1%82%D1%80%D0%BE%D0%B2/Library"), + spaced.redact("file:///Users/Jos%C3%A9%20Garc%C3%ADa/Library"), "file://~/Library") XCTAssertEqual( - spaced.redact(#"C:\users\Иван Петров\Saved Games\Blood Trail"#), + spaced.redact(#"C:\users\José García\Saved Games\Blood Trail"#), #"C:\users\[user]\Saved Games\Blood Trail"#) } @@ -167,7 +167,7 @@ final class DiagnosticRedactionTests: XCTestCase { "Game audio capture ready: [audio device], 48000 Hz stereo PCM16", " game audio: BlackHole 2ch, 48 kHz stereo PCM16": " game audio: BlackHole, 48 kHz stereo PCM16", - "Restored Mac audio output to AirPods Pro — Иван": + "Restored Mac audio output to AirPods Pro — José": "Restored Mac audio output to [audio device]", #"Restored Mac audio output to Ada's 27" Display"#: "Restored Mac audio output to [audio device]", @@ -179,7 +179,7 @@ final class DiagnosticRedactionTests: XCTestCase { + "available: MacBook Pro Microphone, Ivan's iPhone Microphone": "error: No CoreAudio input device contains 'BlackHole'; " + "available: [audio device], [audio device]", - "error: Audio device name 'Air' is ambiguous: AirPods Ивана, MacBook Air Microphone": + "error: Audio device name 'Air' is ambiguous: AirPods de José, MacBook Air Microphone": "error: Audio device name '[audio device]' is ambiguous: [audio device], [audio device]", "error: Could not set 'Ivan's Mixer' to 48000 Hz (CoreAudio status 560947818). " + "Check Audio MIDI Setup.": @@ -212,7 +212,7 @@ final class DiagnosticRedactionTests: XCTestCase { // Every line of a log is seen, not only the first or the last. let log = expected.keys.sorted().joined(separator: "\n") + "\n" let redacted = redactor.redact(log) - for name in ["Ivan", "Иван", "AirPods", "MacBook", "Mixer", "Display", "2ch", "16ch"] { + for name in ["Ivan", "José", "AirPods", "MacBook", "Mixer", "Display", "2ch", "16ch"] { XCTAssertFalse(redacted.contains(name), name) } XCTAssertEqual(redacted.components(separatedBy: "\n").count, expected.count + 1) diff --git a/streamer/Tests/BasaltManagerKitTests/GameFolderScanTests.swift b/streamer/Tests/BasaltManagerKitTests/GameFolderScanTests.swift index 5721a5d..43a61e1 100644 --- a/streamer/Tests/BasaltManagerKitTests/GameFolderScanTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/GameFolderScanTests.swift @@ -218,9 +218,11 @@ final class GameFolderScanTests: XCTestCase { L10n.language = .en XCTAssertEqual( GameFolderRefusal.unsupportedEntries(examples: ["Data/link", "pipe"], count: 7).message, - "The folder contains items that cannot be copied safely, such as symbolic links or special files (7 in all): Data/link, pipe") + "The folder contains items that cannot be copied safely, such as symbolic links or special " + + "files (7 in all): Data/link, pipe") XCTAssertEqual(GameFolderRefusal.caseConflicts(examples: ["data", "Data"], count: 1).message, - "The folder contains names that differ only in letter case, which Windows cannot tell apart: data, Data") + "The folder contains names that differ only in letter case, which Windows cannot " + + "tell apart: data, Data") XCTAssertEqual(GameFolderRefusal.tooManyEntries(limit: 100_000).message, "The folder holds more than 100,000 files and folders. Choose the game’s own folder.") XCTAssertEqual(GameFolderRefusal.noExecutable.message, L10n.string(.folderImportNoExecutable)) @@ -236,10 +238,12 @@ final class GameFolderScanTests: XCTestCase { L10n.language = .ru let limit = 100_000.formatted(.number.locale(Locale(identifier: "ru"))) XCTAssertEqual(GameFolderRefusal.tooManyEntries(limit: 100_000).message, - "В папке слишком много файлов и папок: больше \(limit). Выберите папку самой игры.") + L10n.string(.folderImportTooManyEntries, language: .ru, arguments: [limit])) XCTAssertEqual(GameFolderEnvironmentNameProblem.taken.message(for: "beat-saber"), - "Имя «beat-saber» уже занято. Выберите другое.") - XCTAssertTrue(GameFolderHint.steamAPI.message.contains("«Добавить игру Steam…»")) + L10n.string(.folderImportEnvironmentTaken, language: .ru, arguments: ["beat-saber"])) + let addSteam = L10n.string(.libraryAddSteam, language: .ru, arguments: []) + let quotedAddSteam = L10n.string(.learningQuoted, language: .ru, arguments: [addSteam]) + XCTAssertTrue(GameFolderHint.steamAPI.message.contains(quotedAddSteam)) } // MARK: - Names @@ -253,7 +257,7 @@ final class GameFolderScanTests: XCTestCase { let names: [(String, String)] = [ ("Beat Saber", "Beat Saber"), - ("Игра", "Игра"), + ("ゲーム", "ゲーム"), ("hello-xr", "hello-xr"), ("Half-Life: Alyx", "half-life-alyx"), ("Game.", "game"), @@ -329,7 +333,7 @@ final class GameFolderScanTests: XCTestCase { XCTAssertEqual(GameFolderScan.environmentNameProblem("beat-saber-2", taken: taken), .taken) XCTAssertEqual(GameFolderScan.environmentNameProblem("Blood-Trail", taken: []), .taken) XCTAssertEqual(GameFolderScan.environmentNameProblem("brutalistick-vr", taken: []), .taken) - for invalid in ["", "beat saber", "-game", ".game", "игра", "a/b", String(repeating: "a", count: 65)] { + for invalid in ["", "beat saber", "-game", ".game", "ゲーム", "a/b", String(repeating: "a", count: 65)] { XCTAssertEqual(GameFolderScan.environmentNameProblem(invalid, taken: []), .invalid, invalid) } } @@ -397,18 +401,21 @@ final class GameFolderScanTests: XCTestCase { XCTAssertEqual(line(device: 7, free: 300_000_000_000), "Same disk: copied as a clone, almost no extra space") XCTAssertEqual(line(device: 8, free: 300_000_000_000), "Needs 5.2 GB, 300 GB free") XCTAssertEqual(line(device: 8, free: 15_000_000_000), - "Not enough space on the disk: 15 GB free, 26.67 GB needed. TrailBridge always leaves about 20 GB free.") + "Not enough space on the disk: 15 GB free, 26.67 GB needed. TrailBridge always " + + "leaves about 20 GB free.") XCTAssertEqual(line(device: 7, free: 15_000_000_000), - "Not enough space on the disk: 15 GB free, 21.47 GB needed. TrailBridge always leaves about 20 GB free.") + "Not enough space on the disk: 15 GB free, 21.47 GB needed. TrailBridge always " + + "leaves about 20 GB free.") XCTAssertEqual(line(device: 7, free: nil), "Could not read the free space on the disk.") L10n.language = .ru let ru = Locale(identifier: "ru") + let needed = Int64(5_200_000_000).formatted(.byteCount(style: .file).locale(ru)) + let available = Int64(300_000_000_000).formatted(.byteCount(style: .file).locale(ru)) XCTAssertEqual(line(device: 8, free: 300_000_000_000), - "Нужно \(Int64(5_200_000_000).formatted(.byteCount(style: .file).locale(ru))), " - + "свободно \(Int64(300_000_000_000).formatted(.byteCount(style: .file).locale(ru)))") + L10n.string(.folderImportSpaceCopy, language: .ru, arguments: [needed, available])) XCTAssertEqual(line(device: 7, free: 300_000_000_000), - "Тот же диск: копия создаётся клоном и почти не занимает места") + L10n.string(.folderImportSpaceClone, language: .ru, arguments: [])) } // MARK: - Profile diff --git a/streamer/Tests/BasaltManagerKitTests/LaunchFailureAdvisorTests.swift b/streamer/Tests/BasaltManagerKitTests/LaunchFailureAdvisorTests.swift index 1107014..fdda26f 100644 --- a/streamer/Tests/BasaltManagerKitTests/LaunchFailureAdvisorTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/LaunchFailureAdvisorTests.swift @@ -123,10 +123,10 @@ final class LaunchFailureAdvisorTests: XCTestCase { } } - func testRussianAdvice() { + func testEnglishAdvice() { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en func advice( _ cause: LaunchFailureCause, _ connection: StreamConnectionMode = .wifi, ownSettings game: String? = nil ) -> LaunchFailureAdvice { @@ -136,47 +136,47 @@ final class LaunchFailureAdvisorTests: XCTestCase { let wifi = L10n.string(.connectionWiFi) // The streamer still waits for the headset: by the launch's connection. - XCTAssertEqual(advice(.waitingForHeadset).title, "Шлем не подключился") - XCTAssertEqual(advice(.waitingForHeadset, .wifi).text, "Откройте ALVR в шлеме, затем нажмите «Играть».") + XCTAssertEqual(advice(.waitingForHeadset).title, "The headset did not connect") + XCTAssertEqual(advice(.waitingForHeadset, .wifi).text, "Open ALVR in the headset, then click “Play”.") XCTAssertEqual(advice(.waitingForHeadset, .wired).text, - "Наденьте шлем и проверьте, что он разблокирован. Затем нажмите «Играть».") - XCTAssertEqual(advice(.waitingForHeadset, .wired).title, "Шлем не подключился") + "Put on the headset and check that it is unlocked. Then click “Play”.") + XCTAssertEqual(advice(.waitingForHeadset, .wired).title, "The headset did not connect") XCTAssertEqual(advice(.waitingForHeadset, .wired, ownSettings: "Blood Trail").text, advice(.waitingForHeadset, .wired).text) // No adb: the way to Wi-Fi goes through the settings the game uses. - XCTAssertEqual(advice(.adbMissing).title, "Нет инструментов USB") + XCTAssertEqual(advice(.adbMissing).title, "USB tools are missing") XCTAssertEqual(advice(.adbMissing, .wired).text, - "Откройте раздел «Шлем» и нажмите «Скачать Android Platform Tools…». " - + "Или играйте без кабеля: «Настройки» → «Подключение» → «\(wifi)».") + "Open “Headset” and click “Get Android Platform Tools…”. Or play " + + "without the cable: “Settings” → “Connection” → “\(wifi)”.") XCTAssertEqual(advice(.adbMissing, .wired, ownSettings: "Blood Trail").text, - "Откройте раздел «Шлем» и нажмите «Скачать Android Platform Tools…». " - + "Или играйте без кабеля: «Трансляция» → «Изменить…» → " - + "«Настройки трансляции для Blood Trail…» → «Подключение» → «\(wifi)».") - XCTAssertFalse(advice(.adbMissing, .wired, ownSettings: "Blood Trail").text.contains("«Настройки»")) - XCTAssertEqual(advice(.debuggingUnauthorized).title, "Отладка по USB не разрешена") + "Open “Headset” and click “Get Android Platform Tools…”. Or play " + + "without the cable: “Stream” → “Change…” → " + + "“Stream Settings for Blood Trail…” → “Connection” → “\(wifi)”.") + XCTAssertFalse(advice(.adbMissing, .wired, ownSettings: "Blood Trail").text.contains("“Settings”")) + XCTAssertEqual(advice(.debuggingUnauthorized).title, "USB debugging is not allowed") XCTAssertEqual(advice(.debuggingUnauthorized).text, - "Наденьте шлем и разрешите отладку по USB. Если это ваш Mac, отметьте " - + "«Всегда разрешать с этого компьютера». Если запроса нет, выньте кабель и вставьте снова.") - XCTAssertEqual(advice(.noAuthorizedQuest).title, "Шлем по USB не найден") + "Put on the headset and allow USB debugging. If this is your Mac, tick “Always " + + "allow from this computer”. If nothing asks, unplug the cable and plug it in again.") + XCTAssertEqual(advice(.noAuthorizedQuest).title, "No headset found over USB") XCTAssertEqual(advice(.noAuthorizedQuest).text, - "Подключите шлем к этому Mac кабелем USB‑C с передачей данных (не только для зарядки) " - + "и включите шлем. Проверьте, что в приложении Meta Horizon на телефоне " - + "включён режим разработчика.") - XCTAssertEqual(advice(.clientMissing).title, "На шлеме нет ALVR") - XCTAssertEqual(advice(.clientMissing).text, "Откройте раздел «Шлем» и нажмите «Установить на шлем…».") - XCTAssertEqual(advice(.pausedBehindLockScreen).title, "Шлем заблокирован") + "Connect the headset to this Mac with a USB-C cable that carries data (not only " + + "power), and turn the headset on. Check that Developer Mode is on in the Meta " + + "Horizon app on your phone.") + XCTAssertEqual(advice(.clientMissing).title, "ALVR is not on the headset") + XCTAssertEqual(advice(.clientMissing).text, "Open “Headset” and click “Install on Headset…”.") + XCTAssertEqual(advice(.pausedBehindLockScreen).title, "The headset is locked") XCTAssertEqual(advice(.pausedBehindLockScreen).text, - "Наденьте шлем и разблокируйте его. Затем нажмите «Играть».") - XCTAssertEqual(advice(.steamNotSignedIn).title, "Вход в Steam не выполнен") + "Put on the headset and unlock it. Then click “Play”.") + XCTAssertEqual(advice(.steamNotSignedIn).title, "Steam is not signed in") XCTAssertEqual(advice(.steamNotSignedIn).text, - "Откройте раздел «Steam» и нажмите «Открыть Steam и войти». Войдите в Steam. " - + "Затем нажмите «Закрыть Steam». После этого — «Играть».") + "Open “Steam” and click “Open Steam and Sign In”. Sign in to Steam. Then " + + "click “Close Steam”. After that, click “Play”.") - XCTAssertEqual(LaunchFailureAction.open(.headset).title, "Открыть «Шлем»") - XCTAssertEqual(LaunchFailureAction.open(.steam).title, "Открыть «Steam»") - XCTAssertEqual(LaunchFailureAction.restartQuickPath.title, "Запустить VR по шагам") - XCTAssertEqual(L10n.string(.learningHowToFix), "Как исправить") + XCTAssertEqual(LaunchFailureAction.open(.headset).title, "Open “Headset”") + XCTAssertEqual(LaunchFailureAction.open(.steam).title, "Open “Steam”") + XCTAssertEqual(LaunchFailureAction.restartQuickPath.title, "Start VR Step by Step") + XCTAssertEqual(L10n.string(.learningHowToFix), "How to Fix") } /// Advice names a control by the control's own text, in every language. @@ -233,8 +233,8 @@ final class LaunchFailureAdvisorTests: XCTestCase { func testDestinationsUseTheSidebarNames() { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en XCTAssertEqual(LearningDestination.allCases.map(\.title), - ["Подготовка", "Библиотека", "Трансляция", "Steam", "Шлем", "Настройки", "Обучение"]) + ["Setup", "Library", "Stream", "Steam", "Headset", "Settings", "Learning"]) } } diff --git a/streamer/Tests/BasaltManagerKitTests/LearningFirstRunTests.swift b/streamer/Tests/BasaltManagerKitTests/LearningFirstRunTests.swift index a881537..2dc96da 100644 --- a/streamer/Tests/BasaltManagerKitTests/LearningFirstRunTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/LearningFirstRunTests.swift @@ -79,19 +79,20 @@ final class LearningFirstRunTests: XCTestCase { XCTAssertEqual(cabled.chapter, .game) } - func testRussianTexts() throws { + func testEnglishTexts() throws { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en let ready = try XCTUnwrap(LearningFirstRun.invitation(LearningFixture.newcomer)) - XCTAssertEqual(ready.text, "Пройдём путь до первой игры по шагам?") - XCTAssertEqual(ready.note, "Обучение всегда в боковой панели.") - XCTAssertEqual(ready.startTitle, "Начать") - XCTAssertEqual(ready.laterTitle, "Не сейчас") + XCTAssertEqual(ready.text, "Shall we go to your first game step by step?") + XCTAssertEqual(ready.note, "Learning is always in the sidebar.") + XCTAssertEqual(ready.startTitle, "Start") + XCTAssertEqual(ready.laterTitle, "Not Now") let unbuilt = try XCTUnwrap(LearningFirstRun.invitation(LearningFixture.unbuiltMac)) - XCTAssertEqual(unbuilt.text, "Сначала нужно собрать части программы — это делает тот, " - + "кто устанавливал TrailBridge. Пока можно подготовить шлем.") - XCTAssertEqual(unbuilt.startTitle, "Начать") + XCTAssertEqual(unbuilt.text, + "First, parts of the app have to be built. The person who installed TrailBridge " + + "does that. Meanwhile, you can prepare the headset.") + XCTAssertEqual(unbuilt.startTitle, "Start") } /// A packaged app on a new Mac: only the Wine it downloads itself is @@ -99,7 +100,7 @@ final class LearningFirstRunTests: XCTestCase { func testInvitationOnAMacThatOnlyLacksWhatTheSetupPageSupplies() throws { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en var facts = LearningFixture.newcomer facts.setupChecks = LearningFixture.checks().filter { $0.id != "wine" } + [ SetupCheck(id: "wine", title: "wine", detail: "", status: .actionNeeded, @@ -111,14 +112,15 @@ final class LearningFirstRunTests: XCTestCase { XCTAssertFalse(invitation.macReady) XCTAssertTrue(invitation.macFixedOnSetupPage) XCTAssertEqual(invitation.chapter, .mac) - XCTAssertEqual(invitation.text, "Сначала нужно подготовить Mac: приложение само скачает " - + "недостающее или подскажет, что сделать. Начнём с этого?") + XCTAssertEqual(invitation.text, + "First the Mac has to be prepared: the app downloads what is missing or shows " + + "what to do. Shall we start with that?") // One part that has to be built keeps the old words. facts.setupChecks += [SetupCheck(id: "runtime2", title: "runtime", detail: "", status: .actionNeeded, required: true)] let built = try XCTUnwrap(LearningFirstRun.invitation(facts)) XCTAssertFalse(built.macFixedOnSetupPage) - XCTAssertTrue(built.text.hasPrefix("Сначала нужно собрать части программы")) + XCTAssertTrue(built.text.hasPrefix("First, parts of the app have to be built")) XCTAssertFalse(try XCTUnwrap(LearningFirstRun.invitation(LearningFixture.newcomer)).macFixedOnSetupPage) } } diff --git a/streamer/Tests/BasaltManagerKitTests/LearningProgramTests.swift b/streamer/Tests/BasaltManagerKitTests/LearningProgramTests.swift index 6a46f1c..c3092d8 100644 --- a/streamer/Tests/BasaltManagerKitTests/LearningProgramTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/LearningProgramTests.swift @@ -8,10 +8,10 @@ final class LearningProgramTests: XCTestCase { LearningProgram(facts).rows.map(\.status) } - private func russian(_ body: () throws -> Void) rethrows { + private func withEnglish(_ body: () throws -> Void) rethrows { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en try body() } @@ -104,9 +104,9 @@ final class LearningProgramTests: XCTestCase { XCTAssertNil(program.row(.game)?.action) XCTAssertNil(program.row(.firstLaunch)?.action) XCTAssertEqual(program.nextChapter, .mac) - russian { - XCTAssertEqual(program.row(.game)?.statusText, "Сначала: Mac") - XCTAssertEqual(program.row(.launchOptions)?.statusText, "Сначала: Игра") + withEnglish { + XCTAssertEqual(program.row(.game)?.statusText, "First: Mac") + XCTAssertEqual(program.row(.launchOptions)?.statusText, "First: Game") } } @@ -191,10 +191,10 @@ final class LearningProgramTests: XCTestCase { XCTAssertEqual(LearningProgram(facts).row(.headset)?.status, .done) XCTAssertEqual(LearningProgram(facts).row(.headset)?.action, .review) } - russian { + withEnglish { XCTAssertEqual(LearningProgram(paused.with { $0.chapters[.headset].pausedStep = SetupTour.Step.headsetDebugging.rawValue - }).row(.headset)?.statusText, "Шаг 5 из 7") + }).row(.headset)?.statusText, "Step 5 of 7") } } @@ -230,9 +230,9 @@ final class LearningProgramTests: XCTestCase { let row = LearningProgram(facts).row(.launchOptions) XCTAssertEqual(row?.status, .paused(step: 3, of: 6)) XCTAssertEqual(row?.action, .resume) - russian { - XCTAssertEqual(row?.statusText, "Шаг 3 из 6") - XCTAssertEqual(row?.action?.title, "Продолжить") + withEnglish { + XCTAssertEqual(row?.statusText, "Step 3 of 6") + XCTAssertEqual(row?.action?.title, "Continue") } var game = LearningFixture.newcomer @@ -331,45 +331,45 @@ final class LearningProgramTests: XCTestCase { func testRowButtons() { let page = LearningPage(LearningFixture.withGame.with { $0.firstRunAnswered = true }) XCTAssertEqual(page.rows.map(\.action), [.review, .start, .review, .start, .start]) - russian { + withEnglish { XCTAssertEqual(page.rows.compactMap(\.action).map(\.title), - ["Повторить", "Начать", "Повторить", "Начать", "Начать"]) + ["Review", "Start", "Review", "Start", "Start"]) // A section without a chapter of its own would be opened so. - XCTAssertEqual(LearningProgramRow.Action.open(.headset).title, "Открыть «Шлем»") + XCTAssertEqual(LearningProgramRow.Action.open(.headset).title, "Open “Headset”") } } - func testRussianTexts() { - russian { + func testEnglishTexts() { + withEnglish { let page = LearningPage(LearningFixture.returning) XCTAssertEqual(page.rows.map(\.title), - ["Mac", "Шлем", "Игра", "Первый запуск", "Варианты запуска"]) + ["Mac", "Headset", "Game", "First Launch", "Launch Options"]) XCTAssertEqual(page.rows.map(\.purpose), [ - "Проверим, что на этом Mac есть всё для VR.", - "Поставим на шлем приложение ALVR. Один раз, по кабелю.", - "Добавим игру: из Steam или из папки.", - "Запустим игру и увидим её в шлеме.", - "Где ещё есть «Играть», кабель или Wi‑Fi, качество.", + "Check that this Mac has everything for VR.", + "Put the ALVR app on the headset. Once, over the cable.", + "Add a game: from Steam or from a folder.", + "Start the game and see it in the headset.", + "Where else “Play” is, cable or Wi-Fi, quality.", ]) XCTAssertEqual(page.rows.map(\.statusText), - ["Готово", "Готово", "Готово", "Готово", "Не начато"]) - XCTAssertEqual(page.summary, "Пройдено 4 из 5") - XCTAssertEqual(LearningPage.showTitle, "Показать") - XCTAssertEqual(LearningPage.hideTitle, "Скрыть") + ["Done", "Done", "Done", "Done", "Not started"]) + XCTAssertEqual(page.summary, "4 of 5 done") + XCTAssertEqual(LearningPage.showTitle, "Show") + XCTAssertEqual(LearningPage.hideTitle, "Hide") XCTAssertEqual(LearningPage.intro, [ - "TrailBridge запускает VR-игры для Windows на этом Mac и показывает их в Quest 3.", - "На шлем ставится приложение ALVR — оно принимает картинку.", - "Игры, проверенные в шлеме, отмечены в списке при добавлении игры из Steam, другие могут не заработать.", + "TrailBridge runs Windows VR games on this Mac and shows them in a Quest 3.", + "The ALVR app goes on the headset: it receives the picture.", + "Games tested in the headset are marked in the list when you add a Steam game. Others may not work.", ]) - XCTAssertEqual(LearningPage.scheme, ["Mac", "кабель или Wi‑Fi", "Quest 3"]) - XCTAssertEqual(LearningPage.needsTitle, "Понадобится") + XCTAssertEqual(LearningPage.scheme, ["Mac", "cable or Wi-Fi", "Quest 3"]) + XCTAssertEqual(LearningPage.needsTitle, "You Will Need") XCTAssertEqual(LearningPage.needs, [ - "Кабель USB‑C для передачи данных", - "Телефон с приложением Meta Horizon", - "Взрослый с аккаунтом Meta", - "Логин Steam и телефон для Steam Guard", - "Место на диске: на этом Mac, внешнем диске или в сетевом хранилище — папка выбирается в «Настройках»", - "Время на загрузку игры", + "A USB-C cable that carries data", + "A phone with the Meta Horizon app", + "An adult with a Meta account", + "Your Steam sign-in, and the phone for Steam Guard", + "Disk space: on this Mac, an external disk or network storage, as you choose in Settings", + "Time for the game to download", ]) } } diff --git a/streamer/Tests/BasaltManagerKitTests/LearningReadinessTests.swift b/streamer/Tests/BasaltManagerKitTests/LearningReadinessTests.swift index 7021507..f7e6988 100644 --- a/streamer/Tests/BasaltManagerKitTests/LearningReadinessTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/LearningReadinessTests.swift @@ -107,7 +107,7 @@ final class LearningReadinessTests: XCTestCase { // "Checking…", whatever an earlier poll answered. let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en for polled in [false, true] { var snapshot = LearningReadinessSnapshot() snapshot.connection = .wired @@ -118,7 +118,7 @@ final class LearningReadinessTests: XCTestCase { XCTAssertEqual(headset.status, .info) XCTAssertEqual(headset.detail, .usbNotChecked) XCTAssertEqual(headset.connection, .wired) - XCTAssertEqual(headset.text, "Не проверено") + XCTAssertEqual(headset.text, "Not checked") } } @@ -385,22 +385,22 @@ final class LearningReadinessTests: XCTestCase { // MARK: - Texts - func testRussianTexts() throws { + func testEnglishTexts() throws { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en - XCTAssertEqual(L10n.string(.learningTitle), "Обучение") - XCTAssertEqual(L10n.string(.learningReadyTitle), "Готов к VR") - XCTAssertEqual(L10n.string(.learningQuickPathTitle), "Как снова запустить VR") + XCTAssertEqual(L10n.string(.learningTitle), "Learning") + XCTAssertEqual(L10n.string(.learningReadyTitle), "Ready for VR") + XCTAssertEqual(L10n.string(.learningQuickPathTitle), "How to Start VR Again") var snapshot = LearningReadinessSnapshot() snapshot.connection = .wired var readiness = LearningReadiness(snapshot) - XCTAssertEqual(readiness.rows.map(\.title), ["Mac", "Шлем", "Игра", "Звук"]) + XCTAssertEqual(readiness.rows.map(\.title), ["Mac", "Headset", "Game", "Audio"]) XCTAssertEqual(readiness.rows.map(\.text), - ["Проверяем…", "Проверяем…", "Пока нет готовых игр", "Без звука игры"]) - XCTAssertEqual(readiness.rows.map(\.caption), [nil, "USB-кабель", nil, nil]) + ["Checking…", "Checking…", "No games ready yet", "No game audio"]) + XCTAssertEqual(readiness.rows.map(\.caption), [nil, "USB Cable", nil, nil]) snapshot.setupCheckFailed = true snapshot.headsetPolled = true @@ -408,60 +408,66 @@ final class LearningReadinessTests: XCTestCase { snapshot.audioDeviceName = "BlackHole 2ch" readiness = LearningReadiness(snapshot) XCTAssertEqual(readiness.rows.map(\.text), - ["Не удалось проверить", "Не удалось проверить", "Пока нет готовых игр", - "BlackHole 2ch (недоступно)"]) + ["Could not check", "Could not check", "No games ready yet", + "BlackHole 2ch (unavailable)"]) snapshot.setupCheckFailed = false snapshot.headsetPollFailed = false snapshot.setupChecks = [check("engine", .actionNeeded), check("runtime", .actionNeeded)] let usbTexts: [(HeadsetStatus, String)] = [ - (HeadsetStatus(connection: .noTools), "Нужны инструменты USB"), - (HeadsetStatus(connection: .none), "Шлем не подключён по USB"), - (HeadsetStatus(connection: .unauthorized), "Нужно разрешить отладку по USB"), - (HeadsetStatus(connection: .connected), "Шлем подключён по USB"), - (HeadsetStatus(connection: .connected, clientInstalled: true), "Шлем подключён по USB"), + (HeadsetStatus(connection: .noTools), "USB tools needed"), + (HeadsetStatus(connection: .none), "No headset connected by USB"), + (HeadsetStatus(connection: .unauthorized), "USB debugging approval needed"), + (HeadsetStatus(connection: .connected), "Headset connected by USB"), + (HeadsetStatus(connection: .connected, clientInstalled: true), "Headset connected by USB"), ] for (status, text) in usbTexts { snapshot.headsetStatus = status XCTAssertEqual(try row(.headset, snapshot).text, text) } - XCTAssertEqual(try row(.mac, snapshot).text, "Не хватает обязательных пунктов: 2") + XCTAssertEqual(try row(.mac, snapshot).text, "Missing required steps: 2") snapshot.setupChecks = [check("engine", .ready)] - XCTAssertEqual(try row(.mac, snapshot).text, "Готово") + XCTAssertEqual(try row(.mac, snapshot).text, "Ready") snapshot.connection = .wifi - XCTAssertEqual(try row(.headset, snapshot).text, "Не проверено") + XCTAssertEqual(try row(.headset, snapshot).text, "Not checked") XCTAssertEqual(try row(.headset, snapshot).caption, L10n.string(.connectionWiFi)) let date = Date(timeIntervalSince1970: 1_800_000_000) snapshot.sessionHistory = [session(.wifi, started: 1_799_999_000, streaming: 1_800_000_000)] - XCTAssertEqual(try row(.headset, snapshot).text, "Последний сеанс: \(Row.dateText(date))") - XCTAssertEqual(Row.dateText(date, timeZone: try XCTUnwrap(TimeZone(identifier: "UTC"))), - "15 янв, 08:00") + XCTAssertEqual(try row(.headset, snapshot).text, "Last session: \(Row.dateText(date))") + let utc = try XCTUnwrap(TimeZone(identifier: "UTC")) + XCTAssertEqual(Row.dateText(date, timeZone: utc), "Jan 15, 08:00") + // Month names come from the app's own table, not from the system's locale data. + L10n.language = .ru + let months = L10n.string(.streamHistoryMonths, language: .ru).components(separatedBy: "|") + XCTAssertEqual(months.count, 12) + XCTAssertEqual(Row.dateText(date, timeZone: utc), "15 \(months[0]), 08:00") + L10n.language = .en snapshot.gameName = "Blood Trail" snapshot.openVRBadge = .needsSetup XCTAssertEqual(try row(.game, snapshot).note, - "У игры метка «Настроить OpenVR». Это догадка по файлам игры, запуску она не мешает. " - + "Если игра не появится в шлеме, нажмите эту метку в разделе «Библиотека». " - + "Если сеанс идёт, сначала нажмите «Остановить».") + "This game is marked “SET UP OPENVR”. That is a guess from the game's files " + + "and does not stop the launch. If the game does not appear in the headset, " + + "click that label in “Library”. If a session is running, click “Stop” first.") } - func testRussianButtonTitlesAndNotes() { + func testEnglishButtonTitlesAndNotes() { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en let cases: [(LearningPrimaryAction, String, String?)] = [ - (.startQuickPath, "Запустить VR по шагам", nil), - (.open(.setup), "Открыть подготовку", nil), - (.open(.library), "Открыть библиотеку", nil), - (.open(.stream), "Открыть страницу трансляции", "Сеанс VR уже идёт."), - (.open(.headset), "Открыть «Шлем»", nil), - (.stopWindowsApp, "Остановить", - "Открыта программа Windows: Steam или установщик. Остановите её, чтобы запустить VR."), - (.recheck, "Проверить снова", nil), - (.wait(.checking), "Проверяем…", nil), - (.wait(.importRunning), "Запустить VR по шагам", "Идёт добавление игры. Дождитесь окончания."), + (.startQuickPath, "Start VR Step by Step", nil), + (.open(.setup), "Open Setup", nil), + (.open(.library), "Open Library", nil), + (.open(.stream), "Open the Stream dashboard", "A VR session is already running."), + (.open(.headset), "Open “Headset”", nil), + (.stopWindowsApp, "Stop", + "A Windows app is open: Steam or an installer. Stop it to start VR."), + (.recheck, "Check Again", nil), + (.wait(.checking), "Checking…", nil), + (.wait(.importRunning), "Start VR Step by Step", "A game is being added. Wait until it finishes."), ] for (action, title, note) in cases { XCTAssertEqual(action.title, title) @@ -529,9 +535,9 @@ final class LearningReadinessTests: XCTestCase { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru - XCTAssertEqual(action.title, "Запустить VR по шагам") - XCTAssertEqual(action.note, "Steam скачивает игру: не останавливайте Steam и не закрывайте TrailBridge.") + L10n.language = .en + XCTAssertEqual(action.title, "Start VR Step by Step") + XCTAssertEqual(action.note, "Steam is downloading a game. Do not stop Steam or quit TrailBridge.") for language in AppLanguage.allCases { L10n.language = language XCTAssertFalse(action.title.isEmpty, "\(language)") diff --git a/streamer/Tests/BasaltManagerKitTests/LearningReturnReminderTests.swift b/streamer/Tests/BasaltManagerKitTests/LearningReturnReminderTests.swift index 3cab918..c5767fc 100644 --- a/streamer/Tests/BasaltManagerKitTests/LearningReturnReminderTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/LearningReturnReminderTests.swift @@ -106,10 +106,10 @@ final class LearningReturnReminderTests: XCTestCase { func testTheLineReadsAsAgreed() { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru - XCTAssertEqual(LearningReturnReminder.text, "Давно не играли? Покажу, как запустить VR") - XCTAssertEqual(LearningReturnReminder.showTitle, "Показать") - XCTAssertEqual(LearningReturnReminder.closeTitle, "Закрыть") + L10n.language = .en + XCTAssertEqual(LearningReturnReminder.text, "Been a while? I'll show you how to start VR") + XCTAssertEqual(LearningReturnReminder.showTitle, "Show") + XCTAssertEqual(LearningReturnReminder.closeTitle, "Close") for language in AppLanguage.allCases { L10n.language = language XCTAssertFalse(LearningReturnReminder.text.isEmpty, "\(language)") diff --git a/streamer/Tests/BasaltManagerKitTests/LearningTestSupport.swift b/streamer/Tests/BasaltManagerKitTests/LearningTestSupport.swift index 8432e47..55b6812 100644 --- a/streamer/Tests/BasaltManagerKitTests/LearningTestSupport.swift +++ b/streamer/Tests/BasaltManagerKitTests/LearningTestSupport.swift @@ -57,8 +57,7 @@ enum LearningFixture { /// What the developer wrapper says when it has no adb to run, as the /// Headset page reports it. - static let wrapperWithoutADB = "Headset command failed: \(AlvrWiredFailure.adbMissing) " - + "In Russian the button is «Скачать Android Platform Tools…».\n" + static let wrapperWithoutADB = "Headset command failed: \(AlvrWiredFailure.adbMissing)\n" /// A new person on a Mac where nothing is built yet. static var unbuiltMac: LearningFacts { diff --git a/streamer/Tests/BasaltManagerKitTests/LearningTopicTests.swift b/streamer/Tests/BasaltManagerKitTests/LearningTopicTests.swift index 069d8f6..8778c49 100644 --- a/streamer/Tests/BasaltManagerKitTests/LearningTopicTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/LearningTopicTests.swift @@ -7,7 +7,7 @@ final class LearningTopicTests: XCTestCase { override func setUp() { super.setUp() previousLanguage = L10n.language - L10n.language = .ru + L10n.language = .en } override func tearDown() { @@ -44,14 +44,15 @@ final class LearningTopicTests: XCTestCase { func testThePageListsThreeTroubleTopicsAndThreeUnderMore() { XCTAssertEqual(LearningTopic.Group.trouble.topics, [.launchFailed, .noSound, .report]) XCTAssertEqual(LearningTopic.Group.more.topics, [.interface, .graphics, .connection]) - XCTAssertEqual(LearningTopic.Group.trouble.title, "Если что-то не работает") - XCTAssertEqual(LearningTopic.Group.more.title, "Ещё") + XCTAssertEqual(LearningTopic.Group.trouble.title, "If something does not work") + XCTAssertEqual(LearningTopic.Group.more.title, "More") XCTAssertEqual(LearningTopic.allCases.map(\.title), [ - "Запуск не удался", "Нет звука в шлеме", "Нужна помощь", - "Интерфейс", "Графика", "Подключение", + "The launch failed", "No sound in the headset", "Getting help", + "The interface", "Graphics", "Connection", ]) - XCTAssertEqual(LearningTopic.launchFailed.purpose, "Где написана причина и где кнопка «Как исправить».") - XCTAssertEqual(LearningTopic.showTitle, "Показать") + XCTAssertEqual(LearningTopic.launchFailed.purpose, + "Where the cause is written and where the “How to Fix” button is.") + XCTAssertEqual(LearningTopic.showTitle, "Show") } func testEveryTopicHasANameAndAPurposeInEveryLanguage() { @@ -74,8 +75,8 @@ final class LearningTopicTests: XCTestCase { var tour = tour(.launchFailed) XCTAssertEqual(tour.steps, [.failedCause, .failedFix]) var hint = try shown(tour) - XCTAssertEqual(hint.label, "Запуск не удался · шаг 1 из 2") - XCTAssertEqual(hint.text, "Если запуск не удался, причина написана здесь, в разделе «Трансляция», под этой меткой.") + XCTAssertEqual(hint.label, "The launch failed · step 1 of 2") + XCTAssertEqual(hint.text, "If a launch fails, the cause is written here, in “Stream”, under this label.") XCTAssertEqual(hint.target, .streamStatus) XCTAssertEqual(hint.section, .stream) XCTAssertEqual(hint.buttons, [.next]) @@ -83,8 +84,9 @@ final class LearningTopicTests: XCTestCase { tour.handle(.next) hint = try shown(tour) - XCTAssertEqual(hint.label, "Запуск не удался · шаг 2 из 2") - XCTAssertEqual(hint.text, "У частых ошибок под причиной появляется кнопка «Как исправить». Она пишет, что нажать.") + XCTAssertEqual(hint.label, "The launch failed · step 2 of 2") + XCTAssertEqual(hint.text, + "For common failures a “How to Fix” button appears under the cause. It says what to press.") // No failure is on screen, so there is no button to point at. XCTAssertNil(hint.target) XCTAssertEqual(hint.buttons, [.back, .done]) @@ -114,7 +116,9 @@ final class LearningTopicTests: XCTestCase { tour.handle(.next) let hint = try shown(tour) XCTAssertEqual(hint.target, .streamHowToFix) - XCTAssertEqual(hint.text, "Сейчас причина — «На шлеме нет ALVR». Нажмите «Как исправить» под ней: подсказка скажет, что сделать.") + XCTAssertEqual(hint.text, + "The cause now is “ALVR is not on the headset”. Click “How to Fix” under " + + "it: the hint says what to do.") XCTAssertNil(hint.list) // The failure goes: the button is no longer there to point at. feed(&tour) { @@ -131,20 +135,26 @@ final class LearningTopicTests: XCTestCase { var tour = tour(.noSound) XCTAssertEqual(tour.steps, [.soundChoice, .soundFront, .soundBlackHole]) var hint = try shown(tour) - XCTAssertEqual(hint.label, "Нет звука в шлеме · шаг 1 из 3") - XCTAssertEqual(hint.text, "Проверьте список «Звук игры». Обычный выбор — «Звук Mac». Изменение подействует со следующего запуска.") + XCTAssertEqual(hint.label, "No sound in the headset · step 1 of 3") + XCTAssertEqual(hint.text, + "Check the “Game audio” list. The usual choice is “Mac audio”. A change " + + "takes effect at the next launch.") XCTAssertEqual(hint.target, .settingsGameAudio) XCTAssertEqual(hint.section, .settings) tour.handle(.next) hint = try shown(tour) - XCTAssertEqual(hint.text, "Окно игры на Mac должно быть впереди: без этого игры замолкают. TrailBridge сам возвращает его, пока вы не трогаете Mac.") + XCTAssertEqual(hint.text, + "The game's window must be in front on the Mac: without that, games go silent. " + + "TrailBridge brings it back by itself while you leave the Mac alone.") XCTAssertNil(hint.target) XCTAssertEqual(hint.buttons, [.back, .next]) tour.handle(.next) hint = try shown(tour) - XCTAssertEqual(hint.text, "Запасной вариант — BlackHole. Он ставится отдельно: «Скачать BlackHole…» ниже, затем перезагрузите Mac и выберите его в списке.") + XCTAssertEqual(hint.text, + "The fallback is BlackHole. It is installed separately: “Get BlackHole…” " + + "below, then restart the Mac and choose it in the list.") XCTAssertEqual(hint.target, .settingsGameAudio) XCTAssertEqual(hint.buttons, [.back, .done]) } @@ -155,7 +165,8 @@ final class LearningTopicTests: XCTestCase { tour.handle(.next) tour.handle(.next) let text = try shown(tour).text - XCTAssertEqual(text, "Запасной вариант — BlackHole: если при «Звук Mac» звука нет, выберите его в этом списке.") + XCTAssertEqual(text, + "The fallback is BlackHole: choose it in this list if there is no sound with “Mac audio”.") XCTAssertFalse(text.contains(L10n.string(.settingsGetBlackHole))) } @@ -165,8 +176,10 @@ final class LearningTopicTests: XCTestCase { var tour = tour(.report) let hint = try shown(tour) // One hint: no "step 1 of 1". - XCTAssertEqual(hint.label, "Нужна помощь") - XCTAssertEqual(hint.text, "Нужна помощь? Нажмите «Создать отчёт…». Личные данные заменяются метками. Просмотрите отчёт перед отправкой.") + XCTAssertEqual(hint.label, "Getting help") + XCTAssertEqual(hint.text, + "Need help? Click “Create report…”. Personal data is replaced with labels. " + + "Look through the report before you send it.") XCTAssertEqual(hint.target, .settingsCreateReport) XCTAssertEqual(hint.section, .settings) XCTAssertEqual(hint.buttons, [.done]) @@ -205,8 +218,8 @@ final class LearningTopicTests: XCTestCase { var tour = tour(.interface) XCTAssertEqual(tour.steps, [.interfaceStream, .interfaceCard]) var hint = try shown(tour) - XCTAssertEqual(hint.label, "Интерфейс · шаг 1 из 2") - XCTAssertEqual(hint.text, "Здесь запускают игру и следят за сеансом. Нажмите «Трансляция».") + XCTAssertEqual(hint.label, "The interface · step 1 of 2") + XCTAssertEqual(hint.text, "Games are started and sessions are watched here. Click “Stream”.") XCTAssertEqual(hint.target, .sidebarStream) // The sidebar is on every page: no section is opened for the user. XCTAssertNil(hint.section) @@ -214,7 +227,8 @@ final class LearningTopicTests: XCTestCase { tour.handle(.next) hint = try shown(tour) - XCTAssertEqual(hint.text, "Эта карточка всегда показывает, идёт ли VR. Во время игры в ней есть кнопка «Остановить».") + XCTAssertEqual(hint.text, + "This card always shows whether VR is running. During a game it has a “Stop” button.") XCTAssertEqual(hint.target, .sidebarSession) XCTAssertNil(hint.section) XCTAssertEqual(hint.buttons, [.back, .done]) @@ -263,10 +277,10 @@ final class LearningTopicTests: XCTestCase { var tour = tour(.graphics) XCTAssertEqual(tour.steps, [.graphicsRecommended]) var hint = try shown(tour) - XCTAssertEqual(hint.label, "Графика") + XCTAssertEqual(hint.label, "Graphics") XCTAssertEqual(hint.target, .settingsUseRecommended) XCTAssertEqual(hint.section, .settings) - XCTAssertEqual(hint.text, L10n.string(.learningOptionsRecommended, "Использовать рекомендуемое")) + XCTAssertEqual(hint.text, L10n.string(.learningOptionsRecommended, "Use recommended")) XCTAssertEqual(hint.buttons, [.done]) // The button was pressed: the same hint says so. feed(&tour) { @@ -275,32 +289,39 @@ final class LearningTopicTests: XCTestCase { } hint = try shown(tour) XCTAssertEqual(hint.id, "topic-graphicsRecommended") - XCTAssertEqual(hint.text, L10n.string(.learningOptionsRecommendedSet, "Использовать рекомендуемое")) + XCTAssertEqual(hint.text, L10n.string(.learningOptionsRecommendedSet, "Use recommended")) XCTAssertNil(hint.section) } // MARK: - Connection func testConnectionSaysWhenToChooseWhich() throws { + L10n.language = .ru + let wifi = L10n.string(.connectionWiFi, language: .ru, arguments: []) + let usb = L10n.string(.connectionUSB, language: .ru, arguments: []) + let title = L10n.string(.streamConnection, language: .ru, arguments: []) + let label = L10n.string(.learningChapterStepLabel, language: .ru, arguments: [title, Int64(1), Int64(2)]) var tour = tour(.connection) XCTAssertEqual(tour.steps, [.connectionWiFi, .connectionUSB]) var hint = try shown(tour) - XCTAssertEqual(hint.label, "Подключение · шаг 1 из 2") - XCTAssertEqual(hint.text, "Wi‑Fi — без провода. Подходит, если роутер мощный (Wi‑Fi 6E или 7) и стоит рядом, в той же комнате.") + XCTAssertEqual(hint.label, label) + XCTAssertEqual(hint.text, L10n.string(.learningConnectionWiFi, language: .ru, arguments: [wifi])) XCTAssertEqual(hint.target, .settingsConnection) XCTAssertEqual(hint.section, .settings) tour.handle(.next) hint = try shown(tour) - XCTAssertEqual(hint.text, "USB-кабель — если роутер слабый или далеко: картинка будет ровнее, без рывков от сети.") + XCTAssertEqual(hint.text, L10n.string(.learningConnectionUSB, language: .ru, arguments: [usb])) XCTAssertEqual(hint.target, .settingsConnection) XCTAssertEqual(hint.buttons, [.back, .done]) L10n.language = .en XCTAssertEqual(try shown(tour).text, - "USB Cable — when the router is weak or far away: the picture stays smoother, without network stutter.") + "USB Cable — when the router is weak or far away: the picture stays smoother, " + + "without network stutter.") tour.handle(.back) XCTAssertEqual(try shown(tour).text, - "Wi-Fi — no cable. Choose it when the router is strong (Wi-Fi 6E or 7) and close, in the same room.") + "Wi-Fi — no cable. Choose it when the router is strong (Wi-Fi 6E or 7) and " + + "close, in the same room.") } // MARK: - A game with its own settings @@ -319,18 +340,20 @@ final class LearningTopicTests: XCTestCase { XCTAssertEqual(try shown(tour).buttons, [.next]) tour.handle(.next) let hint = try shown(tour) - XCTAssertEqual(hint.label, "Графика · шаг 2 из 2") - XCTAssertEqual(hint.text, "У игры «Blood Trail» свои настройки: «Качество» для неё меняется в «Изменить…» → «Настройки трансляции для …».") + XCTAssertEqual(hint.label, "Graphics · step 2 of 2") + XCTAssertEqual(hint.text, + "“Blood Trail” has its own settings: “Quality” is changed for it in " + + "“Change…”, then “Stream Settings for …”.") XCTAssertNil(hint.target) XCTAssertEqual(hint.buttons, [.back, .done]) var sound = self.tour(.noSound, own) sound.handle(.next) - XCTAssertTrue(try shown(sound).text.contains("«Звук игры» для неё меняется")) + XCTAssertTrue(try shown(sound).text.contains("“Game audio” is changed for it")) var connection = self.tour(.connection, own) connection.handle(.next) connection.handle(.next) - XCTAssertTrue(try shown(connection).text.contains("«Подключение» для неё меняется")) + XCTAssertTrue(try shown(connection).text.contains("“Connection” is changed for it")) } func testAHintAboutOwnSettingsGoesWhenTheGameLosesThem() throws { @@ -526,20 +549,24 @@ final class LearningTopicTests: XCTestCase { func testThereAreExactlyFourBadgesBesideTheirControls() { XCTAssertEqual(LearningHelpBadge.allCases, [.connection, .quality, .gameAudio, .openVR]) XCTAssertEqual(LearningHelpBadge.allCases.map(\.controlTitle), - ["Подключение", "Качество", "Звук игры", "Поддержка OpenVR"]) - XCTAssertEqual(LearningHelpBadge.quality.label, "Что это: Качество") + ["Connection", "Quality", "Game audio", "OpenVR support"]) + XCTAssertEqual(LearningHelpBadge.quality.label, "What is this: Quality") } - func testRussianBadgeTexts() { + func testEnglishBadgeTexts() { XCTAssertEqual(LearningHelpBadge.connection.text, - "Wi‑Fi — без провода. Подходит, если роутер мощный (Wi‑Fi 6E или 7) и стоит рядом, в той же комнате. " - + "USB-кабель — если роутер слабый или далеко: картинка будет ровнее, без рывков от сети.") + "Wi-Fi — no cable. Choose it when the router is strong (Wi-Fi 6E or 7) and " + + "close, in the same room. USB Cable — when the router is weak or far away: " + + "the picture stays smoother, without network stutter.") XCTAssertEqual(LearningHelpBadge.quality.text, - "Выше качество — чётче картинка и больше работы для Mac. Не знаете, что выбрать — нажмите «Использовать рекомендуемое».") + "Higher quality means a sharper picture and more work for the Mac. If you are " + + "not sure, click “Use recommended”.") XCTAssertEqual(LearningHelpBadge.gameAudio.text, - "Откуда брать звук игры для шлема. Обычный выбор — «Звук Mac»; BlackHole — запасной вариант.") + "Where the game's sound for the headset comes from. The usual choice is " + + "“Mac audio”; BlackHole is the fallback.") XCTAssertEqual(LearningHelpBadge.openVR.text, - "Плагин позволяет игре, сделанной для SteamVR, работать без SteamVR. Включайте его, если у игры метка «Настроить OpenVR».") + "The plug-in lets a game made for SteamVR run without SteamVR. Turn it on when " + + "the game's label says “SET UP OPENVR”.") } func testBadgesAreShortAndNameControlsInEveryLanguage() { diff --git a/streamer/Tests/BasaltManagerKitTests/LocalizationTests.swift b/streamer/Tests/BasaltManagerKitTests/LocalizationTests.swift index e421cf1..50a3a5a 100644 --- a/streamer/Tests/BasaltManagerKitTests/LocalizationTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/LocalizationTests.swift @@ -64,12 +64,13 @@ final class LocalizationTests: XCTestCase { L10n.string(.engineDownloadGuidance, L10n.string(.setupEngineDownload, "11.10"), L10n.string(.sidebarSetup)), "Wine has not been downloaded yet. Open “Setup” and click “Download Wine 11.10…”.") - L10n.language = .ru - XCTAssertEqual(L10n.string(.setupEngineDownload, PinnedWine.download.version), "Скачать Wine 11.10…") + // Another language puts the same version, button and page in its own sentence. + L10n.language = .de + XCTAssertEqual(L10n.string(.setupEngineDownload, PinnedWine.download.version), "Wine 11.10 laden…") XCTAssertEqual( L10n.string(.engineDownloadGuidance, L10n.string(.setupEngineDownload, "11.10"), L10n.string(.sidebarSetup)), - "Wine ещё не скачан. Откройте «Подготовка» и нажмите «Скачать Wine 11.10…».") + "Wine wurde noch nicht geladen. „Einrichtung“ öffnen und auf „Wine 11.10 laden…“ klicken.") } /// No text of the Setup page sends a person to build what the app @@ -216,10 +217,11 @@ final class LocalizationTests: XCTestCase { } func testLanguageMetadata() { - XCTAssertEqual(AppLanguage.allCases.map(\.nativeName), [ - "English", "Русский", "Italiano", "Deutsch", "Español", "Français", "Українська", "Polski", "한국어", "日本語" - ]) for language in AppLanguage.allCases { + // Each table spells its language as the system does: "Deutsch", "日本語". + let own = language.locale.localizedString(forLanguageCode: language.rawValue)? + .capitalized(with: language.locale) + XCTAssertEqual(language.nativeName, own, language.rawValue) XCTAssertEqual(language.isReviewed, language == .en || language == .ru) XCTAssertEqual(language.locale.language.languageCode?.identifier, language.rawValue) } @@ -231,10 +233,10 @@ final class LocalizationTests: XCTestCase { L10n.language = .en XCTAssertEqual(L10n.string(.aboutVersion, "0.2.0", "83"), "Version 0.2.0 (build 83)") XCTAssertEqual(L10n.string(.librarySearchEmpty, "100%"), "No results for “100%”") - L10n.language = .ru - XCTAssertEqual(L10n.string(.aboutVersion, "0.2.0", "83"), "Версия 0.2.0 (сборка 83)") - XCTAssertEqual(L10n.string(.sidebarLibrary), "Библиотека") - XCTAssertEqual(L10n.string(.sidebarMissingSteps, Int64(2)), "Не хватает обязательных пунктов: 2") + L10n.language = .de + XCTAssertEqual(L10n.string(.aboutVersion, "0.2.0", "83"), "Version 0.2.0 (Build 83)") + XCTAssertEqual(L10n.string(.sidebarLibrary), "Bibliothek") + XCTAssertEqual(L10n.string(.sidebarMissingSteps, Int64(2)), "Fehlende Pflichtschritte: 2") L10n.language = .ko XCTAssertEqual(L10n.string(.setupProgress, Int64(2), Int64(5)), "5개 중 2개 준비됨") L10n.language = .ja @@ -248,15 +250,25 @@ final class LocalizationTests: XCTestCase { XCTAssertEqual(L10n.plural(.libraryGameCount, 0), "0 games") XCTAssertEqual(L10n.plural(.libraryGameCount, 1), "1 game") XCTAssertEqual(L10n.plural(.libraryGameCount, 2), "2 games") - L10n.language = .ru - for (count, noun) in [(1, "игра"), (2, "игры"), (5, "игр"), (11, "игр"), (21, "игра"), (22, "игры")] { - XCTAssertEqual(L10n.plural(.libraryGameCount, count), "\(count) \(noun)") - } - XCTAssertEqual(L10n.plural(.libraryHiddenGames, 22), "22 игры Steam скрыты фильтром «Только VR-игры»") - L10n.language = .uk - for (count, noun) in [(1, "гра"), (2, "гри"), (5, "ігор"), (11, "ігор"), (21, "гра"), (22, "гри")] { - XCTAssertEqual(L10n.plural(.libraryGameCount, count), "\(count) \(noun)") + // Russian and Ukrainian: 1 and 21 take the "one" form, 2 and 22 "few", 5 and 11 "many". + let categories: [(Int, PluralCategory)] = [ + (1, .one), (2, .few), (5, .many), (11, .many), (21, .one), (22, .few) + ] + for language in [AppLanguage.ru, .uk] { + L10n.language = language + let forms = LocalizationTables.table(for: language)?.plurals[.libraryGameCount] ?? [:] + XCTAssertEqual(Set([PluralCategory.one, .few, .many].compactMap { forms[$0] }).count, 3, + language.rawValue) + for (count, category) in categories { + XCTAssertEqual(L10n.plural(.libraryGameCount, count), + String(format: forms[category] ?? "", locale: language.locale, Int64(count)), + "\(language.rawValue) \(count)") + } } + L10n.language = .ru + let hidden = LocalizationTables.table(for: .ru)?.plurals[.libraryHiddenGames]?[.few] ?? "" + XCTAssertEqual(L10n.plural(.libraryHiddenGames, 22), + String(format: hidden, locale: AppLanguage.ru.locale, Int64(22))) L10n.language = .pl for (count, noun) in [(1, "gra"), (2, "gry"), (5, "gier"), (11, "gier"), (21, "gier"), (22, "gry")] { XCTAssertEqual(L10n.plural(.libraryGameCount, count), "\(count) \(noun)") diff --git a/streamer/Tests/BasaltManagerKitTests/QuickPathTourTests.swift b/streamer/Tests/BasaltManagerKitTests/QuickPathTourTests.swift index acedc24..f77b979 100644 --- a/streamer/Tests/BasaltManagerKitTests/QuickPathTourTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/QuickPathTourTests.swift @@ -655,15 +655,15 @@ final class QuickPathTourTests: XCTestCase { func testAnOpenPageSheetKeepsTheSectionAndAsksToCloseIt() throws { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en let sheet = QuickPathEnvironment(onStreamSection: false, pageSheetOpen: true) for state in [tour(.done), tour(.done, .session(.starting))] { let shown = try XCTUnwrap(state.presentation(in: sheet)) XCTAssertFalse(shown.opensStream) XCTAssertNil(shown.target) XCTAssertEqual(shown.buttons, [.back, .checkAgain]) - XCTAssertEqual(shown.text, "Закройте открытое окно, затем нажмите «Проверить снова».") - XCTAssertEqual(shown.title(of: .checkAgain), "Проверить снова") + XCTAssertEqual(shown.text, "Close the open window, then click “Check Again”.") + XCTAssertEqual(shown.title(of: .checkAgain), "Check Again") } // A sheet on the Stream page itself needs no section change. let onStreamWithSheet = QuickPathEnvironment(onStreamSection: true, pageSheetOpen: true) @@ -672,67 +672,96 @@ final class QuickPathTourTests: XCTestCase { XCTAssertEqual(try XCTUnwrap(tour().presentation(in: sheet)).buttons, [.done]) } - func testRussianTexts() throws { + func testEnglishTexts() throws { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en let wifi = try XCTUnwrap(tour(connection: .wifi).presentation(in: onStream)) - XCTAssertEqual(wifi.label, "Порядок запуска · \(L10n.string(.connectionWiFi))") - XCTAssertEqual(wifi.text, "Откройте ALVR в шлеме → снимите шлем → «Играть» → " - + "в первый раз «Разрешить» → наденьте шлем.") - XCTAssertEqual(wifi.title(of: .done), "Готово") + XCTAssertEqual(wifi.label, "Launch order · \(L10n.string(.connectionWiFi))") + XCTAssertEqual(wifi.text, "Open ALVR in the headset → take the headset off → “Play” → " + + "the first time, “Allow” → put the headset on.") + XCTAssertEqual(wifi.title(of: .done), "Done") let usb = try XCTUnwrap(tour(connection: .wired).presentation(in: onStream)) - XCTAssertEqual(usb.label, "Порядок запуска · USB-кабель") - XCTAssertEqual(usb.text, "Подключите кабель. ALVR откроется сам после «Играть». " - + "Шлем должен быть разблокирован.") + XCTAssertEqual(usb.label, "Launch order · USB Cable") + XCTAssertEqual(usb.text, "Connect the cable. ALVR opens by itself after “Play”. " + + "The headset must be unlocked.") let play = try XCTUnwrap(tour(.done).presentation(in: onStream)) - XCTAssertEqual(play.label, "Шаг 1 из 3") - XCTAssertEqual(play.text, "Нажмите «Играть».") - XCTAssertEqual(play.buttons.map(play.title(of:)), ["Назад", "Не получается?"]) + XCTAssertEqual(play.label, "Step 1 of 3") + XCTAssertEqual(play.text, "Click “Play”.") + XCTAssertEqual(play.buttons.map(play.title(of:)), ["Back", "Not working?"]) XCTAssertEqual(play.help?.tips, [ - "Кнопка «Играть» недоступна, пока открыта программа Windows (Steam или установщик) " - + "или добавляется игра. Нажмите «Остановить» или дождитесь окончания.", + "“Play” is not available while a Windows app (Steam or an installer) is open " + + "or a game is being added. Click “Stop”, or wait until it finishes.", ]) XCTAssertEqual(play.help?.options, []) let wait = try XCTUnwrap(tour(.done, .session(.starting)).presentation(in: onStream)) - XCTAssertEqual(wait.label, "Шаг 2 из 3") - XCTAssertEqual(wait.text, "Подождите «В ЭФИРЕ». Если Mac спросит «Разрешить подключение …?» — " - + "нажмите «Разрешить». Если открылось окно Steam — войдите.") + XCTAssertEqual(wait.label, "Step 2 of 3") + XCTAssertEqual(wait.text, "Wait for “LIVE”. If your Mac asks “Allow … to connect?”, " + + "click “Allow”. If a Steam window opens, sign in.") XCTAssertEqual(wait.help?.tips, [ - "Проверьте, что в шлеме открыт ALVR.", - "Если Mac спросил «Разрешить подключение …?» — нажмите «Разрешить».", - "Если открылось окно Steam — войдите.", + "Check that ALVR is open in the headset.", + "If your Mac asks “Allow … to connect?”, click “Allow”.", + "If a Steam window opened, sign in.", ]) let usbWait = try XCTUnwrap( tour(connection: .wired, .done, .session(.starting)).presentation(in: onStream)) - XCTAssertEqual(usbWait.label, "Шаг 2 из 3") - XCTAssertEqual(usbWait.text, "Подождите «В ЭФИРЕ». Если открылось окно Steam — войдите.") + XCTAssertEqual(usbWait.label, "Step 2 of 3") + XCTAssertEqual(usbWait.text, "Wait for “LIVE”. If a Steam window opens, sign in.") XCTAssertEqual(usbWait.help?.tips, [ - "Наденьте шлем и разблокируйте его.", - "Если открылось окно Steam — войдите.", + "Put on the headset and unlock it.", + "If a Steam window opened, sign in.", ]) let picture = try XCTUnwrap( tour(.done, .session(.starting), .session(.live)).presentation(in: onStream)) - XCTAssertEqual(picture.label, "Шаг 3 из 3") - XCTAssertEqual(picture.text, "Картинка идёт в шлем. Наденьте шлем. Закончить — «Остановить».") - XCTAssertEqual(picture.buttons.map(picture.title(of:)), ["Назад", "Не видите игру?"]) + XCTAssertEqual(picture.label, "Step 3 of 3") + XCTAssertEqual(picture.text, "The picture is going to the headset. Put the headset on. " + + "To finish, click “Stop”.") + XCTAssertEqual(picture.buttons.map(picture.title(of:)), ["Back", "Can't see the game?"]) XCTAssertEqual(picture.help?.tips, [ - "Если в разделе «Библиотека» у игры метка «Настроить OpenVR»: нажмите «Остановить», " - + "затем эту метку, включите «Поддержка OpenVR» и снова нажмите «Играть».", - "Проверьте, что в шлеме открыт ALVR.", - "Шлем должен быть включён и разблокирован.", + "If the game in “Library” has the “SET UP OPENVR” label: click “Stop”, " + + "then that label, turn on “OpenVR support”, and click “Play” again.", + "Check that ALVR is open in the headset.", + "The headset must be awake and unlocked.", ]) - XCTAssertEqual(picture.help?.options.map(picture.title(of:)), ["Пропустить шаг"]) + XCTAssertEqual(picture.help?.options.map(picture.title(of:)), ["Skip This Step"]) // The link the Stream page keeps after the quick path: the same tips. let link = QuickPathHelp.cantSeeGame() - XCTAssertEqual(link.title, "Не видите игру?") + XCTAssertEqual(link.title, "Can't see the game?") XCTAssertEqual(link.tips, picture.help?.tips) XCTAssertEqual(link.options, []) - XCTAssertEqual(QuickPathPresentation.closeTitle, "Закрыть подсказки") + XCTAssertEqual(QuickPathPresentation.closeTitle, "Close the Hints") + + // The same steps in another language: every text is translated, none stays English. + func everyText() throws -> [String] { + let steps: [QuickPathPresentation] = [ + try XCTUnwrap(tour(connection: .wifi).presentation(in: onStream)), + try XCTUnwrap(tour(connection: .wired).presentation(in: onStream)), + try XCTUnwrap(tour(.done).presentation(in: onStream)), + try XCTUnwrap(tour(.done, .session(.starting)).presentation(in: onStream)), + try XCTUnwrap(tour(connection: .wired, .done, .session(.starting)).presentation(in: onStream)), + try XCTUnwrap(tour(.done, .session(.starting), .session(.live)).presentation(in: onStream)), + ] + var texts: [String] = [] + for step in steps { + texts += [step.label, step.text] + texts += step.buttons.map(step.title(of:)) + texts += step.help?.tips ?? [] + texts += step.help?.options.map(step.title(of:)) ?? [] + } + texts += [QuickPathHelp.cantSeeGame().title, QuickPathPresentation.closeTitle] + return texts + } + let english = try everyText() + L10n.language = .ru + let translated = try everyText() + XCTAssertEqual(translated.count, english.count) + for (text, original) in zip(translated, english) { + XCTAssertNotEqual(text, original) + } } /// The connection can be changed while the tour is open, for example @@ -740,7 +769,7 @@ final class QuickPathTourTests: XCTestCase { func testTextsFollowTheConnectionPlayLaunchesWithNow() throws { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en func shown(_ tour: QuickPathTour, now connection: StreamConnectionMode?) throws -> QuickPathPresentation { try XCTUnwrap(tour.presentation(in: QuickPathEnvironment( section: .stream, pageSheetOpen: false, connection: connection))) @@ -748,28 +777,28 @@ final class QuickPathTourTests: XCTestCase { // Started over Wi-Fi, Play launches over USB now. let usbOrder = try shown(tour(connection: .wifi), now: .wired) - XCTAssertEqual(usbOrder.label, "Порядок запуска · USB-кабель") - XCTAssertEqual(usbOrder.text, "Подключите кабель. ALVR откроется сам после «Играть». " - + "Шлем должен быть разблокирован.") + XCTAssertEqual(usbOrder.label, "Launch order · USB Cable") + XCTAssertEqual(usbOrder.text, "Connect the cable. ALVR opens by itself after “Play”. " + + "The headset must be unlocked.") let usbWait = try shown(tour(connection: .wifi, .done, .session(.starting)), now: .wired) - XCTAssertEqual(usbWait.text, "Подождите «В ЭФИРЕ». Если открылось окно Steam — войдите.") + XCTAssertEqual(usbWait.text, "Wait for “LIVE”. If a Steam window opens, sign in.") XCTAssertEqual(usbWait.help?.tips, [ - "Наденьте шлем и разблокируйте его.", - "Если открылось окно Steam — войдите.", + "Put on the headset and unlock it.", + "If a Steam window opened, sign in.", ]) // The reverse. let wifiOrder = try shown(tour(connection: .wired), now: .wifi) - XCTAssertEqual(wifiOrder.label, "Порядок запуска · \(L10n.string(.connectionWiFi))") - XCTAssertEqual(wifiOrder.text, "Откройте ALVR в шлеме → снимите шлем → «Играть» → " - + "в первый раз «Разрешить» → наденьте шлем.") + XCTAssertEqual(wifiOrder.label, "Launch order · \(L10n.string(.connectionWiFi))") + XCTAssertEqual(wifiOrder.text, "Open ALVR in the headset → take the headset off → “Play” → " + + "the first time, “Allow” → put the headset on.") let wifiWait = try shown(tour(connection: .wired, .done, .session(.starting)), now: .wifi) - XCTAssertEqual(wifiWait.text, "Подождите «В ЭФИРЕ». Если Mac спросит «Разрешить подключение …?» — " - + "нажмите «Разрешить». Если открылось окно Steam — войдите.") + XCTAssertEqual(wifiWait.text, "Wait for “LIVE”. If your Mac asks “Allow … to connect?”, " + + "click “Allow”. If a Steam window opens, sign in.") XCTAssertEqual(wifiWait.help?.tips, [ - "Проверьте, что в шлеме открыт ALVR.", - "Если Mac спросил «Разрешить подключение …?» — нажмите «Разрешить».", - "Если открылось окно Steam — войдите.", + "Check that ALVR is open in the headset.", + "If your Mac asks “Allow … to connect?”, click “Allow”.", + "If a Steam window opened, sign in.", ]) for (started, now): (StreamConnectionMode, StreamConnectionMode) in [(.wifi, .wired), (.wired, .wifi)] { @@ -806,19 +835,19 @@ final class QuickPathTourTests: XCTestCase { func testFailureShowsTheMatchingAdviceOrAGenericLine() throws { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en let known = try XCTUnwrap(tour( .done, .session(.starting), .session(.failed(L10n.string(.modelWaitingHeadset))) ).presentation(in: onStream)) XCTAssertEqual(known.advice?.cause, .waitingForHeadset) - XCTAssertEqual(known.label, "Шлем не подключился") - XCTAssertEqual(known.text, "Откройте ALVR в шлеме, затем нажмите «Играть».") + XCTAssertEqual(known.label, "The headset did not connect") + XCTAssertEqual(known.text, "Open ALVR in the headset, then click “Play”.") // This advice's own action would start the quick path over, which // "Try again" does already. The strip's cross closes. XCTAssertEqual(known.buttons, [.retry]) XCTAssertEqual(known.primaryButton, .retry) - XCTAssertEqual(known.buttons.map(known.title(of:)), ["Повторить"]) + XCTAssertEqual(known.buttons.map(known.title(of:)), ["Try Again"]) XCTAssertNil(known.target) // The advice follows the connection the tour was started with. @@ -826,7 +855,7 @@ final class QuickPathTourTests: XCTestCase { connection: .wired, .done, .session(.starting), .session(.failed(L10n.string(.modelWaitingHeadset))) ).presentation(in: onStream)) - XCTAssertEqual(usb.text, "Наденьте шлем и проверьте, что он разблокирован. Затем нажмите «Играть».") + XCTAssertEqual(usb.text, "Put on the headset and check that it is unlocked. Then click “Play”.") XCTAssertEqual(usb.buttons, [.retry]) // When the app knows the connection Play launched with, the advice // follows that one, whichever the tour was started with. @@ -845,8 +874,8 @@ final class QuickPathTourTests: XCTestCase { .done, .session(.starting), .session(.failed("The streamer exited with code 9")) ).presentation(in: onStream)) XCTAssertNil(unknown.advice) - XCTAssertEqual(unknown.label, "Сбой сеанса") - XCTAssertEqual(unknown.text, "Запуск не удался. Причина написана в разделе «Трансляция».") + XCTAssertEqual(unknown.label, "Session failed") + XCTAssertEqual(unknown.text, "The launch failed. The reason is shown in “Stream”.") XCTAssertEqual(unknown.buttons, [.retry]) XCTAssertEqual(unknown.primaryButton, .retry) XCTAssertNotEqual(unknown.id, known.id) @@ -855,7 +884,7 @@ final class QuickPathTourTests: XCTestCase { func testFailureOffersTheAdvicesSectionFirstThenTryAgain() throws { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en let failed = tour(connection: .wired, .done, .session(.starting), .session(.failed("Could not start wired ALVR session: \(AlvrWiredFailure.adbMissing)"))) @@ -863,7 +892,7 @@ final class QuickPathTourTests: XCTestCase { XCTAssertEqual(shown.advice?.cause, .adbMissing) XCTAssertEqual(shown.buttons, [.open(.headset), .retry]) XCTAssertEqual(shown.primaryButton, .open(.headset)) - XCTAssertEqual(shown.buttons.map(shown.title(of:)), ["Открыть «Шлем»", "Повторить"]) + XCTAssertEqual(shown.buttons.map(shown.title(of:)), ["Open “Headset”", "Try Again"]) XCTAssertNil(shown.help) XCTAssertEqual(shown.text, LaunchFailureAdvice( cause: .adbMissing, context: LaunchFailureContext(connection: .wired)).text) @@ -887,7 +916,7 @@ final class QuickPathTourTests: XCTestCase { section: .stream, pageSheetOpen: false, gameWithOwnSettings: "Blood Trail"))) XCTAssertEqual(own.advice?.context, LaunchFailureContext(connection: .wired, gameWithOwnSettings: "Blood Trail")) - XCTAssertTrue(own.text.contains("«Настройки трансляции для Blood Trail…»")) + XCTAssertTrue(own.text.contains("“Stream Settings for Blood Trail…”")) XCTAssertNotEqual(own.text, shown.text) // Steam: its own section. @@ -895,7 +924,7 @@ final class QuickPathTourTests: XCTestCase { .done, .session(.starting), .session(.failed(L10n.string(.modelSteamNotSignedIn))) ).presentation(in: onStream)) XCTAssertEqual(steam.buttons, [.open(.steam), .retry]) - XCTAssertEqual(steam.title(of: .open(.steam)), "Открыть «Steam»") + XCTAssertEqual(steam.title(of: .open(.steam)), "Open “Steam”") } /// A hint names a control by the control's own text, in every language. diff --git a/streamer/Tests/BasaltManagerKitTests/SetupTourHeadsetTests.swift b/streamer/Tests/BasaltManagerKitTests/SetupTourHeadsetTests.swift index c632aec..97fa1c7 100644 --- a/streamer/Tests/BasaltManagerKitTests/SetupTourHeadsetTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/SetupTourHeadsetTests.swift @@ -8,7 +8,7 @@ final class SetupTourHeadsetTests: XCTestCase { private typealias Step = SetupTour.Step private let tested = PinnedHeadsetDownload.testedALVR.version - private let intro = "Шлем настраивается по кабелю один раз — даже если потом играть по Wi‑Fi." + private let intro = "The headset is set up over a cable once — even if you play over Wi-Fi later." private let otherError = "Headset command failed: adb: protocol fault" /// A new person on the Headset page; the page has not asked yet. @@ -29,10 +29,10 @@ final class SetupTourHeadsetTests: XCTestCase { try XCTUnwrap(tour.presentation) } - private func russian(_ body: () throws -> Void) rethrows { + private func english(_ body: () throws -> Void) rethrows { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en try body() } @@ -52,19 +52,19 @@ final class SetupTourHeadsetTests: XCTestCase { // MARK: - The whole way func testANewPersonWalksTheSevenSteps() throws { - try russian { + try english { // Started from the Learning page: the Headset page has not asked. var tour = try tour(LearningFixture.newcomer.with { $0.section = .learning }) XCTAssertEqual(tour.phase, .step(.headsetTools)) var hint = try shown(tour) - XCTAssertEqual(hint.label, "Шлем · шаг 1 из 7") - XCTAssertEqual(hint.text, intro + " Проверяем инструменты USB…") + XCTAssertEqual(hint.label, "Headset · step 1 of 7") + XCTAssertEqual(hint.text, intro + " Checking the USB tools…") XCTAssertEqual(hint.target, .headsetStatus) XCTAssertEqual(hint.opensSection(afterShowing: nil), .headset) XCTAssertEqual(hint.buttons, [.help]) XCTAssertNil(hint.primaryButton) XCTAssertEqual(hint.help?.tips, - ["Раздел «Шлем» сам проверяет шлем каждые несколько секунд, пока он открыт."]) + ["“Headset” checks the headset by itself every few seconds while it is open."]) XCTAssertEqual(hint.help?.options, []) // The page opens and asks. The wrapper has no adb to run. @@ -73,14 +73,14 @@ final class SetupTourHeadsetTests: XCTestCase { XCTAssertEqual(tour.phase, .step(.headsetTools)) hint = try shown(tour) XCTAssertEqual(hint.text, intro - + " Нажмите «Скачать Android Platform Tools…», затем «Принять и скачать».") + + " Click “Get Android Platform Tools…”, then “Agree and Download”.") XCTAssertEqual(hint.target, .headsetGetTools) XCTAssertNil(hint.section) XCTAssertEqual(hint.buttons, [.help]) - XCTAssertEqual(hint.buttons.map(hint.title(of:)), ["Не получается?"]) + XCTAssertEqual(hint.buttons.map(hint.title(of:)), ["Not working?"]) XCTAssertEqual(hint.help?.tips, [ - "Если появилась ошибка, причина — в карточке выше, под «Подробнее». " - + "Нажмите «Скачать Android Platform Tools…» ещё раз.", + "If an error appears, its reason is in the card above, under “Details”. " + + "Click “Get Android Platform Tools…” again.", ]) // The confirmation is a sheet: nothing is drawn, nothing moves. @@ -92,50 +92,51 @@ final class SetupTourHeadsetTests: XCTestCase { feed(&tour) { $0.pageSheetOpen = false } XCTAssertEqual(tour.phase, .step(.headsetAccount)) hint = try shown(tour) - XCTAssertEqual(hint.label, "Шлем · шаг 2 из 7") - XCTAssertEqual(hint.text, "Нужен аккаунт разработчика Meta: от 18 лет, с организацией " - + "и подтверждением аккаунта. Это самый трудный шаг — можно попросить помощи.") + XCTAssertEqual(hint.label, "Headset · step 2 of 7") + XCTAssertEqual(hint.text, "You need a Meta developer account: age 18 or over, with an organization " + + "and a verified account. This is the hardest step — you can ask for help.") XCTAssertNil(hint.target) XCTAssertEqual(hint.buttons, [.link(.metaDeveloperSignUp), .confirm]) - XCTAssertEqual(hint.buttons.map(hint.title(of:)), ["Открыть сайт Meta", "Готово"]) + XCTAssertEqual(hint.buttons.map(hint.title(of:)), ["Open Meta's Site", "Done"]) XCTAssertEqual(hint.primaryButton, .confirm) XCTAssertEqual(SetupLink.metaDeveloperSignUp.url.absoluteString, "https://developers.meta.com/horizon/sign-up/") // The site's button opens a page; the tour stays where it is. XCTAssertNil(SetupButton.link(.metaDeveloperSignUp).event) - XCTAssertEqual(hint.help?.title, "Не получается?") + XCTAssertEqual(hint.help?.title, "Not working?") XCTAssertEqual(hint.help?.tips, [ - "На сайте Meta попросит создать организацию (команду разработчиков) и подтвердить аккаунт.", - "Без компании организацию подтверждают своей личностью: Meta называет это " - + "«Admin Verification». Делается один раз.", + "On its site, Meta asks you to create an organization (a developer team) " + + "and to verify the account.", + "Without a company, you verify the organization with your own identity: Meta calls this " + + "“Admin Verification”. It is done once.", ]) XCTAssertEqual(hint.help?.options, []) try press(.confirm, in: &tour) XCTAssertEqual(tour.phase, .step(.headsetDeveloperMode)) hint = try shown(tour) - XCTAssertEqual(hint.label, "Шлем · шаг 3 из 7") - XCTAssertEqual(hint.text, "В телефоне, в Meta Horizon: значок шлема на панели → ваш шлем вверху → " - + "«Headset Settings» (настройки шлема) → включите «Developer Mode» (режим разработчика).") + XCTAssertEqual(hint.label, "Headset · step 3 of 7") + XCTAssertEqual(hint.text, "On your phone, in Meta Horizon: the headset icon in the toolbar → " + + "your headset at the top → “Headset Settings” → turn on “Developer Mode”.") XCTAssertNil(hint.target) XCTAssertEqual(hint.buttons, [.back, .confirm]) XCTAssertEqual(hint.help?.tips, [ - "Если «Developer Mode» не включается, сначала нужен аккаунт разработчика Meta — " - + "это предыдущий шаг.", + "If “Developer Mode” will not turn on, you need a Meta developer account first: " + + "that is the previous step.", ]) try press(.confirm, in: &tour) XCTAssertEqual(tour.phase, .step(.headsetCable)) hint = try shown(tour) - XCTAssertEqual(hint.label, "Шлем · шаг 4 из 7") - XCTAssertEqual(hint.text, "Подключите шлем к этому Mac кабелем USB‑C, который передаёт данные, " - + "и включите шлем. Шаг засчитается сам, когда Mac увидит шлем.") + XCTAssertEqual(hint.label, "Headset · step 4 of 7") + XCTAssertEqual(hint.text, "Connect the headset to this Mac with a USB-C cable that carries data, " + + "and turn the headset on. The step counts itself once the Mac sees the headset.") XCTAssertEqual(hint.target, .headsetStatus) XCTAssertEqual(hint.buttons, [.back, .help]) XCTAssertEqual(hint.help?.tips, [ - "Кабель должен передавать данные, а не только заряжать. Шлем должен быть включён.", - "Проверьте в Meta Horizon, что «Developer Mode» (режим разработчика) включён.", - "Раздел «Шлем» сам проверяет шлем каждые несколько секунд, пока он открыт.", + "The cable must carry data, not only power. The headset must be turned on.", + "Check in Meta Horizon that “Developer Mode” is on.", + "“Headset” checks the headset by itself every few seconds while it is open.", ]) // Waiting: "Next" is not a way on. tour.handle(.next) @@ -145,34 +146,34 @@ final class SetupTourHeadsetTests: XCTestCase { feed(&tour, LearningFixture.headset(.unauthorized)) XCTAssertEqual(tour.phase, .step(.headsetDebugging)) hint = try shown(tour) - XCTAssertEqual(hint.label, "Шлем · шаг 5 из 7") - XCTAssertEqual(hint.text, "В шлеме: «Allow USB debugging?» (разрешить отладку?). Отметьте " - + "«Always allow from this computer» (всегда с этого Mac), затем «Allow» (разрешить).") - XCTAssertEqual(hint.text.count, 145) + XCTAssertEqual(hint.label, "Headset · step 5 of 7") + XCTAssertEqual(hint.text, "In the headset, at “Allow USB debugging?”, tick " + + "“Always allow from this computer”, then choose “Allow”.") + XCTAssertEqual(hint.text.count, 103) XCTAssertEqual(hint.target, .headsetStatus) // The cable is in: nothing before this is left to do again. XCTAssertEqual(hint.buttons, [.help]) XCTAssertEqual(hint.help?.tips, [ - "Запроса нет? Выньте кабель и вставьте снова.", - "Не нажимайте «Don't show again» (больше не показывать): запрос вернётся, только если " - + "в настройках разработчика шлема снова включить «USB Connection Dialog».", - "Шлем должен быть включён и разблокирован.", + "Nothing asks? Unplug the cable and plug it in again.", + "Do not choose “Don't show again”: the request then comes back only after " + + "“USB Connection Dialog” is turned on again in the headset's developer settings.", + "The headset must be awake and unlocked.", ]) // Allowed. No ALVR on the headset. feed(&tour, LearningFixture.headset(.connected)) XCTAssertEqual(tour.phase, .step(.headsetInstall)) hint = try shown(tour) - XCTAssertEqual(hint.label, "Шлем · шаг 6 из 7") - XCTAssertEqual(hint.text, "Нажмите «Установить на шлем…», затем «Скачать и установить». " - + "Не отключайте кабель, пока идёт установка.") + XCTAssertEqual(hint.label, "Headset · step 6 of 7") + XCTAssertEqual(hint.text, "Click “Install on Headset…”, then “Download and Install”. " + + "Keep the cable connected while it installs.") XCTAssertEqual(hint.target, .headsetInstall) XCTAssertEqual(hint.buttons, [.help]) XCTAssertEqual(hint.help?.tips, [ - "Если появилась ошибка, причина — в карточке выше, под «Подробнее». " - + "Нажмите «Установить на шлем…» ещё раз.", - "ALVR уже стоит на шлеме, а здесь написано «Клиент ALVR не установлен»? ALVR, установленный " - + "другим способом, раздел может не видеть. Тогда пропустите шаг.", + "If an error appears, its reason is in the card above, under “Details”. " + + "Click “Install on Headset…” again.", + "ALVR is already on the headset, but it says “ALVR client not installed” here? This section " + + "may not see an ALVR that was installed another way. Skip this step then.", ]) XCTAssertEqual(hint.help?.options, [.skip]) XCTAssertFalse(tour.facts.isDone(.headset)) @@ -181,9 +182,9 @@ final class SetupTourHeadsetTests: XCTestCase { feed(&tour, LearningFixture.headsetReady) XCTAssertEqual(tour.phase, .step(.headsetOpenALVR)) hint = try shown(tour) - XCTAssertEqual(hint.label, "Шлем · шаг 7 из 7") - XCTAssertEqual(hint.text, "В шлеме: кнопка Meta на правом контроллере → меню слева → " - + "«Unknown Sources» (неизвестные источники) → ALVR. Когда ALVR откроется, нажмите «Готово».") + XCTAssertEqual(hint.label, "Headset · step 7 of 7") + XCTAssertEqual(hint.text, "In the headset: the Meta button on the right controller → " + + "the menu on the left → “Unknown Sources” → ALVR. When ALVR opens, click “Done”.") XCTAssertNil(hint.target) XCTAssertEqual(hint.buttons, [.confirm]) XCTAssertEqual(hint.primaryButton, .confirm) @@ -196,7 +197,7 @@ final class SetupTourHeadsetTests: XCTestCase { XCTAssertNil(tour.pausedStep) hint = try shown(tour) XCTAssertEqual(hint.id, "setup-headset-end") - XCTAssertEqual(hint.text, "Глава «Шлем» готова. Дальше — «Игра».") + XCTAssertEqual(hint.text, "The “Headset” chapter is done. Next: “Game”.") XCTAssertEqual(hint.buttons, [.continueTo(.game), .later]) } } @@ -246,10 +247,10 @@ final class SetupTourHeadsetTests: XCTestCase { /// tools are missing, and the download is offered. Any other error is /// shown as an error, and the download is not offered. func testTheToolsStepFollowsThePollResult() throws { - try russian { + try english { // A resumed pass: without the opening sentence. var tour = try tour(onPage, resumeAt: .headsetTools) - XCTAssertEqual(try shown(tour).text, "Проверяем инструменты USB…") + XCTAssertEqual(try shown(tour).text, "Checking the USB tools…") XCTAssertEqual(try shown(tour).target, .headsetStatus) // No adb at all, and the wrapper with nothing behind it. @@ -258,7 +259,7 @@ final class SetupTourHeadsetTests: XCTestCase { tour.handle(.facts(missing)) XCTAssertEqual(tour.phase, .step(.headsetTools)) let hint = try shown(tour) - XCTAssertEqual(hint.text, "Нажмите «Скачать Android Platform Tools…», затем «Принять и скачать».") + XCTAssertEqual(hint.text, "Click “Get Android Platform Tools…”, then “Agree and Download”.") XCTAssertEqual(hint.target, .headsetGetTools) XCTAssertEqual(hint.buttons, [.help]) } @@ -268,14 +269,14 @@ final class SetupTourHeadsetTests: XCTestCase { XCTAssertEqual(tour.phase, .step(.headsetTools)) var hint = try shown(tour) XCTAssertEqual(hint.text, - "Не удалось проверить шлем. Причина — в карточке выше: «Ошибка» → «Подробнее».") + "The headset could not be checked. See the card above: “Error” → “Details”.") XCTAssertEqual(hint.target, .headsetStatus) XCTAssertFalse(hint.text.contains("Android Platform Tools")) XCTAssertEqual(hint.buttons, [.help]) XCTAssertEqual(hint.help?.tips, [ - "Проверьте USB-кабель и разрешение отладки в шлеме. " - + "Если настройка не завершилась, повторите её.", - "Раздел «Шлем» сам проверяет шлем каждые несколько секунд, пока он открыт.", + "Check the USB cable and debugging permission in your headset. " + + "If setup did not finish, try the setup action again.", + "“Headset” checks the headset by itself every few seconds while it is open.", ]) XCTAssertEqual(hint.help?.options, []) @@ -308,12 +309,12 @@ final class SetupTourHeadsetTests: XCTestCase { // MARK: - The opening sentence func testTheOpeningSentenceGoesIntoTheToolsStepOrOntoItsOwnCard() throws { - try russian { + try english { // The tools are missing: the sentence is the step's first words, // and it is not said again. var missing = try tour(onPage.with(LearningFixture.headsetScanFailed(LearningFixture.wrapperWithoutADB))) XCTAssertEqual(missing.headsetIntro, .withTools) - XCTAssertTrue(try shown(missing).text.hasPrefix(intro + " Нажмите")) + XCTAssertTrue(try shown(missing).text.hasPrefix(intro + " Click")) feed(&missing, LearningFixture.headset(.none)) XCTAssertEqual(missing.phase, .step(.headsetAccount)) XCTAssertFalse(try shown(missing).text.contains(intro)) @@ -321,18 +322,18 @@ final class SetupTourHeadsetTests: XCTestCase { // The same with a question that failed. let failed = try tour(onPage.with(LearningFixture.headsetScanFailed(otherError))) XCTAssertEqual(try shown(failed).text, intro - + " Не удалось проверить шлем. Причина — в карточке выше: «Ошибка» → «Подробнее».") + + " The headset could not be checked. See the card above: “Error” → “Details”.") // The tools are there: no step has room for the sentence, so it // gets a card of its own, once. var ready = try tour(noCable) XCTAssertEqual(ready.phase, .step(.headsetIntro)) var hint = try shown(ready) - XCTAssertEqual(hint.label, "Шлем") + XCTAssertEqual(hint.label, "Headset") XCTAssertEqual(hint.text, intro) XCTAssertNil(hint.target) XCTAssertEqual(hint.buttons, [.next]) - XCTAssertEqual(hint.buttons.map(hint.title(of:)), ["Далее"]) + XCTAssertEqual(hint.buttons.map(hint.title(of:)), ["Next"]) XCTAssertNil(hint.help) // The headset shows up meanwhile: the card stays to be read. feed(&ready, LearningFixture.headset(.unauthorized)) @@ -346,7 +347,7 @@ final class SetupTourHeadsetTests: XCTestCase { // "Checking…" for a moment is not the sentence said: the tools // turn out to be there, and the card comes. var checking = try tour(onPage) - XCTAssertEqual(try shown(checking).text, intro + " Проверяем инструменты USB…") + XCTAssertEqual(try shown(checking).text, intro + " Checking the USB tools…") XCTAssertEqual(checking.headsetIntro, .pending) feed(&checking, LearningFixture.headset(.none)) XCTAssertEqual(checking.phase, .step(.headsetIntro)) @@ -445,11 +446,11 @@ final class SetupTourHeadsetTests: XCTestCase { /// "Replace the old ALVR client?" can only be asked when an ALVR is on /// the headset already. func testTheReplaceSentenceNeedsAnotherALVROnTheHeadset() throws { - try russian { - let plain = "Нажмите «Установить на шлем…», затем «Скачать и установить». " - + "Не отключайте кабель, пока идёт установка." - let replace = "Нажмите «Установить на шлем…», затем «Скачать и установить». " - + "Если спросит «Заменить старый клиент ALVR?» — «Удалить и установить»." + try english { + let plain = "Click “Install on Headset…”, then “Download and Install”. " + + "Keep the cable connected while it installs." + let replace = "Click “Install on Headset…”, then “Download and Install”. " + + "If it asks “Replace the Old ALVR Client?”, choose “Uninstall and Install”." let none = try tour(onPage.with(LearningFixture.headset(.connected)), resumeAt: .headsetInstall) XCTAssertEqual(try shown(none).text, plain) for client in ["20.11.0", "21.0.0"] { @@ -526,7 +527,7 @@ final class SetupTourHeadsetTests: XCTestCase { /// Only the open Headset page asks the headset. A step that waits for /// its answer says so when the user leaves, instead of waiting forever. func testAWaitingStepOffersTheHeadsetPageWhenTheUserLeaves() throws { - try russian { + try english { for step in [Step.headsetTools, .headsetCable, .headsetDebugging, .headsetInstall] { let facts: LearningFacts switch step { @@ -546,9 +547,10 @@ final class SetupTourHeadsetTests: XCTestCase { let away = try shown(tour) XCTAssertEqual(away.id, "setup-\(step.rawValue)-away") XCTAssertEqual(away.label, waiting.label) - XCTAssertEqual(away.text, "Этот шаг — в разделе «Шлем»: шлем проверяется, только пока раздел открыт.") + XCTAssertEqual(away.text, "This step is in “Headset”: the headset is checked " + + "only while that section is open.") XCTAssertEqual(away.buttons, [.open(.headset)]) - XCTAssertEqual(away.buttons.map(away.title(of:)), ["Открыть «Шлем»"]) + XCTAssertEqual(away.buttons.map(away.title(of:)), ["Open “Headset”"]) XCTAssertEqual(away.primaryButton, .open(.headset)) XCTAssertNil(SetupButton.open(.headset).event) XCTAssertNil(away.target) @@ -700,7 +702,7 @@ final class SetupTourHeadsetTests: XCTestCase { /// A player on Wi-Fi with no cable in: a review outlines only what is on /// the page now and says where the rest appears. func testAReviewOnAWiFiMacWithoutACable() throws { - try russian { + try english { let facts = LearningFixture.returning.with(LearningFixture.headset(.none)).with { $0.connection = .wifi $0.section = .headset @@ -712,31 +714,31 @@ final class SetupTourHeadsetTests: XCTestCase { let cards: [(Step, String, SetupTarget?)] = [ (.headsetIntro, intro, nil), (.headsetTools, - "Кнопка «Скачать Android Platform Tools…» появляется здесь, только когда инструментов нет.", + "“Get Android Platform Tools…” shows here only while the USB tools are missing.", nil), (.headsetAccount, - "Нужен аккаунт разработчика Meta: от 18 лет, с организацией и подтверждением аккаунта. " - + "Это самый трудный шаг — можно попросить помощи.", nil), + "You need a Meta developer account: age 18 or over, with an organization " + + "and a verified account. This is the hardest step — you can ask for help.", nil), (.headsetDeveloperMode, - "В телефоне, в Meta Horizon: значок шлема на панели → ваш шлем вверху → " - + "«Headset Settings» (настройки шлема) → включите «Developer Mode» (режим разработчика).", + "On your phone, in Meta Horizon: the headset icon in the toolbar → " + + "your headset at the top → “Headset Settings” → turn on “Developer Mode”.", nil), (.headsetCable, - "Здесь видно, подключён ли шлем кабелем USB‑C. Для игры по Wi‑Fi кабель не нужен.", + "This shows whether the headset is connected by a USB-C cable. Playing over Wi-Fi needs no cable.", .headsetStatus), (.headsetDebugging, - "В шлеме: «Allow USB debugging?» (разрешить отладку?). Отметьте «Always allow " - + "from this computer» (всегда с этого Mac), затем «Allow» (разрешить).", nil), + "In the headset, at “Allow USB debugging?”, tick “Always allow " + + "from this computer”, then choose “Allow”.", nil), (.headsetInstall, - "Кнопка «Установить на шлем…» появляется здесь, когда шлем подключён кабелем, " - + "а проверенного ALVR на нём нет.", nil), - (.headsetOpenALVR, "В шлеме: кнопка Meta на правом контроллере → меню слева → " - + "«Unknown Sources» (неизвестные источники) → ALVR.", nil), + "“Install on Headset…” shows here when the headset is connected by cable " + + "and has no tested ALVR on it.", nil), + (.headsetOpenALVR, "In the headset: the Meta button on the right controller → " + + "the menu on the left → “Unknown Sources” → ALVR.", nil), ] for (index, (step, text, target)) in cards.enumerated() { XCTAssertEqual(review.phase, .step(step)) let hint = try shown(review) - XCTAssertEqual(hint.label, "Шлем · обзор, шаг \(index + 1) из 8") + XCTAssertEqual(hint.label, "Headset · review, step \(index + 1) of 8") XCTAssertEqual(hint.text, text, "\(step)") XCTAssertEqual(hint.target, target, "\(step)") // No waiting, no "Done", no "Not working?" button. @@ -751,22 +753,22 @@ final class SetupTourHeadsetTests: XCTestCase { } if step == .headsetAccount { // Both places are taken, so the site is in the list. - XCTAssertEqual(hint.help?.title, "Не получается?") + XCTAssertEqual(hint.help?.title, "Not working?") XCTAssertEqual(hint.help?.options, [.link(.metaDeveloperSignUp)]) - XCTAssertEqual(hint.title(of: .link(.metaDeveloperSignUp)), "Открыть сайт Meta") + XCTAssertEqual(hint.title(of: .link(.metaDeveloperSignUp)), "Open Meta's Site") } review.handle(.next) } XCTAssertEqual(review.phase, .finished) XCTAssertTrue(review.isCompleted) XCTAssertNil(review.pausedStep) - XCTAssertEqual(try shown(review).text, "Глава «Шлем» готова. Дальше — «Варианты запуска».") + XCTAssertEqual(try shown(review).text, "The “Headset” chapter is done. Next: “Launch Options”.") } } /// What is on the page now is outlined, and spoken of as it is. func testAReviewOutlinesWhatIsOnThePageNow() throws { - try russian { + try english { func card(_ step: Step, _ change: (inout LearningFacts) -> Void) throws -> SetupPresentation { var review = try tour(LearningFixture.returning.with { $0.section = .headset }.with(change), .review) @@ -776,13 +778,13 @@ final class SetupTourHeadsetTests: XCTestCase { // The tools are missing: the button is there. var hint = try card(.headsetTools, LearningFixture.headsetScanFailed(LearningFixture.wrapperWithoutADB)) XCTAssertEqual(hint.target, .headsetGetTools) - XCTAssertEqual(hint.text, "Нажмите «Скачать Android Platform Tools…», затем «Принять и скачать».") + XCTAssertEqual(hint.text, "Click “Get Android Platform Tools…”, then “Agree and Download”.") // Not asked yet, or the question failed: no button, no outline. for change in [{ _ in }, LearningFixture.headsetScanFailed(otherError)] as [(inout LearningFacts) -> Void] { hint = try card(.headsetTools, change) XCTAssertNil(hint.target) - XCTAssertTrue(hint.text.hasPrefix("Кнопка «Скачать Android Platform Tools…» появляется")) + XCTAssertTrue(hint.text.hasPrefix("“Get Android Platform Tools…” shows")) } // The request is unanswered: the card says so. XCTAssertEqual(try card(.headsetDebugging, LearningFixture.headset(.unauthorized)).target, @@ -791,11 +793,11 @@ final class SetupTourHeadsetTests: XCTestCase { // Connected without the tested ALVR: the install button is there. hint = try card(.headsetInstall, LearningFixture.headset(.connected)) XCTAssertEqual(hint.target, .headsetInstall) - XCTAssertTrue(hint.text.hasPrefix("Нажмите «Установить на шлем…», затем «Скачать и установить».")) + XCTAssertTrue(hint.text.hasPrefix("Click “Install on Headset…”, then “Download and Install”.")) // With the tested ALVR it is not. hint = try card(.headsetInstall, LearningFixture.headsetReady) XCTAssertNil(hint.target) - XCTAssertTrue(hint.text.hasPrefix("Кнопка «Установить на шлем…» появляется здесь")) + XCTAssertTrue(hint.text.hasPrefix("“Install on Headset…” shows here")) // The status card is on the page in every state. for change in [LearningFixture.headset(.none), LearningFixture.headsetReady, { _ in }] as [(inout LearningFacts) -> Void] { diff --git a/streamer/Tests/BasaltManagerKitTests/SetupTourTests.swift b/streamer/Tests/BasaltManagerKitTests/SetupTourTests.swift index e9d76c2..96754b8 100644 --- a/streamer/Tests/BasaltManagerKitTests/SetupTourTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/SetupTourTests.swift @@ -24,10 +24,10 @@ final class SetupTourTests: XCTestCase { try XCTUnwrap(tour.presentation) } - private func russian(_ body: () throws -> Void) rethrows { + private func english(_ body: () throws -> Void) rethrows { let previous = L10n.language defer { L10n.language = previous } - L10n.language = .ru + L10n.language = .en try body() } @@ -53,15 +53,15 @@ final class SetupTourTests: XCTestCase { // MARK: - Chapter 1: Mac func testMacNamesTheMissingPartsThenWhoBuildsThem() throws { - try russian { + try english { var facts = LearningFixture.unbuiltMac facts.setupChecks = LearningFixture.checks(missing: ["wine", "runtime"]) var tour = try tour(.mac, facts) XCTAssertEqual(tour.phase, .step(.macSummary)) var hint = try shown(tour) - XCTAssertEqual(hint.label, "Mac · шаг 1 из 2") - XCTAssertEqual(hint.text, "Не хватает частей программы: «Запускает игры Windows на Mac», " - + "«Передаёт VR-изображение игры в шлем».") + XCTAssertEqual(hint.label, "Mac · step 1 of 2") + XCTAssertEqual(hint.text, "Parts of the app are missing: “Runs Windows games on your Mac”, " + + "“Connects the game's VR output to the headset”.") XCTAssertEqual(hint.target, .setupSummary) XCTAssertEqual(hint.section, .setup) XCTAssertEqual(hint.buttons, [.next]) @@ -70,13 +70,13 @@ final class SetupTourTests: XCTestCase { tour.handle(.next) XCTAssertEqual(tour.phase, .step(.macWhoBuilds)) hint = try shown(tour) - XCTAssertEqual(hint.label, "Mac · шаг 2 из 2") - XCTAssertEqual(hint.text, "Их собирает тот, кто устанавливал TrailBridge. " - + "Если это были не вы — позовите его. Потом нажмите «Проверить снова».") + XCTAssertEqual(hint.label, "Mac · step 2 of 2") + XCTAssertEqual(hint.text, "The person who installed TrailBridge builds them. " + + "If that was not you, ask them. Then click “Check Again”.") XCTAssertEqual(hint.target, .setupSummary) XCTAssertEqual(hint.buttons, [.back, .checkAgain]) XCTAssertEqual(hint.primaryButton, .checkAgain) - XCTAssertEqual(hint.buttons.map(hint.title(of:)), ["Назад", "Проверить снова"]) + XCTAssertEqual(hint.buttons.map(hint.title(of:)), ["Back", "Check Again"]) } } @@ -95,22 +95,22 @@ final class SetupTourTests: XCTestCase { required: true, action: SetupInspector.copyRosettaCommandAction) let runtime = SetupCheck(id: "runtime", title: "runtime", detail: "", status: .actionNeeded, required: true, action: "Open Build Instructions") - try russian { + try english { for missing in [[wine], [rosetta], [wine, rosetta]] { let tour = try tour(.mac, facts(missing), resumeAt: Step.macWhoBuilds.rawValue) let hint = try shown(tour) - XCTAssertEqual(hint.text, "У каждой в списке ниже есть своя кнопка. " - + "Нажмите её и сделайте то, что написано в строке. " - + "Когда всё закончится, нажмите «Проверить снова».") + XCTAssertEqual(hint.text, "Each has its own button in the list below. " + + "Click it and follow what its row says. " + + "When that is done, click “Check Again”.") XCTAssertEqual(hint.buttons, [.back, .checkAgain]) } // One part that has to be built: the old words. let built = try tour(.mac, facts([wine, runtime]), resumeAt: Step.macWhoBuilds.rawValue) - XCTAssertEqual(try shown(built).text, "Их собирает тот, кто устанавливал TrailBridge. " - + "Если это были не вы — позовите его. Потом нажмите «Проверить снова».") + XCTAssertEqual(try shown(built).text, "The person who installed TrailBridge builds them. " + + "If that was not you, ask them. Then click “Check Again”.") // Rosetta is named in the summary in its row's words. XCTAssertEqual(try shown(try tour(.mac, facts([rosetta]))).text, - "Не хватает частей программы: «Выполняет на Mac код для процессоров Intel».") + "Parts of the app are missing: “Runs code made for Intel processors on the Mac”.") } let previous = L10n.language defer { L10n.language = previous } @@ -156,10 +156,10 @@ final class SetupTourTests: XCTestCase { /// With no checks nobody knows what is missing, and with an unsupported /// Mac nobody could build it: one card, "Check again", never "done". func testMacWithoutChecksOrUnsupportedOffersOnlyCheckAgain() throws { - try russian { + try english { var unknown = try tour(.mac, LearningFacts()) var hint = try shown(unknown) - XCTAssertEqual(hint.text, "Не удалось проверить Mac. Нажмите «Проверить снова».") + XCTAssertEqual(hint.text, "The Mac could not be checked. Click “Check Again”.") XCTAssertEqual(hint.buttons, [.checkAgain]) unknown.handle(.next) unknown.handle(.checkAgain) @@ -170,7 +170,7 @@ final class SetupTourTests: XCTestCase { facts.setupChecks = LearningFixture.checks(unsupportedMac: true) var unsupported = try tour(.mac, facts) hint = try shown(unsupported) - XCTAssertEqual(hint.text, "Для TrailBridge нужны Apple Silicon и macOS 14 или новее.") + XCTAssertEqual(hint.text, "TrailBridge requires Apple Silicon and macOS 14 or later.") XCTAssertEqual(hint.buttons, [.checkAgain]) unsupported.handle(.next) XCTAssertEqual(unsupported.phase, .step(.macSummary)) @@ -180,7 +180,7 @@ final class SetupTourTests: XCTestCase { XCTAssertEqual(unknown.phase, .step(.macSummary)) XCTAssertEqual(try shown(unknown).buttons, [.next]) XCTAssertEqual(try shown(unknown).text, - "Не хватает частей программы: «Запускает игры Windows на Mac».") + "Parts of the app are missing: “Runs Windows games on your Mac”.") } } @@ -225,26 +225,26 @@ final class SetupTourTests: XCTestCase { // MARK: - Chapter 3: Game func testGameStartsWithTheQuestionAndItsTwoAnswers() throws { - try russian { + try english { var tour = try tour(.game, LearningFixture.newcomer) XCTAssertEqual(tour.phase, .step(.gameChoose)) let hint = try shown(tour) - XCTAssertEqual(hint.label, "Игра · шаг 1 из 5") - XCTAssertEqual(hint.text, "Откуда ваша игра: куплена в Steam или лежит папкой на диске? " - + "Нажмите «Из Steam» или «Из папки».") + XCTAssertEqual(hint.label, "Game · step 1 of 5") + XCTAssertEqual(hint.text, "Where is your game: bought on Steam, or in a folder on a disk? " + + "Click “From Steam” or “From a Folder”.") XCTAssertEqual(hint.target, .libraryAddButtons) XCTAssertEqual(hint.section, .library) XCTAssertEqual(hint.buttons, [.choose(.steam), .choose(.folder)]) - XCTAssertEqual(hint.buttons.map(hint.title(of:)), ["Из Steam", "Из папки"]) + XCTAssertEqual(hint.buttons.map(hint.title(of:)), ["From Steam", "From a Folder"]) XCTAssertNil(hint.primaryButton) // The other ways are a quiet link, named and not walked. - XCTAssertEqual(hint.help?.title, "Другие способы") + XCTAssertEqual(hint.help?.title, "Other Ways") XCTAssertEqual(hint.help?.tips, [ - "Установщик из GOG или itch.io: «+» → «Добавить игру…».", - "Beat Saber через BSManager: «+» → «Установить BSManager…».", - "Игра стоит в Whisky или CrossOver: её карточка появится в разделе «Библиотека». " - + "Нажмите на ней «Скопировать в TrailBridge…».", - "Для этих способов пошаговых подсказок пока нет.", + "An installer from GOG or itch.io: “+”, then “Add Game…”.", + "Beat Saber through BSManager: “+”, then “Install BSManager…”.", + "A game installed in Whisky or CrossOver: its card shows in “Library”. " + + "Click “Copy into Basalt…” on it.", + "These ways have no step-by-step hints yet.", ]) XCTAssertEqual(hint.help?.options, []) // The question has no "Next": only an answer moves on. @@ -254,28 +254,28 @@ final class SetupTourTests: XCTestCase { } func testEachAnswerSaysWhatToDoInItsWindowBeforeTheWindowOpens() throws { - try russian { + try english { var steam = try tour(.game, LearningFixture.newcomer) steam.handle(.choose(.steam)) XCTAssertEqual(steam.phase, .step(.gameSteam)) XCTAssertEqual(steam.branch, .steam) var hint = try shown(steam) - XCTAssertEqual(hint.label, "Игра · шаг 2 из 5") - XCTAssertEqual(hint.text, "Нажмите «Добавить игру Steam…». В окне выберите свою игру; " - + "если её нет в списке — «Другая игра». Затем «Далее».") + XCTAssertEqual(hint.label, "Game · step 2 of 5") + XCTAssertEqual(hint.text, "Click “Add Steam Game…”. In the window, pick your game; " + + "if it is not listed, pick “Another game”. Then click “Next”.") XCTAssertEqual(hint.target, .libraryAddSteam) XCTAssertEqual(hint.buttons, [.back, .help]) - XCTAssertEqual(hint.help?.title, "Не получается?") + XCTAssertEqual(hint.help?.title, "Not working?") XCTAssertEqual(hint.help?.options, []) var folder = try tour(.game, LearningFixture.newcomer) folder.handle(.choose(.folder)) XCTAssertEqual(folder.phase, .step(.gameFolder)) hint = try shown(folder) - XCTAssertEqual(hint.text, "Нажмите «Добавить игру из папки…». В окне — «Выбрать папку…», " - + "проверьте выбранный .exe, затем «Добавить игру».") + XCTAssertEqual(hint.text, "Click “Add Game from Folder…”. In the window, click “Choose Folder…”, " + + "check the chosen .exe, then click “Add Game”.") XCTAssertEqual(hint.target, .libraryAddFolder) - XCTAssertEqual(hint.help?.tips, ["Кнопка «Добавить игру» серая, пока не выбран .exe-файл игры."]) + XCTAssertEqual(hint.help?.tips, ["“Add Game” stays grey until the game's .exe file is chosen."]) // "Back" returns to the question, and the other answer can be given. steam.handle(.back) @@ -341,18 +341,18 @@ final class SetupTourTests: XCTestCase { /// In a Library that already has cards the two buttons are in the "+" /// menu, which cannot be outlined: the hint says where it is. func testWithoutTheLargeButtonsTheHintPointsAtThePlusMenu() throws { - try russian { + try english { let facts = LearningFixture.newcomer.with { $0.libraryShowsAddButtons = false } var tour = try tour(.game, facts) XCTAssertNil(try shown(tour).target) tour.handle(.choose(.steam)) XCTAssertNil(try shown(tour).target) - XCTAssertEqual(try shown(tour).text, "Нажмите «+» вверху справа → «Добавить игру Steam…». " - + "В окне выберите свою игру; если её нет в списке — «Другая игра». Затем «Далее».") + XCTAssertEqual(try shown(tour).text, "Click “+” at the top right, then “Add Steam Game…”. " + + "In the window, pick your game; if it is not listed, pick “Another game”. Then click “Next”.") tour.handle(.back) tour.handle(.choose(.folder)) - XCTAssertEqual(try shown(tour).text, "Нажмите «+» вверху справа → «Добавить игру из папки…». " - + "В окне — «Выбрать папку…», проверьте выбранный .exe, затем «Добавить игру».") + XCTAssertEqual(try shown(tour).text, "Click “+” at the top right, then “Add Game from Folder…”. " + + "In the window, click “Choose Folder…”, check the chosen .exe, then click “Add Game”.") } } @@ -377,7 +377,7 @@ final class SetupTourTests: XCTestCase { } func testTheSteamWayToTheEnd() throws { - try russian { + try english { var tour = try tour(.game, LearningFixture.newcomer) tour.handle(.choose(.steam)) // The wizard opens, Steam starts, the wizard is closed mid-download. @@ -390,9 +390,9 @@ final class SetupTourTests: XCTestCase { XCTAssertEqual(tour.phase, .step(.gameWait)) XCTAssertTrue(tour.waitsForGame) var hint = try shown(tour) - XCTAssertEqual(hint.label, "Игра · шаг 3 из 5") - XCTAssertEqual(hint.text, "Не останавливайте Steam и не закрывайте TrailBridge — загрузка " - + "оборвётся. Глава продолжится, когда у игры появится «Играть»; мастер можно открыть снова.") + XCTAssertEqual(hint.label, "Game · step 3 of 5") + XCTAssertEqual(hint.text, "Do not stop Steam or quit TrailBridge: the download would break off. " + + "The chapter goes on when the game gets “Play”; you can open the wizard again.") XCTAssertNil(hint.target) XCTAssertNil(hint.section) XCTAssertEqual(hint.buttons, [.back, .help]) @@ -408,18 +408,18 @@ final class SetupTourTests: XCTestCase { XCTAssertEqual(tour.phase, .step(.gameStopSteam)) XCTAssertFalse(tour.waitsForGame) hint = try shown(tour) - XCTAssertEqual(hint.label, "Игра · шаг 4 из 5") - XCTAssertEqual(hint.text, "Игра добавлена. Steam ещё открыт, поэтому «Играть» недоступна. " - + "Если игра уже скачана, нажмите «Остановить» в боковой панели.") + XCTAssertEqual(hint.label, "Game · step 4 of 5") + XCTAssertEqual(hint.text, "The game is added. Steam is still open, so “Play” is not available. " + + "If the game has finished downloading, click “Stop” in the sidebar.") XCTAssertEqual(hint.target, .sidebarStop) // Steam is stopped: the OpenVR label is next. feed(&tour) { $0.session = .idle } XCTAssertEqual(tour.phase, .step(.gameOpenVR)) hint = try shown(tour) - XCTAssertEqual(hint.label, "Игра · шаг 5 из 5") - XCTAssertEqual(hint.text, "У игры метка «Настроить OpenVR». Нажмите её и включите " - + "«Поддержка OpenVR»; если спросит — «Скачать и включить». Затем «Готово».") + XCTAssertEqual(hint.label, "Game · step 5 of 5") + XCTAssertEqual(hint.text, "The game is marked “SET UP OPENVR”. Click that label and turn on " + + "“OpenVR support”; if asked, click “Download and turn on”. Then click “Done”.") XCTAssertEqual(hint.target, .libraryStatusChip(self.game)) XCTAssertEqual(hint.section, .library) XCTAssertEqual(hint.buttons, [.back, .help]) @@ -433,10 +433,10 @@ final class SetupTourTests: XCTestCase { XCTAssertEqual(tour.phase, .finished) XCTAssertTrue(tour.isCompleted) hint = try shown(tour) - XCTAssertEqual(hint.label, "Игра") - XCTAssertEqual(hint.text, "Глава «Игра» готова. Дальше — «Шлем».") + XCTAssertEqual(hint.label, "Game") + XCTAssertEqual(hint.text, "The “Game” chapter is done. Next: “Headset”.") XCTAssertEqual(hint.buttons, [.continueTo(.headset), .later]) - XCTAssertEqual(hint.buttons.map(hint.title(of:)), ["Дальше", "Позже"]) + XCTAssertEqual(hint.buttons.map(hint.title(of:)), ["Go On", "Later"]) XCTAssertEqual(hint.primaryButton, .continueTo(.headset)) } } @@ -535,7 +535,7 @@ final class SetupTourTests: XCTestCase { } func testTheFolderWayWaitsForTheCopy() throws { - try russian { + try english { var tour = try tour(.game, LearningFixture.newcomer) tour.handle(.choose(.folder)) feed(&tour) { $0.pageSheetOpen = true } @@ -544,7 +544,7 @@ final class SetupTourTests: XCTestCase { feed(&tour) { $0.pageSheetOpen = false } XCTAssertEqual(tour.phase, .step(.gameWait)) XCTAssertEqual(try shown(tour).text, - "Игра копируется. Глава продолжится, когда у игры появится «Играть».") + "The game is being copied. The chapter goes on when the game gets “Play”.") feed(&tour) { $0.importRunning = false $0.launchableGames = [self.game] @@ -555,7 +555,7 @@ final class SetupTourTests: XCTestCase { } func testTheFactsSuggestTheWayFirst() throws { - try russian { + try english { let card = LearningLibraryGame(id: "steam-1", name: "Blood Trail") var tour = try tour(.game, LearningFixture.newcomer.with { $0.libraryShowsAddButtons = false @@ -563,13 +563,13 @@ final class SetupTourTests: XCTestCase { }) XCTAssertEqual(tour.phase, .step(.gameCreateProfile)) var hint = try shown(tour) - XCTAssertEqual(hint.label, "Игра · шаг 1 из 5") - XCTAssertEqual(hint.text, "Игра «Blood Trail» уже здесь. Нажмите «Создать профиль» " - + "на её карточке — появится «Играть».") + XCTAssertEqual(hint.label, "Game · step 1 of 5") + XCTAssertEqual(hint.text, "“Blood Trail” is already here. Click “Create Profile” " + + "on its card: “Play” will appear.") XCTAssertEqual(hint.target, .libraryGameAction("steam-1")) XCTAssertEqual(hint.buttons, [.help]) XCTAssertEqual(hint.help?.options, [.otherWay]) - XCTAssertEqual(hint.help.map { hint.title(of: $0.options[0]) }, "Добавить другую игру") + XCTAssertEqual(hint.help.map { hint.title(of: $0.options[0]) }, "Add Another Game") // The profile appears: the chapter ends. feed(&tour) { $0.steamGameWithoutProfile = nil @@ -586,8 +586,8 @@ final class SetupTourTests: XCTestCase { }) XCTAssertEqual(copy.phase, .step(.gameCopy)) hint = try shown(copy) - XCTAssertEqual(hint.text, "Игра «Beat Saber» стоит в Whisky. Нажмите «Скопировать в " - + "TrailBridge…» на её карточке.") + XCTAssertEqual(hint.text, "“Beat Saber” is installed in Whisky. " + + "Click “Copy into Basalt…” on its card.") XCTAssertEqual(hint.target, .libraryGameAction("whisky-7")) feed(©) { $0.pageSheetOpen = true } feed(©) { @@ -774,26 +774,26 @@ final class SetupTourTests: XCTestCase { // MARK: - Chapter 4: First launch func testFirstLaunchWithTheMacsOwnAudioAsksForSystemAudio() throws { - try russian { + try english { let tour = try tour(.firstLaunch, LearningFixture.withGame.with { $0.gameAudioOn = true $0.gameAudioMac = true }) XCTAssertEqual(tour.phase, .step(.launchMicrophone)) XCTAssertEqual(try shown(tour).text, - "Если macOS спросит разрешение на запись системного звука — нажмите «Разрешить»: " - + "так звук игры попадёт в шлем. Если игра попросит микрофон, это тоже можно разрешить.") + "If macOS asks to record system audio, click “Allow”: that is how the game's sound " + + "gets to the headset. If the game asks for the microphone, you can allow it too.") } } func testFirstLaunchSaysTheMicrophoneSentenceThenHandsOver() throws { - try russian { + try english { var tour = try tour(.firstLaunch, LearningFixture.withGame.with { $0.gameAudioOn = true }) XCTAssertEqual(tour.phase, .step(.launchMicrophone)) let hint = try shown(tour) - XCTAssertEqual(hint.label, "Первый запуск") - XCTAssertEqual(hint.text, "Если macOS спросит доступ к микрофону — нажмите «Разрешить»: " - + "так звук игры попадёт в шлем.") + XCTAssertEqual(hint.label, "First Launch") + XCTAssertEqual(hint.text, "If macOS asks for access to the microphone, click “Allow”: " + + "that is how the game's sound gets to the headset.") XCTAssertNil(hint.target) XCTAssertNil(hint.section) XCTAssertEqual(hint.buttons, [.next]) @@ -820,12 +820,13 @@ final class SetupTourTests: XCTestCase { } func testLaunchOptionsWalkTheSixSteps() throws { - try russian { + try english { var tour = try tour(.launchOptions, optionsFacts) XCTAssertEqual(tour.phase, .step(.optionsLibrary)) var hint = try shown(tour) - XCTAssertEqual(hint.label, "Варианты запуска · шаг 1 из 6") - XCTAssertEqual(hint.text, "Играть можно и отсюда: у каждой игры своя карточка с кнопкой «Играть».") + XCTAssertEqual(hint.label, "Launch Options · step 1 of 6") + XCTAssertEqual(hint.text, "You can play from here too: every game has its own card " + + "with a “Play” button.") // The whole card, not its Play button: nothing is to be pressed. XCTAssertEqual(hint.target, .libraryGameTile(self.game)) XCTAssertEqual(hint.section, .library) @@ -834,14 +835,14 @@ final class SetupTourTests: XCTestCase { tour.handle(.next) XCTAssertEqual(tour.phase, .step(.optionsStream)) hint = try shown(tour) - XCTAssertEqual(hint.label, "Варианты запуска · шаг 2 из 6") - XCTAssertEqual(hint.text, "Второе место запуска — здесь: список «Игра» и «Играть». " - + "Теперь нажмите «Изменить…» → «Общие настройки трансляции…».") + XCTAssertEqual(hint.label, "Launch Options · step 2 of 6") + XCTAssertEqual(hint.text, "The second place to start is here: the “Game” list and “Play”. " + + "Now click “Change…”, then “Global Stream Settings…”.") XCTAssertEqual(hint.target, .streamAdjust) XCTAssertEqual(hint.section, .stream) XCTAssertEqual(hint.buttons, [.back, .help]) XCTAssertEqual(hint.help?.tips, [ - "Кнопка «Изменить…» недоступна, пока идёт сеанс или открыт Steam. Нажмите «Остановить».", + "“Change…” is not available while a session runs or Steam is open. Click “Stop”.", ]) // No "Next" here: the step counts itself. tour.handle(.next) @@ -852,25 +853,25 @@ final class SetupTourTests: XCTestCase { XCTAssertEqual(tour.phase, .step(.optionsConnection)) hint = try shown(tour) - XCTAssertEqual(hint.label, "Варианты запуска · шаг 3 из 6") - XCTAssertEqual(hint.text, "Это «Подключение»: выберите своё. Сейчас — «USB-кабель»: " - + "шлем на проводе, ALVR откроется сам после «Играть».") + XCTAssertEqual(hint.label, "Launch Options · step 3 of 6") + XCTAssertEqual(hint.text, "This is “Connection”: choose yours. Now it is “USB Cable”: " + + "the headset is on the cable, and ALVR opens by itself after “Play”.") XCTAssertEqual(hint.target, .settingsConnection) XCTAssertNil(hint.section) XCTAssertEqual(hint.buttons, [.back, .next]) // The text follows the switch; the step stays. feed(&tour) { $0.connection = .wifi } XCTAssertEqual(tour.phase, .step(.optionsConnection)) - XCTAssertEqual(try shown(tour).text, "Это «Подключение»: выберите своё. Сейчас — «Wi‑Fi»: " - + "Mac и шлем в одной сети; сначала откройте ALVR в шлеме, потом «Играть».") + XCTAssertEqual(try shown(tour).text, "This is “Connection”: choose yours. Now it is “Wi-Fi”: " + + "the Mac and the headset are on one network; open ALVR in the headset first, then click “Play”.") XCTAssertEqual(try shown(tour).id, hint.id) tour.handle(.next) XCTAssertEqual(tour.phase, .step(.optionsRecommended)) hint = try shown(tour) - XCTAssertEqual(hint.label, "Варианты запуска · шаг 4 из 6") - XCTAssertEqual(hint.text, "Не знаете, какое качество выбрать? Нажмите «Использовать " - + "рекомендуемое». Свои значения можно оставить.") + XCTAssertEqual(hint.label, "Launch Options · step 4 of 6") + XCTAssertEqual(hint.text, "Not sure which quality to choose? Click “Use recommended”. " + + "You can also keep your own values.") XCTAssertEqual(hint.target, .settingsUseRecommended) XCTAssertEqual(hint.buttons, [.back, .next]) // Pressed: the step counts itself. @@ -878,25 +879,25 @@ final class SetupTourTests: XCTestCase { XCTAssertEqual(tour.phase, .step(.optionsOwnSettings)) hint = try shown(tour) - XCTAssertEqual(hint.label, "Варианты запуска · шаг 5 из 6") - XCTAssertEqual(hint.text, "У игры могут быть свои настройки: «Изменить…» → " - + "«Настройки трансляции для …».") + XCTAssertEqual(hint.label, "Launch Options · step 5 of 6") + XCTAssertEqual(hint.text, "A game can have its own settings: “Change…”, then " + + "“Stream Settings for …”.") XCTAssertEqual(hint.target, .streamAdjust) XCTAssertEqual(hint.section, .stream) XCTAssertEqual(hint.buttons, [.back, .next]) // The details are a quiet link, not a third button. - XCTAssertEqual(hint.help?.title, "Не получается?") + XCTAssertEqual(hint.help?.title, "Not working?") XCTAssertEqual(hint.help?.tips, [ - "В том окне «Сохранить» делает игре отдельную копию: общие настройки, " - + "и «Подключение» тоже, на неё больше не действуют.", - "Вернуть общие — «Использовать общие» в том же окне.", + "In that window, “Save” gives the game its own copy: the shared settings, " + + "“Connection” included, no longer apply to it.", + "“Use global” in the same window brings the shared settings back.", ]) tour.handle(.next) XCTAssertEqual(tour.phase, .step(.optionsHistory)) hint = try shown(tour) - XCTAssertEqual(hint.label, "Варианты запуска · шаг 6 из 6") - XCTAssertEqual(hint.text, "Здесь ваши прошлые игры; ▶ в строке запускает ту же игру снова.") + XCTAssertEqual(hint.label, "Launch Options · step 6 of 6") + XCTAssertEqual(hint.text, "Your past sessions are here; ▶ in a row starts the same game again.") XCTAssertEqual(hint.target, .streamRecentSessions) XCTAssertEqual(hint.buttons, [.back, .next]) XCTAssertFalse(tour.isCompleted) @@ -906,9 +907,9 @@ final class SetupTourTests: XCTestCase { XCTAssertTrue(tour.isCompleted) hint = try shown(tour) // Every other chapter is done: nothing is next. - XCTAssertEqual(hint.text, "Глава «Варианты запуска» готова.") + XCTAssertEqual(hint.text, "The “Launch Options” chapter is done.") XCTAssertEqual(hint.buttons, [.done]) - XCTAssertEqual(hint.title(of: .done), "Готово") + XCTAssertEqual(hint.title(of: .done), "Done") XCTAssertEqual(hint.primaryButton, .done) tour.handle(.next) XCTAssertEqual(tour.phase, .closed) @@ -935,11 +936,11 @@ final class SetupTourTests: XCTestCase { } func testARecommendedPresetAlreadySelectedIsSaidAndNotSkipped() throws { - try russian { + try english { var tour = try tour(.launchOptions, LearningFixture.returning, resumeAt: "optionsRecommended") XCTAssertEqual(tour.phase, .step(.optionsRecommended)) - XCTAssertEqual(try shown(tour).text, "Качество: рекомендуемое для этого Mac уже выбрано. " - + "Вернуть его всегда можно кнопкой «Использовать рекомендуемое».") + XCTAssertEqual(try shown(tour).text, "Quality: the one recommended for this Mac is already selected. " + + "“Use recommended” always brings it back.") XCTAssertEqual(try shown(tour).buttons, [.back, .next]) // Nothing to wait for: facts do not move it. feed(&tour) { $0.appBusy = true } @@ -961,15 +962,15 @@ final class SetupTourTests: XCTestCase { /// A game with its own stream settings: the switch just shown does not /// apply to it, and the next card says where its switch is. func testAGameWithItsOwnSettingsGetsItsOwnCard() throws { - try russian { + try english { let facts = optionsFacts.with { $0.gameWithOwnSettings = self.game } var tour = try tour(.launchOptions, facts, resumeAt: "optionsConnection") tour.handle(.next) XCTAssertEqual(tour.phase, .step(.optionsOwnConnection)) let hint = try shown(tour) - XCTAssertEqual(hint.label, "Варианты запуска · шаг 3 из 6") - XCTAssertEqual(hint.text, "У игры «BRUTALISTICK VR» свои настройки — подключение для неё " - + "меняется в «Изменить…» → «Настройки трансляции для …».") + XCTAssertEqual(hint.label, "Launch Options · step 3 of 6") + XCTAssertEqual(hint.text, "“BRUTALISTICK VR” has its own settings: its connection is changed " + + "in “Change…”, then “Stream Settings for …”.") XCTAssertNil(hint.target) XCTAssertEqual(hint.buttons, [.back, .next]) tour.handle(.next) @@ -990,14 +991,14 @@ final class SetupTourTests: XCTestCase { } func testSteamOpenComesFirstInLaunchOptions() throws { - try russian { + try english { var tour = try tour(.launchOptions, optionsFacts.with { $0.session = .windowsApp }) XCTAssertEqual(tour.phase, .step(.optionsStop)) let hint = try shown(tour) // A card outside the count. - XCTAssertEqual(hint.label, "Варианты запуска") - XCTAssertEqual(hint.text, "Сейчас открыт Steam, поэтому «Изменить…» недоступна. " - + "Если Steam ничего не скачивает, нажмите «Остановить» в боковой панели.") + XCTAssertEqual(hint.label, "Launch Options") + XCTAssertEqual(hint.text, "Steam is open, so “Change…” is not available. " + + "If Steam is not downloading anything, click “Stop” in the sidebar.") XCTAssertEqual(hint.target, .sidebarStop) XCTAssertNil(hint.section) XCTAssertEqual(hint.buttons, [.help]) @@ -1060,12 +1061,12 @@ final class SetupTourTests: XCTestCase { } func testTheHistoryStepSpeaksOfWhatIsThere() throws { - try russian { + try english { let empty = optionsFacts.with { $0.sessionHistory = [] } XCTAssertEqual(try shown(try tour(.launchOptions, empty, resumeAt: "optionsHistory")).text, - "Здесь появятся ваши игры после первого сеанса; ▶ в строке запустит ту же игру снова.") + "Your sessions will show here after the first one; ▶ in a row starts the same game again.") } } @@ -1120,20 +1121,20 @@ final class SetupTourTests: XCTestCase { } func testTheEndLineNamesTheNextChapterAndClosesOnAnyAnswer() throws { - try russian { + try english { // Mac just turned ready for a new person: the headset is next. var mac = try tour(.mac, LearningFixture.unbuiltMac) feed(&mac) { $0.setupChecks = LearningFixture.checks() } var hint = try shown(mac) XCTAssertEqual(hint.id, "setup-mac-end") - XCTAssertEqual(hint.text, "Глава «Mac» готова. Дальше — «Шлем».") + XCTAssertEqual(hint.text, "The “Mac” chapter is done. Next: “Headset”.") XCTAssertEqual(hint.buttons, [.continueTo(.headset), .later]) XCTAssertNil(hint.target) XCTAssertNil(hint.section) // With ALVR on the headset the Mac sees over USB, the game is next. feed(&mac, LearningFixture.headsetReady) hint = try shown(mac) - XCTAssertEqual(hint.text, "Глава «Mac» готова. Дальше — «Игра».") + XCTAssertEqual(hint.text, "The “Mac” chapter is done. Next: “Game”.") XCTAssertEqual(hint.buttons, [.continueTo(.game), .later]) for button in hint.buttons { @@ -1227,44 +1228,44 @@ final class SetupTourTests: XCTestCase { /// only in another state there is no outline, and the text says where /// the control appears. func testAReviewNeverOutlinesAControlThatIsNotThere() throws { - try russian { + try english { var mac = try tour(.mac, .review, LearningFixture.returning) var hint = try shown(mac) - XCTAssertEqual(hint.label, "Mac · обзор, шаг 1 из 1") - XCTAssertEqual(hint.text, "Здесь видно, готов ли Mac. Сейчас всё на месте, " - + "поэтому кнопки «Инструкция по сборке» нет.") + XCTAssertEqual(hint.label, "Mac · review, step 1 of 1") + XCTAssertEqual(hint.text, "This shows whether the Mac is ready. Everything is in place now, " + + "so there is no “Build instructions” button.") XCTAssertEqual(hint.target, .setupSummary) mac.handle(.next) - XCTAssertEqual(try shown(mac).text, "Глава «Mac» готова. Дальше — «Варианты запуска».") + XCTAssertEqual(try shown(mac).text, "The “Mac” chapter is done. Next: “Launch Options”.") var game = try self.tour(.game, .review, LearningFixture.returning) hint = try shown(game) - XCTAssertEqual(hint.label, "Игра · обзор, шаг 1 из 6") - XCTAssertEqual(hint.text, "Игру добавляет «+» вверху справа: «Добавить игру Steam…» или " - + "«Добавить игру из папки…». Две большие кнопки видны здесь, только пока игр нет.") + XCTAssertEqual(hint.label, "Game · review, step 1 of 6") + XCTAssertEqual(hint.text, "“+” at the top right adds a game: “Add Steam Game…” or " + + "“Add Game from Folder…”. The two large buttons show here only while there are no games.") XCTAssertNil(hint.target) - XCTAssertEqual(hint.help?.title, "Другие способы") + XCTAssertEqual(hint.help?.title, "Other Ways") game.handle(.next) hint = try shown(game) - XCTAssertEqual(hint.text, "В окне «Добавить игру Steam» выберите свою игру; " - + "если её нет в списке — «Другая игра». Затем «Далее».") + XCTAssertEqual(hint.text, "In “Add Steam Game”, pick your game; " + + "if it is not listed, pick “Another game”. Then click “Next”.") XCTAssertNil(hint.target) XCTAssertNil(hint.help) game.handle(.next) hint = try shown(game) - XCTAssertEqual(hint.text, "В окне «Добавить игру из папки» — «Выбрать папку…», " - + "проверьте выбранный .exe, затем «Добавить игру».") + XCTAssertEqual(hint.text, "In “Add Game from Folder”, click “Choose Folder…”, " + + "check the chosen .exe, then click “Add Game”.") XCTAssertNil(hint.target) game.handle(.next) hint = try shown(game) - XCTAssertEqual(hint.text, "Пока Steam скачивает игру, не останавливайте Steam " - + "и не закрывайте TrailBridge — загрузка оборвётся.") + XCTAssertEqual(hint.text, "While Steam downloads a game, do not stop Steam " + + "or quit TrailBridge: the download would break off.") XCTAssertNil(hint.target) game.handle(.next) hint = try shown(game) - XCTAssertEqual(hint.label, "Игра · обзор, шаг 5 из 6") - XCTAssertEqual(hint.text, "Пока открыт Steam, «Играть» недоступна. Кнопка «Остановить» " - + "появляется в боковой панели, только пока он открыт.") + XCTAssertEqual(hint.label, "Game · review, step 5 of 6") + XCTAssertEqual(hint.text, "While Steam is open, “Play” is not available. “Stop” " + + "shows in the sidebar only while it is open.") // "Stop" is in the sidebar only while Steam is open. XCTAssertNil(hint.target) feed(&game) { $0.session = .windowsApp } @@ -1274,14 +1275,14 @@ final class SetupTourTests: XCTestCase { hint = try shown(game) // The label is on the card in every state; the text follows it. XCTAssertEqual(hint.target, .libraryStatusChip(self.game)) - XCTAssertEqual(hint.text, "Метка «Готово · OpenVR»: плагин OpenVR включён. " - + "Нажмите метку, если его нужно выключить.") + XCTAssertEqual(hint.text, "The “READY · OPENVR” label: the OpenVR plug-in is on. " + + "Click the label to turn it off.") feed(&game) { $0.openVRBadges = [self.game: .none] } - XCTAssertEqual(try shown(game).text, "У этой игры метка «Готово к запуску»: плагин OpenVR " - + "ей не нужен. У других игр здесь бывает «Настроить OpenVR».") + XCTAssertEqual(try shown(game).text, "This game is marked “READY”: it needs no OpenVR plug-in. " + + "Other games may show “SET UP OPENVR” here.") feed(&game) { $0.openVRBadges = [self.game: .needsSetup] } - XCTAssertEqual(try shown(game).text, "У игры метка «Настроить OpenVR». Нажмите её и включите " - + "«Поддержка OpenVR»; если спросит — «Скачать и включить». Затем «Готово».") + XCTAssertEqual(try shown(game).text, "The game is marked “SET UP OPENVR”. Click that label and turn on " + + "“OpenVR support”; if asked, click “Download and turn on”. Then click “Done”.") // Still a review: the label turning ready moves nothing. feed(&game) { $0.openVRBadges = [self.game: .installed] } XCTAssertEqual(game.phase, .step(.gameOpenVR)) @@ -1289,9 +1290,9 @@ final class SetupTourTests: XCTestCase { var options = try self.tour(.launchOptions, .review, LearningFixture.returning) options.handle(.next) hint = try shown(options) - XCTAssertEqual(hint.label, "Варианты запуска · обзор, шаг 2 из 6") - XCTAssertEqual(hint.text, "Второе место запуска — здесь: список «Игра» и «Играть». " - + "«Изменить…» → «Общие настройки трансляции…» открывает настройки.") + XCTAssertEqual(hint.label, "Launch Options · review, step 2 of 6") + XCTAssertEqual(hint.text, "The second place to start is here: the “Game” list and “Play”. " + + "“Change…”, then “Global Stream Settings…” opens the settings.") XCTAssertEqual(hint.target, .streamAdjust) } } diff --git a/streamer/Tests/BasaltManagerKitTests/SteamGameWizardTests.swift b/streamer/Tests/BasaltManagerKitTests/SteamGameWizardTests.swift index 7c55d38..e7d30e5 100644 --- a/streamer/Tests/BasaltManagerKitTests/SteamGameWizardTests.swift +++ b/streamer/Tests/BasaltManagerKitTests/SteamGameWizardTests.swift @@ -390,7 +390,6 @@ final class SteamGameWizardTests: XCTestCase { XCTAssertEqual(SteamCatalogGame.verified.map(\.appID), ["2669380", "1032430", "667970", "1592190", "629730"]) XCTAssertEqual(SteamCatalogGame.all.filter(\.isVerified).count, 5) - XCTAssertTrue(SteamCatalogGame.verified.allSatisfy { $0.status == "Проверена в шлеме" }) // BONELAB starts its own OpenXR loader; the others need OpenComposite. XCTAssertEqual(SteamCatalogGame.verified.filter { !$0.needsOpenVR }.map(\.name), ["BONELAB"]) XCTAssertEqual(Set(SteamCatalogGame.verified.compactMap(\.environmentName)).count, 5) @@ -400,13 +399,11 @@ final class SteamGameWizardTests: XCTestCase { XCTAssertNil(SteamCatalogGame.other.verifiedIn) XCTAssertEqual(VerifiedMonth(year: 2026, month: 11).text(locale: Locale(identifier: "en")), "November 2026") - let russian = VerifiedMonth(year: 2026, month: 11).text(locale: Locale(identifier: "ru")) - XCTAssertTrue(russian.hasPrefix("ноябрь 2026"), russian) - XCTAssertEqual(SteamCatalogGame.other.name, "Другая игра") - XCTAssertEqual(SteamCatalogGame.other.status, "Не проверена") + XCTAssertEqual(VerifiedMonth(year: 2026, month: 11).text(locale: Locale(identifier: "pl")), + "listopad 2026") + XCTAssertEqual(SteamCatalogGame.other.name, "Another game") XCTAssertFalse(SteamCatalogGame.other.isVerified) XCTAssertNil(SteamCatalogGame.other.appID) - XCTAssertEqual(SteamWizardCopy.endToEndCaveat, "Сам мастер пока не проверен от начала до конца на чистом окружении.") } func testOnlyTheVerifiedSteamGamesCountAsVerified() { @@ -447,7 +444,7 @@ final class SteamGameWizardTests: XCTestCase { for name in ["a", "Game_1.2-test", String(repeating: "a", count: 64)] { XCTAssertEqual(try SteamCatalogGame.other.bottleName(custom: name), try BottleName.validate(name)) } - for name in ["", "../game", ".game", "-game", "игра", " game", "game ", "game/name", String(repeating: "a", count: 65)] { + for name in ["", "../game", ".game", "-game", "café", " game", "game ", "game/name", String(repeating: "a", count: 65)] { XCTAssertThrowsError(try SteamCatalogGame.other.bottleName(custom: name), name) XCTAssertThrowsError(try BottleName.validate(name), name) }