Tweaks and fixes throughout the project (#27)
This PR contains the work done to do a little bit of housekeeping pass across all packages and the Website service. To provide further details about the work: * Refreshed the READMEs and source documentation to match the current code; * Tagged every test case consistently across the Infrastructure, Localization, Persistence, and Website test targets; * Removed Website middleware tests now covered by Infrastructure's own suite; * Conformed the `PrepareDB` method to Sendable; * Relaxes the production Compose DATABASE_TLS default from require to prefer; * Added Persistence test verifying the prefer posture falls back to plaintext connections. Reviewed-on: rock-n-code/loud-amsterdam#27 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:
@@ -2,9 +2,8 @@ import Foundation
|
||||
|
||||
/// A reusable, bundle-bound localizer that resolves String Catalog entries for an explicit locale.
|
||||
///
|
||||
/// A server has no single "current" locale, so each lookup must name the locale to use. An instance
|
||||
/// is bound to the bundle whose catalog holds the strings, then invoked like a function to resolve a
|
||||
/// key in a chosen locale.
|
||||
/// A server has no single "current" locale, so each lookup must name the locale to use. An instance is bound to the bundle whose catalog holds the strings,
|
||||
/// then invoked like a function to resolve a key in a chosen locale.
|
||||
public struct Localize: Sendable {
|
||||
|
||||
// MARK: Properties
|
||||
@@ -16,8 +15,7 @@ public struct Localize: Sendable {
|
||||
|
||||
/// 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``.
|
||||
/// 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
|
||||
}
|
||||
@@ -56,8 +54,8 @@ public struct Localize: Sendable {
|
||||
/// - Parameters:
|
||||
/// - key: the String Catalog key to look up.
|
||||
/// - locale: the locale to resolve the key in.
|
||||
/// - Returns: the localized string for the locale, the source-language string when the locale has no
|
||||
/// entry, or the key itself when the catalog has no entry for it.
|
||||
/// - Returns: the localized string for the locale, the source-language string when the locale has no entry, or the key itself when the catalog has no
|
||||
/// entry for it.
|
||||
public func callAsFunction(
|
||||
_ key: String,
|
||||
locale: Locale
|
||||
|
||||
Reference in New Issue
Block a user