Add localization support

Co-authored-by: Xiang <xfqz86@163.com>
This commit is contained in:
世界
2024-12-15 21:36:07 +08:00
co-authored by Xiang
parent ba6f99bc34
commit ef08a1052b
24 changed files with 1794 additions and 103 deletions
@@ -104,9 +104,9 @@
private var navigationTitle: String {
if readOnly {
return "View Content"
return String(localized: "View Content")
} else {
return "Edit Content"
return String(localized: "Edit Content")
}
}
@@ -17,7 +17,7 @@ public struct EditProfileView: View {
public init() {}
public var body: some View {
FormView {
FormItem("Name") {
FormItem(String(localized: "Name")) {
TextField("Name", text: $profile.name, prompt: Text("Required"))
.multilineTextAlignment(.trailing)
}
@@ -31,17 +31,17 @@ public struct EditProfileView: View {
}
.disabled(true)
if profile.type == .icloud {
FormItem("Path") {
FormItem(String(localized: "Path")) {
TextField("Path", text: $profile.path, prompt: Text("Required"))
.multilineTextAlignment(.trailing)
}
} else if profile.type == .remote {
FormItem("URL") {
FormItem(String(localized: "URL")) {
TextField("URL", text: $profile.remoteURL.unwrapped(""), prompt: Text("Required"))
.multilineTextAlignment(.trailing)
}
Toggle("Auto Update", isOn: $profile.autoUpdate)
FormItem("Auto Update Interval") {
FormItem(String(localized: "Auto Update Interval")) {
TextField("Auto Update Interval", text: $profile.autoUpdateInterval.stringBinding(defaultValue: 60), prompt: Text("In Minutes"))
.multilineTextAlignment(.trailing)
#if os(iOS)
@@ -34,7 +34,7 @@ public struct NewProfileView: View {
public var body: some View {
FormView {
FormItem("Name") {
FormItem(String(localized: "Name")) {
TextField("Name", text: $profileName, prompt: Text("Required"))
.multilineTextAlignment(.trailing)
}
@@ -76,17 +76,17 @@ public struct NewProfileView: View {
}
}
} else if profileType == .icloud {
FormItem("Path") {
FormItem(String(localized: "Path")) {
TextField("Path", text: $remotePath, prompt: Text("Required"))
.multilineTextAlignment(.trailing)
}
} else if profileType == .remote {
FormItem("URL") {
FormItem(String(localized: "URL")) {
TextField("URL", text: $remotePath, prompt: Text("Required"))
.multilineTextAlignment(.trailing)
}
Toggle("Auto Update", isOn: $autoUpdate)
FormItem("Auto Update Interval") {
FormItem(String(localized: "Auto Update Interval")) {
TextField("Auto Update Interval", text: $autoUpdateInterval.stringBinding(defaultValue: 60), prompt: Text("In Minutes"))
.multilineTextAlignment(.trailing)
#if os(iOS)
@@ -135,15 +135,15 @@ public struct NewProfileView: View {
isSaving = false
}
if profileName.isEmpty {
alert = Alert(errorMessage: "Missing profile name")
alert = Alert(errorMessage: String(localized: "Missing profile name"))
return
}
if remotePath.isEmpty {
if profileType == .icloud {
alert = Alert(errorMessage: "Missing path")
alert = Alert(errorMessage: String(localized: "Missing path"))
return
} else if profileType == .remote {
alert = Alert(errorMessage: "Missing URL")
alert = Alert(errorMessage: String(localized: "Missing URL"))
return
}
}