@@ -12,12 +12,20 @@ extension String {
1212 switch source {
1313 case let . hosting( bundle) :
1414 // 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: key, defaultValue: . init( developmentValue ?? " " ) , table: tableName, bundle: bundle, comment: " " )
17+ } else {
18+ NSLocalizedString ( key. description, tableName: tableName, bundle: bundle, value: developmentValue ?? " " , comment: " " )
19+ }
1620 self = String ( format: format, locale: overrideLocale ?? Locale . current, arguments: arguments)
1721
1822 case let . selected( bundle, locale) :
1923 // 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: key, defaultValue: . init( developmentValue ?? " " ) , table: tableName, bundle: bundle, comment: " " )
26+ } else {
27+ NSLocalizedString ( key. description, tableName: tableName, bundle: bundle, value: developmentValue ?? " " , comment: " " )
28+ }
2129 self = String ( format: format, locale: overrideLocale ?? locale, arguments: arguments)
2230
2331 case . none:
0 commit comments