Fix remaining manual-plural i18n anti-patterns app-wide
Three pre-existing spots used count == 1 ? "" : "s" instead of the inflect syntax CLAUDE.md documents: GitSyncManualFixSheet's step() helper (also switched String -> LocalizedStringKey, another documented anti-pattern), PaperlessService.testConnection(), and AnytypeMCPService.testConnection().
This commit is contained in:
@@ -44,7 +44,7 @@ class AnytypeMCPService {
|
|||||||
let result = try await request(endpoint: "/v1/spaces", method: "GET", body: nil)
|
let result = try await request(endpoint: "/v1/spaces", method: "GET", body: nil)
|
||||||
if let spaces = result["data"] as? [[String: Any]] {
|
if let spaces = result["data"] as? [[String: Any]] {
|
||||||
isConnected = true
|
isConnected = true
|
||||||
return .success("Connected (\(spaces.count) space\(spaces.count == 1 ? "" : "s"))")
|
return .success(String(localized: "Connected (^[\(spaces.count) space](inflect: true))"))
|
||||||
} else {
|
} else {
|
||||||
isConnected = true
|
isConnected = true
|
||||||
return .success("Connected to Anytype")
|
return .success("Connected to Anytype")
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class PaperlessService {
|
|||||||
let result = try await request(endpoint: "/api/documents/", queryParams: ["page_size": "1"])
|
let result = try await request(endpoint: "/api/documents/", queryParams: ["page_size": "1"])
|
||||||
if let count = result["count"] as? Int {
|
if let count = result["count"] as? Int {
|
||||||
isConnected = true
|
isConnected = true
|
||||||
return .success("Connected (\(count) document\(count == 1 ? "" : "s"))")
|
return .success(String(localized: "Connected (^[\(count) document](inflect: true))"))
|
||||||
} else {
|
} else {
|
||||||
isConnected = true
|
isConnected = true
|
||||||
return .success("Connected to Paperless-NGX")
|
return .success("Connected to Paperless-NGX")
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ struct GitSyncManualFixSheet: View {
|
|||||||
.background(Color.secondary.opacity(0.08))
|
.background(Color.secondary.opacity(0.08))
|
||||||
.clipShape(RoundedRectangle(cornerRadius: 8))
|
.clipShape(RoundedRectangle(cornerRadius: 8))
|
||||||
|
|
||||||
step(2, "Delete the file\(files.count == 1 ? "" : "s") named in the error:")
|
step(2, "Delete ^[\(files.count) file](inflect: true) named in the error:")
|
||||||
VStack(alignment: .leading, spacing: 4) {
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
ForEach(files, id: \.self) { file in
|
ForEach(files, id: \.self) { file in
|
||||||
Text(file)
|
Text(file)
|
||||||
@@ -95,7 +95,7 @@ struct GitSyncManualFixSheet: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
private func step(_ number: Int, _ text: String) -> some View {
|
private func step(_ number: Int, _ text: LocalizedStringKey) -> some View {
|
||||||
HStack(alignment: .firstTextBaseline, spacing: 8) {
|
HStack(alignment: .firstTextBaseline, spacing: 8) {
|
||||||
Text("\(number).")
|
Text("\(number).")
|
||||||
.font(.system(size: 13, weight: .semibold))
|
.font(.system(size: 13, weight: .semibold))
|
||||||
|
|||||||
Reference in New Issue
Block a user