Skip to content

Commit

Permalink
Merge pull request #35 from wacumov/swiftpm-strings
Browse files Browse the repository at this point in the history
Fix localization for SwiftPM
  • Loading branch information
takecian authored Feb 6, 2021
2 parents aceaf7d + d307f5b commit 3002392
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// swift-tools-version:5.0
// swift-tools-version:5.3
import PackageDescription

let package = Package(
name: "SwiftRater",
defaultLocalization: "en",
platforms: [
.iOS(.v10)
],
Expand Down
10 changes: 9 additions & 1 deletion SwiftRater/SwiftRater.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ import StoreKit
}

private func localize(_ key: String) -> String {
return NSLocalizedString(key, tableName: "SwiftRaterLocalization", bundle: Bundle(for: SwiftRater.self), comment: "")
return NSLocalizedString(key, tableName: "SwiftRaterLocalization", bundle: Bundle.module, comment: "")
}

private var mainAppName: String {
Expand Down Expand Up @@ -341,3 +341,11 @@ import StoreKit
#endif
}
}

#if !SWIFT_PACKAGE
extension Bundle {
static var module: Bundle {
Bundle(for: SwiftRater.self)
}
}
#endif

0 comments on commit 3002392

Please sign in to comment.