diff --git a/FreeDisplay.xcodeproj/project.pbxproj b/FreeDisplay.xcodeproj/project.pbxproj index 1c98fd6..b8e6baf 100644 --- a/FreeDisplay.xcodeproj/project.pbxproj +++ b/FreeDisplay.xcodeproj/project.pbxproj @@ -41,6 +41,7 @@ 94A44781BBE01DF170DF6F64 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C11B24C0698CE807BA1E28D0 /* AppDelegate.swift */; }; B170F04C4FDA2E9A8D0AD6B0 /* BrightnessService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6ED9828FF4F2823DDB03014 /* BrightnessService.swift */; }; B3452C06010BEFEEBF0FD1FC /* ResolutionSliderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 603658292A824E3A3968A4D7 /* ResolutionSliderView.swift */; }; + BB9CCFBB898E11E8C9A3EFD4 /* InfoPlist.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 7F1FF58B181661B4CC4B6F85 /* InfoPlist.xcstrings */; }; CBC8B0900A104181893B69B2 /* ImageAdjustmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F22B3A7EF51E72B078901699 /* ImageAdjustmentView.swift */; }; CD3C6687C2B23F46A3678E94 /* NotchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2419A06679F0A55C454EF1F /* NotchView.swift */; }; D14D979F3149D232244DD701 /* MainDisplayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4720147B44C6328686440A16 /* MainDisplayView.swift */; }; @@ -48,6 +49,7 @@ E061011F318208D7FF94D963 /* CGHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB5BF8AFF876572E97D370A0 /* CGHelpers.swift */; }; E201AC4CE5BCEC009C926206 /* ArrangementService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22030BFC8A680A596A5764C9 /* ArrangementService.swift */; }; E6D99B12980703693C61A687 /* SettingsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5483CA367C0673369C00E5A /* SettingsService.swift */; }; + F17E84B38238640BEBC366AA /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = E0CF278C47F118CA2F2DDC62 /* Localizable.xcstrings */; }; F9A1FF13C0CAC41003C5B201 /* SavePresetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58474F9C406F992241963112 /* SavePresetView.swift */; }; FE0FA160B19EA273B4F766CC /* BrightnessSliderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D76D8EE5271581552ED081AF /* BrightnessSliderView.swift */; }; /* End PBXBuildFile section */ @@ -77,6 +79,7 @@ 7419D1AC41D1C369FFDCD09D /* GammaService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GammaService.swift; sourceTree = ""; }; 754025E6D6152C81F145C63C /* MirrorService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MirrorService.swift; sourceTree = ""; }; 76DF3A1CA21D512F8DC936F9 /* PresetListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PresetListView.swift; sourceTree = ""; }; + 7F1FF58B181661B4CC4B6F85 /* InfoPlist.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = InfoPlist.xcstrings; sourceTree = ""; }; 819474C0E46B105CBBFE7A7F /* HiDPIService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HiDPIService.swift; sourceTree = ""; }; 87A2686369A9F9969B89376E /* DisplayMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayMode.swift; sourceTree = ""; }; 90F55D10A5241A8DFA941E4C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -96,6 +99,7 @@ D732A8A7009C298C78D6895C /* FreeDisplayApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FreeDisplayApp.swift; sourceTree = ""; }; D76D8EE5271581552ED081AF /* BrightnessSliderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrightnessSliderView.swift; sourceTree = ""; }; DB5BF8AFF876572E97D370A0 /* CGHelpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CGHelpers.swift; sourceTree = ""; }; + E0CF278C47F118CA2F2DDC62 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; E5483CA367C0673369C00E5A /* SettingsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsService.swift; sourceTree = ""; }; F22B3A7EF51E72B078901699 /* ImageAdjustmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageAdjustmentView.swift; sourceTree = ""; }; F606C5D467CD44404890F6EC /* VirtualDisplayService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VirtualDisplayService.swift; sourceTree = ""; }; @@ -191,6 +195,8 @@ isa = PBXGroup; children = ( AED959D5249F419ADBDBA1F4 /* Assets.xcassets */, + 7F1FF58B181661B4CC4B6F85 /* InfoPlist.xcstrings */, + E0CF278C47F118CA2F2DDC62 /* Localizable.xcstrings */, ); path = Resources; sourceTree = ""; @@ -254,16 +260,17 @@ }; }; buildConfigurationList = 8EA410054BD32F42B7BB9BC3 /* Build configuration list for PBXProject "FreeDisplay" */; - compatibilityVersion = "Xcode 14.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( Base, en, + "zh-Hans", ); mainGroup = AD8C2B4D7F682DFFA53EF6B7; minimizedProjectReferenceProxies = 1; preferredProjectObjectVersion = 77; + productRefGroup = 4D2DDE7731949C0697A6167C /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( @@ -279,6 +286,8 @@ files = ( 80F888F001C7F53E4FA362AD /* Assets.xcassets in Resources */, 7BC8C11889A477C6501E5BC8 /* Assets.xcassets in Resources */, + BB9CCFBB898E11E8C9A3EFD4 /* InfoPlist.xcstrings in Resources */, + F17E84B38238640BEBC366AA /* Localizable.xcstrings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/FreeDisplay/Models/DisplayInfo.swift b/FreeDisplay/Models/DisplayInfo.swift index 72f7739..7a2fa77 100644 --- a/FreeDisplay/Models/DisplayInfo.swift +++ b/FreeDisplay/Models/DisplayInfo.swift @@ -64,7 +64,7 @@ class DisplayInfo: ObservableObject, Identifiable { self.serialNumber = CGDisplaySerialNumber(displayID) if builtin { - self.name = "内建显示屏" + self.name = String(localized: "内建显示屏") } else { self.name = NSScreen.screen(for: displayID)?.localizedName ?? "Display \(displayID)" } diff --git a/FreeDisplay/Resources/InfoPlist.xcstrings b/FreeDisplay/Resources/InfoPlist.xcstrings new file mode 100644 index 0000000..34d30be --- /dev/null +++ b/FreeDisplay/Resources/InfoPlist.xcstrings @@ -0,0 +1,23 @@ +{ + "sourceLanguage" : "zh-Hans", + "strings" : { + "NSScreenCaptureUsageDescription" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "FreeDisplay needs screen recording permission to show live previews of each display." + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "FreeDisplay 需要屏幕录制权限以显示各显示器的实时画面预览。" + } + } + } + } + }, + "version" : "1.0" +} diff --git a/FreeDisplay/Resources/Localizable.xcstrings b/FreeDisplay/Resources/Localizable.xcstrings new file mode 100644 index 0000000..51c1b53 --- /dev/null +++ b/FreeDisplay/Resources/Localizable.xcstrings @@ -0,0 +1,1733 @@ +{ + "sourceLanguage" : "zh-Hans", + "strings" : { + "DDC: 硬件直接控制亮度\n软件: 通过软件调节亮度" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "DDC: direct hardware brightness control\nSoftware: adjust brightness via software" + } + } + } + }, + "HiDPI 模式" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "HiDPI Mode" + } + } + } + }, + "HiDPI 操作失败" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "HiDPI operation failed" + } + } + } + }, + "上次同步中" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Syncing…" + } + } + } + }, + "主" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Main" + } + } + } + }, + "主屏" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Main" + } + } + } + }, + "亮度(组合)" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Brightness (combined)" + } + } + } + }, + "亮度控制模式:DDC 硬件" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Brightness control mode: DDC hardware" + } + } + } + }, + "亮度控制模式:系统" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Brightness control mode: System" + } + } + } + }, + "亮度控制模式:软件模拟" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Brightness control mode: Software emulation" + } + } + } + }, + "从屏幕取色" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Sample from screen" + } + } + } + }, + "伽马值" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Gamma" + } + } + } + }, + "伽马值 B" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Gamma B" + } + } + } + }, + "伽马值 G" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Gamma G" + } + } + } + }, + "伽马值 R" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Gamma R" + } + } + } + }, + "保存" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Save" + } + } + } + }, + "保存中..." : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Saving…" + } + } + } + }, + "保存为预设" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Save as Preset" + } + } + } + }, + "个人" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Personal" + } + } + } + }, + "创建" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Create" + } + } + } + }, + "创建中..." : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Creating…" + } + } + } + }, + "创建 AppleScript 失败" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Failed to create AppleScript" + } + } + } + }, + "创建新的虚拟显示器" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Create a new virtual display" + } + } + } + }, + "创建虚拟显示器" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Create Virtual Display" + } + } + } + }, + "删除" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Delete" + } + } + } + }, + "删除此虚拟显示器" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Delete this virtual display" + } + } + } + }, + "刘海" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Notch" + } + } + } + }, + "切换失败,请重试" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Switch failed, please try again" + } + } + } + }, + "切换至此颜色配置文件" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Switch to this color profile" + } + } + } + }, + "切换到%@" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Switch to %@" + } + } + } + }, + "刷新模式列表" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Refresh mode list" + } + } + } + }, + "刷新率" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Refresh Rate" + } + } + } + }, + "取消" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Cancel" + } + } + } + }, + "名称" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Name" + } + } + } + }, + "启动时检查更新" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Check for updates on launch" + } + } + } + }, + "启动时自动创建" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Create on launch" + } + } + } + }, + "启用高分辨率模式(Retina)" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Enable high-resolution mode (Retina)" + } + } + } + }, + "启用高分辨率缩放" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Enable high-resolution scaling" + } + } + } + }, + "图像调整" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Image Adjustments" + } + } + } + }, + "图标" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Icon" + } + } + } + }, + "在系统设置中打开" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Open in System Settings" + } + } + } + }, + "在菜单栏显示所有显示器的统一亮度滑块" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Show a unified brightness slider for all displays in the menu" + } + } + } + }, + "在顶部菜单栏区域显示黑色遮罩以隐藏刘海" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Show a black overlay over the menu bar area to hide the notch" + } + } + } + }, + "复制显示器名称" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Copy display name" + } + } + } + }, + "夜间" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Night" + } + } + } + }, + "对比度" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Contrast" + } + } + } + }, + "将当前显示器配置保存为预设" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Save the current display configuration as a preset" + } + } + } + }, + "将此显示器设为主显示器" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Set this as the main display" + } + } + } + }, + "工作" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Work" + } + } + } + }, + "工具" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Tools" + } + } + } + }, + "已应用" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Applied" + } + } + } + }, + "建议开启开机自动启动" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Consider enabling Launch at Login" + } + } + } + }, + "开机自动启动" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Launch at Login" + } + } + } + }, + "当前" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Current" + } + } + } + }, + "当前主显示屏" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Current main display" + } + } + } + }, + "当前模式" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Current mode" + } + } + } + }, + "我的预设" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "My Preset" + } + } + } + }, + "拖动选择分辨率" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Drag to choose resolution" + } + } + } + }, + "拖动调整亮度" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Drag to adjust brightness" + } + } + } + }, + "推荐" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Recommended" + } + } + } + }, + "收起" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Collapse" + } + } + } + }, + "新版本 v%@ 可用" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "New version v%@ available" + } + } + } + }, + "无法切换到 %@,请重试" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Could not switch to %@, please try again" + } + } + } + }, + "日间" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Day" + } + } + } + }, + "显示全部 %lld 个" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Show all %lld" + } + } + } + }, + "显示器" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Display" + } + } + } + }, + "显示器亮度" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Display brightness" + } + } + } + }, + "显示器名称" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Display name" + } + } + } + }, + "显示器排列失败,请重试" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Display arrangement failed, please try again" + } + } + } + }, + "显示器:%@" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Display: %@" + } + } + } + }, + "显示模式" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Display Mode" + } + } + } + }, + "显示组合亮度控制" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Show combined brightness control" + } + } + } + }, + "暂停调整" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Pause Adjustments" + } + } + } + }, + "暂时停用色彩调整,恢复原始显示" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Temporarily disable adjustments and restore the original display" + } + } + } + }, + "暂无虚拟显示器" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "No virtual displays" + } + } + } + }, + "最低" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Lowest" + } + } + } + }, + "最高" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Highest" + } + } + } + }, + "未检测到内建显示屏" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "No built-in display detected" + } + } + } + }, + "未找到描述文件" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "No profiles found" + } + } + } + }, + "未知" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Unknown" + } + } + } + }, + "未知错误" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Unknown error" + } + } + } + }, + "查看" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "View" + } + } + } + }, + "正在加载描述文件…" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Loading profiles…" + } + } + } + }, + "此虚拟显示器当前处于活跃状态,删除后将立即停用。" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "This virtual display is currently active. Deleting it will deactivate it immediately." + } + } + } + }, + "没有可用的显示模式" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "No display modes available" + } + } + } + }, + "活跃" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Active" + } + } + } + }, + "游戏" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Gaming" + } + } + } + }, + "点击屏幕任意位置取色…" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Click anywhere on the screen to sample…" + } + } + } + }, + "点击展开控制面板" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Tap to expand controls" + } + } + } + }, + "点击展开或折叠此部分" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Tap to expand or collapse this section" + } + } + } + }, + "用户取消了授权" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "User canceled authorization" + } + } + } + }, + "生成 Plist 数据失败" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Failed to generate plist data" + } + } + } + }, + "登录时自动启动 FreeDisplay" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Automatically launch FreeDisplay when you log in" + } + } + } + }, + "确定" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "OK" + } + } + } + }, + "确认删除" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Confirm Deletion" + } + } + } + }, + "确认删除此虚拟显示器配置?" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Delete this virtual display configuration?" + } + } + } + }, + "系统" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "System" + } + } + } + }, + "系统亮度:通过系统 API 控制内建显示屏亮度" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "System brightness: control the built-in display brightness via system APIs" + } + } + } + }, + "系统颜色" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "System Color" + } + } + } + }, + "色温" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Color Temperature" + } + } + } + }, + "反转色彩" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Invert Colors" + } + } + } + }, + "反转显示器色彩(类似夜间模式)" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Invert display colors (similar to night mode)" + } + } + } + }, + "虚拟显示器" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Virtual Displays" + } + } + } + }, + "虚拟显示器创建失败,请重试" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Failed to create virtual display, please try again" + } + } + } + }, + "设为主显示屏" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Set as main display" + } + } + } + }, + "设 %@ 为主显示器" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Set %@ as main display" + } + } + } + }, + "设置" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Settings" + } + } + } + }, + "设置主显示屏失败" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Failed to set main display" + } + } + } + }, + "调整 伽马值" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Adjust gamma" + } + } + } + }, + "调整 增益" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Adjust gain" + } + } + } + }, + "调整 对比度" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Adjust contrast" + } + } + } + }, + "调整 红色伽马值" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Adjust red gamma" + } + } + } + }, + "调整 红色增益" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Adjust red gain" + } + } + } + }, + "调整 绿色伽马值" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Adjust green gamma" + } + } + } + }, + "调整 绿色增益" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Adjust green gain" + } + } + } + }, + "调整 色温" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Adjust color temperature" + } + } + } + }, + "调整 蓝色伽马值" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Adjust blue gamma" + } + } + } + }, + "调整 蓝色增益" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Adjust blue gain" + } + } + } + }, + "调整 量化级别" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Adjust quantization levels" + } + } + } + }, + "调整可能影响 HDR 内容!" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Adjustments may affect HDR content!" + } + } + } + }, + "软件" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Software" + } + } + } + }, + "软件 %lld%%" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Software %lld%%" + } + } + } + }, + "选择虚拟显示器分辨率" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Select virtual display resolution" + } + } + } + }, + "退出" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Quit" + } + } + } + }, + "退出 FreeDisplay" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Quit FreeDisplay" + } + } + } + }, + "重置全部" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Reset All" + } + } + } + }, + "重置所有色彩调整为默认值" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Reset all color adjustments to defaults" + } + } + } + }, + "量化" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Quantization" + } + } + } + }, + "镜像" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Mirror" + } + } + } + }, + "需要管理员权限" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Requires admin privileges" + } + } + } + }, + "预设名称" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Preset name" + } + } + } + }, + "颜色历史" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Color History" + } + } + } + }, + "颜色描述文件" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Color Profile" + } + } + } + }, + "写入临时文件失败:%@" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Failed to write temporary file: %@" + } + } + } + }, + "展开显示器控制面板" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Expand display controls" + } + } + } + }, + "知道了" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Got it" + } + } + } + }, + "每次启动时自动检查是否有新版本可用" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Automatically check for new versions on every launch" + } + } + } + }, + "自动" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Auto" + } + } + } + }, + "自动亮度" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Auto Brightness" + } + } + } + }, + "跟随内建屏亮度同步中" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Syncing with built-in display brightness…" + } + } + } + }, + "跟随内建屏亮度调整外接显示器" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Follow built-in display brightness on external displays" + } + } + } + }, + "增益" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Gain" + } + } + } + }, + "增益 B" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Gain B" + } + } + } + }, + "增益 G" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Gain G" + } + } + } + }, + "增益 R" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Gain R" + } + } + } + }, + "原生模式" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Native Mode" + } + } + } + }, + "排列显示器" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Arrange Displays" + } + } + } + }, + "下载并安装最新版本" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Download and install the latest version" + } + } + } + }, + "继续调整" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Resume Adjustments" + } + } + } + }, + "内建显示屏" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Built-in Display" + } + } + } + }, + "内部" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Internal" + } + } + } + }, + "外部" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "External" + } + } + } + }, + "所有描述文件" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "All Profiles" + } + } + } + }, + "应用失败,请重试" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Apply failed, please try again" + } + } + } + }, + "管理员授权失败:%@" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Administrator authorization failed: %@" + } + } + } + }, + "组合亮度" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Combined brightness" + } + } + } + }, + "隐藏刘海区域" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Hide notch area" + } + } + } + } + }, + "version" : "1.0" +} diff --git a/FreeDisplay/Services/ColorProfileService.swift b/FreeDisplay/Services/ColorProfileService.swift index 90e72e4..da38eee 100644 --- a/FreeDisplay/Services/ColorProfileService.swift +++ b/FreeDisplay/Services/ColorProfileService.swift @@ -122,17 +122,17 @@ final class ColorProfileService: @unchecked Sendable { /// Returns the human-readable color space name for the given display. func currentColorSpaceName(for displayID: CGDirectDisplayID) -> String { let colorSpace = CGDisplayCopyColorSpace(displayID) - guard let cfName = colorSpace.name else { return "未知" } + guard let cfName = colorSpace.name else { return String(localized: "未知") } return humanReadable(cfName as String) } /// Returns a description like "内部 (8-bit)" for the display's current color mode. func colorModeDescription(for displayID: CGDirectDisplayID) -> String { - guard let mode = CGDisplayCopyDisplayMode(displayID) else { return "未知" } + guard let mode = CGDisplayCopyDisplayMode(displayID) else { return String(localized: "未知") } let encoding: String if let cfEnc = mode.pixelEncoding { encoding = cfEnc as String } else { encoding = "" } let bpc = bitsPerChannel(from: encoding) - let source = CGDisplayIsBuiltin(displayID) != 0 ? "内部" : "外部" + let source = CGDisplayIsBuiltin(displayID) != 0 ? String(localized: "内部") : String(localized: "外部") return "\(source) (\(bpc)-bit)" } diff --git a/FreeDisplay/Services/HiDPIService.swift b/FreeDisplay/Services/HiDPIService.swift index 89aedf0..fbb7a37 100644 --- a/FreeDisplay/Services/HiDPIService.swift +++ b/FreeDisplay/Services/HiDPIService.swift @@ -86,7 +86,7 @@ final class HiDPIService: @unchecked Sendable { ] guard let data = try? PropertyListSerialization.data(fromPropertyList: plist, format: .xml, options: 0) else { - return "生成 Plist 数据失败" + return String(localized: "生成 Plist 数据失败") } // Write to a temp file first, then use privileged helper to move it @@ -94,7 +94,7 @@ final class HiDPIService: @unchecked Sendable { do { try data.write(to: URL(fileURLWithPath: tmpPath), options: .atomic) } catch { - return "写入临时文件失败:\(error.localizedDescription)" + return String(localized: "写入临时文件失败:\(error.localizedDescription)") } // Use AppleScript to get admin privileges for writing to /Library/Displays/ @@ -131,15 +131,15 @@ final class HiDPIService: @unchecked Sendable { """ var error: NSDictionary? guard let appleScript = NSAppleScript(source: script) else { - return "创建 AppleScript 失败" + return String(localized: "创建 AppleScript 失败") } appleScript.executeAndReturnError(&error) if let error = error { - let msg = error[NSAppleScript.errorMessage] as? String ?? "未知错误" + let msg = error[NSAppleScript.errorMessage] as? String ?? String(localized: "未知错误") if msg.contains("canceled") || msg.contains("Cancel") { - return "用户取消了授权" + return String(localized: "用户取消了授权") } - return "管理员授权失败:\(msg)" + return String(localized: "管理员授权失败:\(msg)") } return nil } diff --git a/FreeDisplay/Services/PresetService.swift b/FreeDisplay/Services/PresetService.swift index 67be84e..a0e9cac 100644 --- a/FreeDisplay/Services/PresetService.swift +++ b/FreeDisplay/Services/PresetService.swift @@ -217,7 +217,7 @@ final class PresetService: ObservableObject, @unchecked Sendable { } var nativePreset = DisplayPreset( - name: "原生模式", + name: String(localized: "原生模式"), icon: "rectangle.on.rectangle", displays: nativeEntries ) @@ -262,7 +262,7 @@ final class PresetService: ObservableObject, @unchecked Sendable { } } var hidpiPreset = DisplayPreset( - name: "HiDPI 模式", + name: String(localized: "HiDPI 模式"), icon: "sparkles", displays: hidpiEntries ) diff --git a/FreeDisplay/Views/ArrangementView.swift b/FreeDisplay/Views/ArrangementView.swift index fd20653..017ebbd 100644 --- a/FreeDisplay/Views/ArrangementView.swift +++ b/FreeDisplay/Views/ArrangementView.swift @@ -163,7 +163,7 @@ struct ArrangementView: View { displayManager.refreshDisplays() } else { withAnimation(.easeInOut(duration: 0.2)) { - dragError = "显示器排列失败,请重试" + dragError = String(localized: "显示器排列失败,请重试") } DispatchQueue.main.asyncAfter(deadline: .now() + 3) { withAnimation { self.dragError = nil } diff --git a/FreeDisplay/Views/AutoBrightnessView.swift b/FreeDisplay/Views/AutoBrightnessView.swift index 9de2404..33b2e45 100644 --- a/FreeDisplay/Views/AutoBrightnessView.swift +++ b/FreeDisplay/Views/AutoBrightnessView.swift @@ -39,11 +39,11 @@ struct AutoBrightnessView: View { private var statusText: String { if builtinUnavailable { - return "未检测到内建显示屏" + return String(localized: "未检测到内建显示屏") } else if service.isEnabled { - return "跟随内建屏亮度同步中" + return String(localized: "跟随内建屏亮度同步中") } else { - return "跟随内建屏亮度调整外接显示器" + return String(localized: "跟随内建屏亮度调整外接显示器") } } } diff --git a/FreeDisplay/Views/BrightnessSliderView.swift b/FreeDisplay/Views/BrightnessSliderView.swift index eab1671..ff29fdc 100644 --- a/FreeDisplay/Views/BrightnessSliderView.swift +++ b/FreeDisplay/Views/BrightnessSliderView.swift @@ -35,7 +35,13 @@ struct BrightnessSliderView: View { } .padding(.horizontal, 12) .padding(.top, 2) - .accessibilityLabel(display.isBuiltin ? "亮度控制模式:系统" : "亮度控制模式:\(ddcStatus == true ? "DDC 硬件" : "软件模拟")") + .accessibilityLabel( + display.isBuiltin + ? String(localized: "亮度控制模式:系统") + : (ddcStatus == true + ? String(localized: "亮度控制模式:DDC 硬件") + : String(localized: "亮度控制模式:软件模拟")) + ) .help(display.isBuiltin ? "系统亮度:通过系统 API 控制内建显示屏亮度" : "DDC: 硬件直接控制亮度\n软件: 通过软件调节亮度") HStack(spacing: 6) { @@ -97,7 +103,9 @@ struct BrightnessSliderView: View { .accessibilityHidden(true) let brightnessLabel: String = { - if ddcStatus == false { return "软件 \(Int(localBrightness))%" } + if ddcStatus == false { + return "\(String(localized: "软件")) \(Int(localBrightness))%" + } return "\(Int(localBrightness))%" }() Text(brightnessLabel) diff --git a/FreeDisplay/Views/ColorProfileView.swift b/FreeDisplay/Views/ColorProfileView.swift index a0b4a35..a28e767 100644 --- a/FreeDisplay/Views/ColorProfileView.swift +++ b/FreeDisplay/Views/ColorProfileView.swift @@ -132,7 +132,7 @@ struct ColorProfileView: View { applySuccess = false } } else { - applyError = "应用失败,请重试" + applyError = String(localized: "应用失败,请重试") Task { @MainActor in try? await Task.sleep(nanoseconds: 3_000_000_000) applyError = nil @@ -145,7 +145,7 @@ struct ColorProfileView: View { // MARK: - Sub-views private struct SectionBadge: View { - let title: String + let title: LocalizedStringKey var body: some View { Text(title) diff --git a/FreeDisplay/Views/DisplayModeListView.swift b/FreeDisplay/Views/DisplayModeListView.swift index f894a78..126d671 100644 --- a/FreeDisplay/Views/DisplayModeListView.swift +++ b/FreeDisplay/Views/DisplayModeListView.swift @@ -162,7 +162,7 @@ struct DisplayModeListView: View { errorMessage = nil } else { withAnimation { - errorMessage = "无法切换到 \(mode.resolutionString),请重试" + errorMessage = String(localized: "无法切换到 \(mode.resolutionString),请重试") } Task { @MainActor in try? await Task.sleep(nanoseconds: 3_000_000_000) @@ -372,7 +372,7 @@ private struct RatePill: View { // MARK: - TagBadge private struct TagBadge: View { - let text: String + let text: LocalizedStringKey let color: Color var body: some View { diff --git a/FreeDisplay/Views/ImageAdjustmentView.swift b/FreeDisplay/Views/ImageAdjustmentView.swift index dbad43c..adf71ad 100644 --- a/FreeDisplay/Views/ImageAdjustmentView.swift +++ b/FreeDisplay/Views/ImageAdjustmentView.swift @@ -192,7 +192,7 @@ struct ImageAdjustmentView: View { HStack(spacing: 4) { Image(systemName: systemImage) .font(.caption) - Text(title) + Text(LocalizedStringKey(title)) .font(.caption) } .padding(.horizontal, 8) @@ -256,7 +256,7 @@ private struct AdjustRow: View { .frame(width: 18) .font(.caption) - Text(label) + Text(LocalizedStringKey(label)) .font(.caption) .frame(width: 72, alignment: .leading) diff --git a/FreeDisplay/Views/MainDisplayView.swift b/FreeDisplay/Views/MainDisplayView.swift index 79a86ed..e0052c4 100644 --- a/FreeDisplay/Views/MainDisplayView.swift +++ b/FreeDisplay/Views/MainDisplayView.swift @@ -38,7 +38,7 @@ struct MainDisplayView: View { among: displayManager.displays ) if !success { - errorMessage = "设置主显示屏失败" + errorMessage = String(localized: "设置主显示屏失败") Task { @MainActor in try? await Task.sleep(nanoseconds: 3_000_000_000) errorMessage = nil diff --git a/FreeDisplay/Views/MenuBarView.swift b/FreeDisplay/Views/MenuBarView.swift index 41887f4..c5561ad 100644 --- a/FreeDisplay/Views/MenuBarView.swift +++ b/FreeDisplay/Views/MenuBarView.swift @@ -29,7 +29,7 @@ struct ExpandableRow: View { var body: some View { HStack { MenuItemIcon(systemName: icon, color: iconColor) - Text(label).font(.body) + Text(LocalizedStringKey(label)).font(.body) Spacer() if let sub = subtitle, !sub.isEmpty { Text(sub) diff --git a/FreeDisplay/Views/ResolutionSliderView.swift b/FreeDisplay/Views/ResolutionSliderView.swift index 730da94..3608322 100644 --- a/FreeDisplay/Views/ResolutionSliderView.swift +++ b/FreeDisplay/Views/ResolutionSliderView.swift @@ -131,7 +131,7 @@ struct ResolutionSliderView: View { errorMessage = nil } else { syncSliderToCurrentMode() - errorMessage = "切换失败,请重试" + errorMessage = String(localized: "切换失败,请重试") Task { @MainActor in try? await Task.sleep(nanoseconds: 3_000_000_000) errorMessage = nil diff --git a/FreeDisplay/Views/SavePresetView.swift b/FreeDisplay/Views/SavePresetView.swift index 71653e6..8b25f47 100644 --- a/FreeDisplay/Views/SavePresetView.swift +++ b/FreeDisplay/Views/SavePresetView.swift @@ -156,7 +156,7 @@ struct IconOptionButton: View { } .buttonStyle(.plain) .onHover { isHovered = $0 } - .help(label) - .accessibilityLabel(label) + .help(LocalizedStringKey(label)) + .accessibilityLabel(LocalizedStringKey(label)) } } diff --git a/FreeDisplay/Views/VirtualDisplayView.swift b/FreeDisplay/Views/VirtualDisplayView.swift index ce4c660..ca459cf 100644 --- a/FreeDisplay/Views/VirtualDisplayView.swift +++ b/FreeDisplay/Views/VirtualDisplayView.swift @@ -59,7 +59,7 @@ struct VirtualDisplayView: View { if success { showCreateForm = false } else { - createError = "虚拟显示器创建失败,请重试" + createError = String(localized: "虚拟显示器创建失败,请重试") Task { @MainActor in try? await Task.sleep(nanoseconds: 3_000_000_000) createError = nil