@@ -78,7 +78,7 @@ struct ContentView: View {
7878 HStack ( spacing: 8 ) {
7979 Image ( systemName: " magnifyingglass " )
8080 . foregroundColor ( . secondary)
81- TextField ( " 搜索应用 (本地 / 外部)... " , text: $searchText)
81+ TextField ( " 搜索应用 (本地 / 外部)... " . localized , text: $searchText)
8282 . textFieldStyle ( . plain)
8383 . font ( . system( size: 13 ) )
8484 }
@@ -92,23 +92,23 @@ struct ContentView: View {
9292
9393 // Sort Button
9494 Menu {
95- Picker ( " 排序方式 " , selection: $sortOption) {
96- Text ( " 按名称 " ) . tag ( SortOption . name)
97- Text ( " 按大小 " ) . tag ( SortOption . size)
95+ Picker ( " 排序方式 " . localized , selection: $sortOption) {
96+ Text ( " 按名称 " . localized ) . tag ( SortOption . name)
97+ Text ( " 按大小 " . localized ) . tag ( SortOption . size)
9898 }
9999 } label: {
100- Label ( " 排序 " , systemImage: " line.3.horizontal.decrease.circle " )
100+ Label ( " 排序 " . localized , systemImage: " line.3.horizontal.decrease.circle " )
101101 }
102102 . menuStyle ( . borderlessButton)
103103 . fixedSize ( )
104104 . help ( " 排序方式 " )
105105
106106 // App Store Settings Button
107107 Button ( action: { showAppStoreSettings = true } ) {
108- Label ( " 设置 " , systemImage: " gearshape " )
108+ Label ( " 设置 " . localized , systemImage: " gearshape " )
109109 }
110110 . buttonStyle ( . borderless)
111- . help ( " App Store 应用迁移设置 " )
111+ . help ( " App Store 应用迁移设置 " . localized )
112112 }
113113 . padding ( . horizontal, 20 )
114114 . padding ( . vertical, 12 )
@@ -184,12 +184,12 @@ struct ContentView: View {
184184 . foregroundColor ( . accentColor)
185185
186186 // 【修复点 2】直接使用字面量,SwiftUI 会自动翻译
187- Text ( " 请选择外部存储路径 " )
187+ Text ( " 请选择外部存储路径 " . localized )
188188 . font ( . title3)
189189 . fontWeight ( . medium)
190190 . foregroundColor ( . secondary)
191191
192- Button ( " 选择文件夹 " ) { openPanelForExternalDrive ( ) }
192+ Button ( " 选择文件夹 " . localized ) { openPanelForExternalDrive ( ) }
193193 . buttonStyle ( . borderedProminent)
194194 . controlSize ( . large)
195195 }
@@ -294,18 +294,18 @@ struct ContentView: View {
294294 scanExternalApps ( )
295295 }
296296
297- . alert ( LocalizedStringKey ( alertTitle) , isPresented: $showAlert) {
298- Button ( " 好的 " , role: . cancel) { }
297+ . alert ( LocalizedStringKey ( alertTitle. localized ) , isPresented: $showAlert) {
298+ Button ( " 好的 " . localized , role: . cancel) { }
299299 } message: {
300- Text ( LocalizedStringKey ( alertMessage) )
300+ Text ( LocalizedStringKey ( alertMessage. localized ) )
301301 }
302- . alert ( " 发现新版本 " , isPresented: $showUpdateAlert) {
303- Button ( " 前往下载 " , role: . none) {
302+ . alert ( " 发现新版本 " . localized , isPresented: $showUpdateAlert) {
303+ Button ( " 前往下载 " . localized , role: . none) {
304304 if let url = updateURL { NSWorkspace . shared. open ( url) }
305305 }
306- Button ( " 以后再说 " , role: . cancel) { }
306+ Button ( " 以后再说 " . localized , role: . cancel) { }
307307 } message: {
308- Text ( alertMessage)
308+ Text ( alertMessage. localized )
309309 }
310310 // App Store 应用迁移确认弹窗
311311 . alert ( " App Store 应用 " . localized, isPresented: $showAppStoreConfirm) {
@@ -403,7 +403,7 @@ struct ContentView: View {
403403
404404 VStack ( alignment: . leading, spacing: 4 ) {
405405 // 将传入的 title 字符串转换为 Key,触发翻译
406- Text ( LocalizedStringKey ( title) )
406+ Text ( title. localized )
407407 . font ( . headline)
408408
409409 Text ( subtitle)
@@ -417,7 +417,7 @@ struct ContentView: View {
417417
418418 if let btnText = actionButtonText, let action = onAction {
419419
420- Button ( LocalizedStringKey ( btnText) , action: action)
420+ Button ( btnText. localized , action: action)
421421 . controlSize ( . small)
422422 . buttonStyle ( . bordered)
423423 }
@@ -455,7 +455,7 @@ struct ContentView: View {
455455 Spacer ( )
456456 Button ( action: action) {
457457 HStack ( spacing: 8 ) {
458- Text ( LocalizedStringKey ( title) )
458+ Text ( title. localized )
459459 . fontWeight ( . semibold)
460460 Image ( systemName: icon)
461461 }
@@ -483,7 +483,7 @@ struct ContentView: View {
483483 . font ( . largeTitle)
484484 . foregroundColor ( . secondary. opacity ( 0.3 ) )
485485
486- Text ( LocalizedStringKey ( text) )
486+ Text ( text. localized )
487487 . foregroundColor ( . secondary. opacity ( 0.7 ) )
488488 }
489489 . accessibilityElement ( children: . combine)
0 commit comments