forked from liamnichols/xcstrings-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testGenerateWithPackageAccessLevel.Localizable.swift
68 lines (64 loc) · 1.91 KB
/
testGenerateWithPackageAccessLevel.Localizable.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import Foundation
@available(macOS 13, iOS 16, tvOS 16, watchOS 9, *)
package enum Localizable {
/// This is a comment
package static let key = resolve(
LocalizedStringResource(
"Key",
defaultValue: ###"Default Value"###,
table: "Localizable",
locale: .current,
bundle: .current
)
)
package static let myDeviceVariant = resolve(
LocalizedStringResource(
"myDeviceVariant",
defaultValue: ###"Multiplatform Original"###,
table: "Localizable",
locale: .current,
bundle: .current
)
)
package static func myPlural(_ arg1: Int) -> String {
resolve(
LocalizedStringResource(
"myPlural",
defaultValue: ###"I have \###(arg1) plurals"###,
table: "Localizable",
locale: .current,
bundle: .current
)
)
}
package static func mySubstitute(_ arg1: Int, count arg2: Int) -> String {
resolve(
LocalizedStringResource(
"mySubstitute",
defaultValue: ###"\###(arg1): People liked \###(arg2) posts"###,
table: "Localizable",
locale: .current,
bundle: .current
)
)
}
}
@available(macOS 13, iOS 16, tvOS 16, watchOS 9, *)
extension LocalizedStringResource.BundleDescription {
#if !SWIFT_PACKAGE
private class BundleLocator {
}
#endif
fileprivate static let current: Self = {
#if SWIFT_PACKAGE
.atURL(Bundle.module.bundleURL)
#else
.forClass(BundleLocator.self)
#endif
}()
}
@available(macOS 13, iOS 16, tvOS 16, watchOS 9, *)
private extension Localizable {
static func resolve(_ resource: LocalizedStringResource) -> String { String(localized: resource)
}
}