Fixes for the Localization package (#26)

This PR contains the work done to

Reviewed-on: rock-n-code/loud-amsterdam#26
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit is contained in:
2026-07-28 23:37:33 +00:00
committed by javier
parent cdded06ba3
commit 0887135328
16 changed files with 518 additions and 80 deletions
@@ -12,6 +12,16 @@ public struct Localize: Sendable {
/// The backend that resolves keys against the catalog.
private let resolver: any CatalogResolving
// MARK: Computed
/// The outcome of reading the bundle's String Catalog.
///
/// Resolution degrades to returning raw keys rather than failing, so check this once at startup
/// and warn when it is not ``CatalogState/loaded``.
public var catalogState: CatalogState {
resolver.state
}
// MARK: Initializers
/// Creates a localizer backed by the String Catalog in the given bundle.
@@ -22,7 +32,7 @@ public struct Localize: Sendable {
bundle: Bundle,
table: String = "Localizable"
) {
self.init(resolver: StringCatalog(
self.init(resolver: StringCatalog.cached(
bundle: bundle,
table: table
))