feat(settings): 新增三语即时切换并记录验收与专项边界
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import Foundation
|
||||
|
||||
@main struct LocalizationChecks {
|
||||
@MainActor static func main() {
|
||||
precondition(AppLanguage.system.identifier(preferredLanguages: ["zh-TW"]) == "zh-Hant")
|
||||
precondition(AppLanguage.system.identifier(preferredLanguages: ["zh-CN"]) == "zh-Hans")
|
||||
precondition(AppLanguage.system.identifier(preferredLanguages: ["en-GB"]) == "en")
|
||||
precondition(AppLanguage.system.identifier(preferredLanguages: ["fr-FR"]) == "en")
|
||||
precondition(AppLanguage.english.identifier(preferredLanguages: ["zh-CN"]) == "en")
|
||||
let suite = "kymo-language-checks-" + UUID().uuidString
|
||||
let defaults = UserDefaults(suiteName: suite)!
|
||||
defer { defaults.removePersistentDomain(forName: suite) }
|
||||
let preferences = LanguagePreferences(defaults: defaults)
|
||||
precondition(preferences.language == .system)
|
||||
for language in AppLanguage.allCases {
|
||||
preferences.language = language
|
||||
precondition(LanguagePreferences(defaults: defaults).language == language)
|
||||
precondition(preferences.locale.identifier == language.identifier())
|
||||
}
|
||||
defaults.set("unsupported", forKey: "language")
|
||||
precondition(LanguagePreferences(defaults: defaults).language == .system)
|
||||
let bundle = Bundle(path: CommandLine.arguments[1])!
|
||||
for (language, title, custom) in [("en", "Kymo Settings", "Custom color"),
|
||||
("zh-Hans", "Kymo 设置", "自选颜色"),
|
||||
("zh-Hant", "Kymo 設定", "自選顏色")] {
|
||||
let locale = Locale(identifier: language)
|
||||
precondition(AppLocalization.string("settings.title", locale: locale, bundle: bundle) == title)
|
||||
precondition(AppLocalization.string("accent.custom", locale: locale, bundle: bundle) == custom)
|
||||
}
|
||||
print("PASS: system matching, explicit override, fallback, preference roundtrip, built three-language resources")
|
||||
}
|
||||
}
|
||||
+15
-1
@@ -30,8 +30,9 @@ B 阶段补充检查覆盖历史容量与缺失值、格式化边界、外观持
|
||||
|
||||
```bash
|
||||
swiftc -module-cache-path /private/tmp/kymo-check-cache \
|
||||
kymo/Core/Services/AppearancePreferences.swift \
|
||||
kymo/Core/Services/AppearancePreferences.swift kymo/Core/Services/LanguagePreferences.swift \
|
||||
kymo/UI/Components/AppearanceStyle.swift kymo/UI/Components/DetailPlacement.swift \
|
||||
kymo/UI/Components/AppLocalization.swift \
|
||||
kymo/Features/Settings/CustomColorPicker.swift kymo/Features/Settings/CustomColorWell.swift \
|
||||
kymoTests/PresentationChecks.swift -o /private/tmp/kymo-presentation-checks
|
||||
/private/tmp/kymo-presentation-checks
|
||||
@@ -47,3 +48,16 @@ swiftc -module-cache-path /private/tmp/kymo-check-cache \
|
||||
```
|
||||
|
||||
覆盖追加识别、缺失值、未满及满 60 点时的起止位置;不证明实际动画手感。
|
||||
|
||||
## 多语言行为检查
|
||||
|
||||
先构建应用,再传入实际 .app 路径,检查语言匹配、即时偏好值、隔离 suite 持久化与真实三语资源:
|
||||
|
||||
```bash
|
||||
swiftc -module-cache-path /private/tmp/kymo-check-cache \
|
||||
kymo/Core/Services/LanguagePreferences.swift kymo/UI/Components/AppLocalization.swift \
|
||||
kymoTests/LocalizationChecks.swift -o /private/tmp/kymo-localization-checks
|
||||
/private/tmp/kymo-localization-checks /absolute/path/to/kymo.app
|
||||
```
|
||||
|
||||
不修改用户语言或系统 AppleLanguages;不以该检查代替窗口即时切换验收。
|
||||
|
||||
Reference in New Issue
Block a user