Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Deleted connections still showing in Spotlight, Siri, Shortcuts and Handoff on iPhone and iPad.
- No confirmation before deleting a tag on iPhone and iPad.
- Picking an SSH key file on iPhone and iPad replacing another connection's key file of the same name.
- Table page range shown in English in every language on iPhone and iPad.

### Security

Expand Down
28 changes: 28 additions & 0 deletions TableProMobile/TableProMobile/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,34 @@
}
}
},
"%1$lld-%2$lld of %3$lld" : {
"localizations" : {
"ko" : {
"stringUnit" : {
"state" : "translated",
"value" : "%1$lld-%2$lld / %3$lld"
}
},
"vi" : {
"stringUnit" : {
"state" : "translated",
"value" : "%1$lld-%2$lld trên %3$lld"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "%1$lld-%2$lld / %3$lld"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "%1$lld-%2$lld / %3$lld"
}
}
}
},
"%@" : {
"localizations" : {
"ko" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ final class DataBrowserViewModel {
guard !legacyRows.isEmpty else { return "" }
let start = pagination.currentOffset + 1
let end = pagination.currentOffset + legacyRows.count
if let total = pagination.totalRows {
return "\(start)-\(end) of \(total)"
}
return "\(start)-\(end)"
guard let total = pagination.totalRows else { return "\(start)-\(end)" }
return Self.pageRangeLabel(start: start, end: end, total: total)
}

nonisolated static func pageRangeLabel(start: Int, end: Int, total: Int, bundle: Bundle = .main) -> String {
String(format: String(localized: "%1$lld-%2$lld of %3$lld", bundle: bundle), start, end, total)
}

// MARK: - Attach
Expand Down
10 changes: 10 additions & 0 deletions TableProMobile/TableProMobileTests/DataBrowserViewModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ struct DataBrowserViewModelTests {
#expect(vm.pagination.currentPage == 0, "previous on page 0 should not underflow")
}

@Test("The page range reads in the app's language")
func pageRangeLabelIsLocalized() throws {
#expect(DataBrowserViewModel.pageRangeLabel(start: 1, end: 100, total: 3_503) == "1-100 of 3503")

let path = try #require(Bundle.main.path(forResource: "vi", ofType: "lproj"))
let vietnamese = try #require(Bundle(path: path))
let label = DataBrowserViewModel.pageRangeLabel(start: 1, end: 100, total: 3_503, bundle: vietnamese)
#expect(label == "1-100 trên 3503")
}

@Test("primaryKeyValues returns only PK columns from row")
func primaryKeyExtraction() async {
let driver = MockDatabaseDriver()
Expand Down
Loading