@@ -12,12 +12,20 @@ extension String {
12
12
switch source {
13
13
case let . hosting( bundle) :
14
14
// With fallback to developmentValue
15
- let format = NSLocalizedString ( key. description, tableName: tableName, bundle: bundle, value: developmentValue ?? " " , comment: " " )
15
+ let format = if #available( macOS 12 , iOS 15 , tvOS 15 , watchOS 8 , * ) {
16
+ String ( localized: . init( key. description) , table: tableName, bundle: bundle, comment: " " )
17
+ } else {
18
+ NSLocalizedString ( key. description, tableName: tableName, bundle: bundle, value: developmentValue ?? " " , comment: " " )
19
+ }
16
20
self = String ( format: format, locale: overrideLocale ?? Locale . current, arguments: arguments)
17
21
18
22
case let . selected( bundle, locale) :
19
23
// Don't use developmentValue with selected bundle/locale
20
- let format = NSLocalizedString ( key. description, tableName: tableName, bundle: bundle, value: " " , comment: " " )
24
+ let format = if #available( macOS 12 , iOS 15 , tvOS 15 , watchOS 8 , * ) {
25
+ String ( localized: . init( key. description) , table: tableName, bundle: bundle, comment: " " )
26
+ } else {
27
+ NSLocalizedString ( key. description, tableName: tableName, bundle: bundle, value: developmentValue ?? " " , comment: " " )
28
+ }
21
29
self = String ( format: format, locale: overrideLocale ?? locale, arguments: arguments)
22
30
23
31
case . none:
0 commit comments