Skip to content

Commit 6e6f100

Browse files
committed
feat: wrap user-facing strings with String(localized:) for Vietnamese localization
1 parent 1edbd67 commit 6e6f100

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

TableProMobile/TableProMobile/Helpers/AppError.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,18 @@ enum ErrorClassifier {
111111
let recovery: String
112112

113113
if msg.lowercased().contains("authentication") || msg.lowercased().contains("key") {
114-
recovery = "Check your SSH username, password, or private key."
114+
recovery = String(localized: "Check your SSH username, password, or private key.")
115115
} else if msg.lowercased().contains("handshake") {
116-
recovery = "The SSH server may be unreachable or running a different protocol."
116+
recovery = String(localized: "The SSH server may be unreachable or running a different protocol.")
117117
} else if msg.lowercased().contains("channel") {
118-
recovery = "The SSH tunnel connected but could not forward to the database port."
118+
recovery = String(localized: "The SSH tunnel connected but could not forward to the database port.")
119119
} else {
120-
recovery = "Check your SSH host, port, and credentials."
120+
recovery = String(localized: "Check your SSH host, port, and credentials.")
121121
}
122122

123123
return AppError(
124124
category: .ssh,
125-
title: "SSH Tunnel Failed",
125+
title: String(localized: "SSH Tunnel Failed"),
126126
message: msg,
127127
recovery: recovery,
128128
underlying: error
@@ -133,9 +133,9 @@ enum ErrorClassifier {
133133
let dbName = context.databaseType?.rawValue ?? "Database"
134134
return AppError(
135135
category: .auth,
136-
title: "Authentication Failed",
136+
title: String(localized: "Authentication Failed"),
137137
message: error.localizedDescription,
138-
recovery: "Check your \(dbName) username and password.",
138+
recovery: String(format: String(localized: "Check your %@ username and password."), dbName),
139139
underlying: error
140140
)
141141
}
@@ -145,16 +145,16 @@ enum ErrorClassifier {
145145
let recovery: String
146146

147147
if msg.lowercased().contains("timeout") || msg.lowercased().contains("timed out") {
148-
recovery = "The server is not responding. Check your network connection and that the server is running."
148+
recovery = String(localized: "The server is not responding. Check the host and port.")
149149
} else if msg.lowercased().contains("refused") {
150-
recovery = "Connection refused. Verify the host address and port number."
150+
recovery = String(localized: "Connection refused. The server may not be running or the port is incorrect.")
151151
} else {
152-
recovery = "Check your network connection and server availability."
152+
recovery = String(localized: "Check your network connection and server availability.")
153153
}
154154

155155
return AppError(
156156
category: .network,
157-
title: "Connection Failed",
157+
title: String(localized: "Connection Failed"),
158158
message: msg,
159159
recovery: recovery,
160160
underlying: error
@@ -166,18 +166,18 @@ enum ErrorClassifier {
166166
let recovery: String
167167

168168
if msg.lowercased().contains("syntax") {
169-
recovery = "Check your SQL syntax."
169+
recovery = String(localized: "Check your SQL syntax.")
170170
} else if msg.lowercased().contains("constraint") || msg.lowercased().contains("duplicate") {
171-
recovery = "The operation violates a database constraint. Check for duplicate or missing required values."
171+
recovery = String(localized: "The operation violates a database constraint.")
172172
} else if msg.lowercased().contains("no such table") || msg.lowercased().contains("does not exist") {
173-
recovery = "The table or column does not exist. It may have been renamed or deleted."
173+
recovery = String(localized: "The table or column does not exist.")
174174
} else {
175-
recovery = "Check your query and try again."
175+
recovery = String(localized: "Check your query and try again.")
176176
}
177177

178178
return AppError(
179179
category: .query,
180-
title: "Query Error",
180+
title: String(localized: "Query Error"),
181181
message: msg,
182182
recovery: recovery,
183183
underlying: error
@@ -187,9 +187,9 @@ enum ErrorClassifier {
187187
private static func config(_ error: Error, context: ErrorContext) -> AppError {
188188
return AppError(
189189
category: .config,
190-
title: "Configuration Error",
190+
title: String(localized: "Configuration Error"),
191191
message: error.localizedDescription,
192-
recovery: "Check your connection settings.",
192+
recovery: String(localized: "Check your connection settings."),
193193
underlying: error
194194
)
195195
}

TableProMobile/TableProMobile/Views/ConnectedView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct ConnectedView: View {
5151
Group {
5252
if isConnecting {
5353
ProgressView {
54-
Text(verbatim: "Connecting to \(displayName)...")
54+
Text(String(format: String(localized: "Connecting to %@..."), displayName))
5555
}
5656
.frame(maxWidth: .infinity, maxHeight: .infinity)
5757
} else if let appError {

TableProMobile/TableProMobile/Views/ConnectionFormView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ struct ConnectionFormView: View {
181181
}
182182
}
183183
}
184-
.navigationTitle(existingConnection != nil ? "Edit Connection" : "New Connection")
184+
.navigationTitle(existingConnection != nil ? String(localized: "Edit Connection") : String(localized: "New Connection"))
185185
.navigationBarTitleDisplayMode(.inline)
186186
.toolbar {
187187
ToolbarItem(placement: .cancellationAction) {

TableProMobile/TableProMobile/Views/OnboardingView.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ struct OnboardingView: View {
7777
actionCard(
7878
icon: "icloud.and.arrow.down",
7979
color: .blue,
80-
title: "Sync from iCloud",
81-
description: "Import connections from your Mac"
80+
title: String(localized: "Sync from iCloud"),
81+
description: String(localized: "Import connections from your Mac")
8282
)
8383
}
8484
.buttonStyle(.plain)
@@ -87,8 +87,8 @@ struct OnboardingView: View {
8787
actionCard(
8888
icon: "plus.circle.fill",
8989
color: .green,
90-
title: "Add Connection",
91-
description: "Set up a new database connection"
90+
title: String(localized: "Add Connection"),
91+
description: String(localized: "Set up a new database connection")
9292
)
9393
}
9494
.buttonStyle(.plain)

TableProMobile/TableProMobile/Views/RowDetailView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ struct RowDetailView: View {
125125
.transition(.move(edge: .bottom).combined(with: .opacity))
126126
}
127127
}
128-
.navigationTitle("Row \(currentIndex + 1) of \(rows.count)")
128+
.navigationTitle(String(format: String(localized: "Row %d of %d"), currentIndex + 1, rows.count))
129129
.navigationBarTitleDisplayMode(.inline)
130130
.toolbar {
131131
ToolbarItem(placement: .primaryAction) {

0 commit comments

Comments
 (0)