Skip to content

Commit 7961a6e

Browse files
committed
fix: bundle crash at runtime
1 parent 2dca293 commit 7961a6e

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

Sources/Litext/Supplement/LocalizedText.swift

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,19 @@ import Foundation
1414
// **Localized resources can be mixed** -> true
1515
//
1616

17+
private let localizationBundle: Bundle = {
18+
#if SWIFT_PACKAGE
19+
return .module
20+
#else
21+
return .main
22+
#endif
23+
}()
24+
1725
public enum LocalizedText {
18-
public static let copy = NSLocalizedString("Copy", bundle: .module, comment: "Copy menu item")
19-
public static let selectAll = NSLocalizedString("Select All", bundle: .module, comment: "Select all menu item")
20-
public static let share = NSLocalizedString("Share", bundle: .module, comment: "Share menu item")
21-
public static let search = NSLocalizedString("Search", bundle: .module, comment: "Search index menu item")
22-
public static let openLink = NSLocalizedString("Open Link", bundle: .module, comment: "Open link menu item")
23-
public static let copyLink = NSLocalizedString("Copy Link", bundle: .module, comment: "Copy link menu item")
26+
public static let copy = NSLocalizedString("Copy", bundle: localizationBundle, comment: "Copy menu item")
27+
public static let selectAll = NSLocalizedString("Select All", bundle: localizationBundle, comment: "Select all menu item")
28+
public static let share = NSLocalizedString("Share", bundle: localizationBundle, comment: "Share menu item")
29+
public static let search = NSLocalizedString("Search", bundle: localizationBundle, comment: "Search index menu item")
30+
public static let openLink = NSLocalizedString("Open Link", bundle: localizationBundle, comment: "Open link menu item")
31+
public static let copyLink = NSLocalizedString("Copy Link", bundle: localizationBundle, comment: "Copy link menu item")
2432
}

0 commit comments

Comments
 (0)