- 新增英文、日文、粤语支持 - 添加本地化图片资源 - 更新 Xcode 项目配置支持多语言 - 重构代码使用本地化字符串 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
68 lines
1.5 KiB
Swift
68 lines
1.5 KiB
Swift
//
|
|
// ChromiumBasedAppListView.swift
|
|
// ChromiumCertificate
|
|
//
|
|
// Created by Astrian Zheng on 14/7/2025.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ChromiumBasedAppListView: View {
|
|
@Binding var isPresented: Bool
|
|
|
|
let chromiumAppsList: [ChromiumApp] = ChromiumDetector.detectChromiumApps()
|
|
|
|
var body: some View {
|
|
VStack(spacing: 0) {
|
|
HStack {
|
|
Text("LISTVIEW_TITLE").font(.headline)
|
|
Spacer()
|
|
Button {
|
|
self.isPresented.toggle()
|
|
} label: {
|
|
Text("LISTVIEW_CLOSE")
|
|
}
|
|
}.padding()
|
|
|
|
Divider()
|
|
|
|
ScrollView {
|
|
if chromiumAppsList.isEmpty {
|
|
Text("LISTVIEW_NO_CHRIMIUM_APPS_FOUND").multilineTextAlignment(.center).padding()
|
|
}
|
|
VStack(spacing: 8) {
|
|
ForEach(Array(chromiumAppsList.enumerated()), id: \.element.id) { index, chromiumApp in
|
|
HStack {
|
|
VStack(alignment: .leading) {
|
|
Text(chromiumApp.name).bold()
|
|
Text(chromiumApp.path)
|
|
.font(.system(.caption, design: .monospaced))
|
|
}
|
|
Spacer()
|
|
}
|
|
|
|
if index < chromiumAppsList.count - 1 {
|
|
Divider()
|
|
}
|
|
}
|
|
}.padding()
|
|
}
|
|
}.frame(width: 300).frame(minHeight: 0, maxHeight: 300)
|
|
}
|
|
}
|
|
|
|
#Preview("中文") {
|
|
ChromiumBasedAppListView(isPresented: .constant(true))
|
|
.environment(\.locale, Locale(identifier: "zh-Hans"))
|
|
}
|
|
|
|
#Preview("English") {
|
|
ChromiumBasedAppListView(isPresented: .constant(true))
|
|
.environment(\.locale, Locale(identifier: "en"))
|
|
}
|
|
|
|
#Preview("日本語") {
|
|
ChromiumBasedAppListView(isPresented: .constant(true))
|
|
.environment(\.locale, Locale(identifier: "ja"))
|
|
}
|