Issue #11: Switched to old-school localization so we can leverage Weblate.

This commit is contained in:
Benjamin Erhart 2026-05-29 16:54:21 +02:00
parent 3aee0db9e9
commit ddcf2070f7
22 changed files with 285 additions and 787 deletions

View file

@ -23,9 +23,9 @@ struct HomeView: View {
Section {
HStack {
VStack(alignment: .leading, spacing: 4) {
Text("DNS Protection")
Text(NSLocalizedString("DNS Protection", comment: ""))
.font(.headline)
Text(viewModel.isDnsEnabled ? "Active" : "Inactive")
Text(viewModel.isDnsEnabled ? NSLocalizedString("Active", comment: "") : NSLocalizedString("Inactive", comment: ""))
.font(.caption)
.foregroundStyle(viewModel.isDnsEnabled ? .green : .secondary)
}
@ -82,24 +82,24 @@ struct HomeView: View {
.opacity(option.enabled ? 1 : 0.6)
}
} header: {
Text("Blocklist")
Text(NSLocalizedString("Blocklist", comment: ""))
} footer: {
Text("Select the level of protection for your DNS queries")
Text(NSLocalizedString("Select the level of protection for your DNS queries", comment: ""))
}
// Status section
if viewModel.isDnsEnabled {
Section {
HStack {
Label("Status", systemImage: "checkmark.circle.fill")
Label(NSLocalizedString("Status", comment: ""), systemImage: "checkmark.circle.fill")
.foregroundStyle(.green)
Spacer()
Text("Connected")
Text(NSLocalizedString("Connected", comment: ""))
.foregroundStyle(.secondary)
}
HStack {
Label("Server", systemImage: "server.rack")
Label(NSLocalizedString("Server", comment: ""), systemImage: "server.rack")
Spacer()
Text(viewModel.blocklist.server)
.foregroundStyle(.secondary)
@ -123,13 +123,13 @@ struct HomeView: View {
}
HStack {
Label("Domains in blocklist", systemImage: "xmark.shield.fill")
Label(NSLocalizedString("Domains in blocklist", comment: ""), systemImage: "xmark.shield.fill")
Spacer()
BlockedCount()
.foregroundStyle(.secondary)
}
} header: {
Text("Connection Details")
Text(NSLocalizedString("Connection Details", comment: ""))
}
}
@ -138,7 +138,7 @@ struct HomeView: View {
Link(destination: falsePositiveURL) {
HStack {
Label {
Text("Report False Positive")
Text(NSLocalizedString("Report False Positive", comment: ""))
} icon: {
Image(systemName: "exclamationmark.bubble")
.foregroundStyle(.orange)
@ -152,7 +152,7 @@ struct HomeView: View {
}
}.foregroundStyle(.primary)
} footer: {
Text("Submit incorrectly blocked domains for review")
Text(NSLocalizedString("Submit incorrectly blocked domains for review", comment: ""))
}
// Service status section
@ -164,7 +164,7 @@ struct HomeView: View {
.frame(width: 12, height: 12)
VStack(alignment: .leading, spacing: 4) {
Text("Service Status")
Text(NSLocalizedString("Service Status", comment: ""))
.font(.headline)
Text(viewModel.summaryStatus.description)
.font(.caption)
@ -183,7 +183,7 @@ struct HomeView: View {
Link(destination: tosURL) {
HStack(spacing: 12) {
Image(systemName: "doc.text")
Text("Terms of Service")
Text(NSLocalizedString("Terms of Service", comment: ""))
Spacer()
Image(systemName: "arrow.up.right.square")
.font(.caption)
@ -195,7 +195,7 @@ struct HomeView: View {
Link(destination: privacyPolicyURL) {
HStack(spacing: 12) {
Image(systemName: "doc.text")
Text("Privacy Policy")
Text(NSLocalizedString("Privacy Policy", comment: ""))
Spacer()
Image(systemName: "arrow.up.right.square")
.font(.caption)
@ -207,7 +207,7 @@ struct HomeView: View {
}
.navigationTitle(ViewModel.title)
.animation(.default, value: viewModel.isDnsEnabled)
.onChange(of: scenePhase) { _, newPhase in
.onChange(of: scenePhase) { newPhase in
if newPhase == .active {
Task {
await viewModel.refreshConfig()