diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 4974f6b..3f195a2 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -11,13 +11,13 @@ jobs: SwiftActions: strategy: matrix: - os: [macos-12, ubuntu-latest] + os: [macos-14, ubuntu-latest] runs-on: ${{ matrix.os }} steps: - name: Checkout Source - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Swift Build uses: SwiftActions/SwiftBuild@main diff --git a/README.md b/README.md index fc074a8..b85ac91 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ import LocaleSupport ### LocaleSupport -This module is focused on implementing localized strings within apps themselves. Highlighted by the `ExpressibleByLocalizedString` protocol. +This module is focused on implementing localized strings within apps themselves. Highlighted by the `LocalizedStringConvertible` protocol. **Apple Platforms Note**: diff --git a/Sources/LocaleSupport/LocaleSupportConfiguration.swift b/Sources/LocaleSupport/LocaleSupportConfiguration.swift index a7f5485..4761521 100644 --- a/Sources/LocaleSupport/LocaleSupportConfiguration.swift +++ b/Sources/LocaleSupport/LocaleSupportConfiguration.swift @@ -3,6 +3,6 @@ public struct LocaleSupportConfiguration { private init() { } - /// Characters that will be prepended/appended to any default `ExpressibleByLocalizedString` implementation. + /// Characters that will be prepended/appended to any default `LocalizedStringConvertible` implementation. public static var defaultIndicators: (prefix: Character, suffix: Character)? } diff --git a/Sources/LocaleSupport/ExpressibleByLocalizedString.swift b/Sources/LocaleSupport/LocalizedStringConvertible.swift similarity index 88% rename from Sources/LocaleSupport/ExpressibleByLocalizedString.swift rename to Sources/LocaleSupport/LocalizedStringConvertible.swift index fe3bc55..10bc301 100644 --- a/Sources/LocaleSupport/ExpressibleByLocalizedString.swift +++ b/Sources/LocaleSupport/LocalizedStringConvertible.swift @@ -1,11 +1,14 @@ import Foundation -/// Protocol to which an enumeration can conform to produce String localizations. +@available(*, deprecated, renamed: "LocalizedStringConvertible") +public typealias ExpressibleByLocalizedString = LocalizedStringConvertible + +/// Protocol defining the properties needed to produce string localizations. /// /// Localization is one of the key differentiators between *good* apps and *great* apps. Though many development teams /// take on this challenge only after the application is 'complete'. /// -/// The aim of `ExpressibleByLocalizedString` is to quicken the process of localization, at the same time, taking much +/// The aim of `LocalizedStringConvertible` is to quicken the process of localization, at the same time, taking much /// of the *guess-work* out of the picture. /// /// When implemented on an `String` based enum, localization becomes a quick process that can be integrated at the @@ -13,7 +16,7 @@ import Foundation /// /// ``` /// /// Localized Strings for the MyAwesomeController class. -/// enum Strings: String, ExpressibleByLocalizedString { +/// enum Strings: String, LocalizedStringConvertible { /// /// My Awesome Controller /// case navigationTitle = "My Awesome Controller" /// /// Next @@ -29,7 +32,7 @@ import Foundation /// /// For detailed information on using `String` resources, see /// [Apple's Documentation](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html#//apple_ref/doc/uid/20000005-97055) -public protocol ExpressibleByLocalizedString { +public protocol LocalizedStringConvertible { /// The '.strings' unique identifier for the localization var key: String { get } @@ -71,8 +74,8 @@ public protocol ExpressibleByLocalizedString { var defaultIndicators: (prefix: Character, suffix: Character)? { get } } -public extension ExpressibleByLocalizedString { - /// The value returned from 'NSLocalizedString(...)' +public extension LocalizedStringConvertible { + /// The value returned from 'NSLocalizedString(...)' or `Bundle.localizedString()`. var localizedValue: String { #if canImport(ObjectiveC) return NSLocalizedString(key, tableName: tableName, bundle: bundle, value: defaultValue, comment: comment ?? "") @@ -83,7 +86,7 @@ public extension ExpressibleByLocalizedString { } // MARK: - Key Generation -public extension ExpressibleByLocalizedString { +public extension LocalizedStringConvertible { /// Generates a '.strings' key applying casing & prefixing as needed. /// /// Each localization needs a unique 'key' to be defined in the '.strings' files. If a `prefix` is specific, it will @@ -112,7 +115,7 @@ public extension ExpressibleByLocalizedString { } // MARK: - Default Parameters -public extension ExpressibleByLocalizedString { +public extension LocalizedStringConvertible { var key: String { autogeneratedKey } var bundle: Bundle { .main } var tableName: String? { nil } @@ -122,7 +125,7 @@ public extension ExpressibleByLocalizedString { } // MARK: - RawRepresentable Values -public extension ExpressibleByLocalizedString where Self: RawRepresentable, Self.RawValue == String { +public extension LocalizedStringConvertible where Self: RawRepresentable, Self.RawValue == String { /// `rawValue` of a `String` RawRepresentable case (with indicators if present). /// /// When an enumeration is declared to be using a `RawValue` of type `String`, the assumption will be that the value diff --git a/Tests/LocaleSupportTests/ExpressibleByLocalizedStringTests.swift b/Tests/LocaleSupportTests/LocalizedStringConvertibleTests.swift similarity index 97% rename from Tests/LocaleSupportTests/ExpressibleByLocalizedStringTests.swift rename to Tests/LocaleSupportTests/LocalizedStringConvertibleTests.swift index 840abcf..b825c65 100644 --- a/Tests/LocaleSupportTests/ExpressibleByLocalizedStringTests.swift +++ b/Tests/LocaleSupportTests/LocalizedStringConvertibleTests.swift @@ -5,7 +5,7 @@ final class ExpressibleByLocalizedStringTests: XCTestCase { private static var bundle: Bundle = .main - private enum Strings: String, ExpressibleByLocalizedString { + private enum Strings: String, LocalizedStringConvertible { case alertTitle = "Delete Document" case alertMessage = "Are you sure you want to delete the document?" case confirm = "Yes"