@@ -29,7 +29,7 @@ struct AddNewPluginView: View {
2929 }
3030 . listStyle ( . grouped)
3131 . scrollContentBackground ( . hidden)
32- . navigationTitle ( " Add New Plugin " )
32+ . navigationTitle ( Strings . navigationTitle )
3333 . navigationBarTitleDisplayMode ( . inline)
3434 . searchable ( text: $viewModel. searchInput)
3535 . toolbar {
@@ -84,16 +84,21 @@ struct AddNewPluginView: View {
8484
8585 @ViewBuilder
8686 private func rowContent( _ row: ListRow ) -> some View {
87- if case . loading = row {
87+ switch row {
88+ case . loading:
8889 Label {
89- Text ( " Loading plugins... " )
90- } icon: { ProgressView ( ) }
90+ Text ( Strings . loadingPlugins)
91+ } icon: {
92+ ProgressView ( )
93+ }
9194 . font ( . callout)
9295 . foregroundColor ( . secondary)
9396 . frame ( maxWidth: . infinity, alignment: . center)
94- } else if case . error = row {
95- Text ( " Failed to load plugins. Tap here to retry " )
96- } else if case let . plugin( plugin, isInstalled) = row {
97+
98+ case . error( let errorMessage) :
99+ Text ( Strings . loadError)
100+
101+ case let . plugin( plugin, isInstalled) :
97102 NavigationLink ( destination: PluginDetailsView ( plugin: plugin, service: viewModel. service) ) {
98103 HStack ( alignment: . center) {
99104 PluginIconView ( plugin: plugin, service: viewModel. service)
@@ -130,10 +135,10 @@ struct AddNewPluginView: View {
130135 }
131136 }
132137 }
133- } else if case . empty = row {
134- Text ( " No plugins found " )
135- } else {
136- Text ( " Impossible to reach here " )
138+
139+ case . empty :
140+ Text ( Strings . noPluginsFound )
141+
137142 }
138143 }
139144}
@@ -165,14 +170,14 @@ private enum ListSection: Identifiable, Hashable {
165170 case let . plugins( category, _) :
166171 switch category {
167172 case . featured:
168- return " Featured "
173+ return Strings . featured
169174 case . popular:
170- return " Popular "
175+ return Strings . popular
171176 case . recommended:
172- return " Recommended "
177+ return Strings . recommended
173178 }
174179 case . searchResult:
175- return " Search Results "
180+ return Strings . searchResults
176181 }
177182 }
178183}
@@ -344,4 +349,52 @@ private enum Strings {
344349 value: " Installed " ,
345350 comment: " Tag shown next to plugins that are already installed "
346351 )
352+
353+ static let navigationTitle = NSLocalizedString (
354+ " site.plugins.add.title " ,
355+ value: " Add New Plugin " ,
356+ comment: " Navigation title for the add new plugin screen "
357+ )
358+
359+ static let loadingPlugins = NSLocalizedString (
360+ " site.plugins.add.loading " ,
361+ value: " Loading plugins... " ,
362+ comment: " Message shown while loading plugins in the list "
363+ )
364+
365+ static let loadError = NSLocalizedString (
366+ " site.plugins.add.loadError " ,
367+ value: " Failed to load plugins. Tap here to retry " ,
368+ comment: " Error message shown when plugins failed to load, with retry option "
369+ )
370+
371+ static let noPluginsFound = NSLocalizedString (
372+ " site.plugins.add.empty " ,
373+ value: " No plugins found " ,
374+ comment: " Message shown when no plugins are found in the list "
375+ )
376+
377+ static let featured = NSLocalizedString (
378+ " site.plugins.add.category.featured " ,
379+ value: " Featured " ,
380+ comment: " Title for the featured plugins section "
381+ )
382+
383+ static let popular = NSLocalizedString (
384+ " site.plugins.add.category.popular " ,
385+ value: " Popular " ,
386+ comment: " Title for the popular plugins section "
387+ )
388+
389+ static let recommended = NSLocalizedString (
390+ " site.plugins.add.category.recommended " ,
391+ value: " Recommended " ,
392+ comment: " Title for the recommended plugins section "
393+ )
394+
395+ static let searchResults = NSLocalizedString (
396+ " site.plugins.add.category.searchResults " ,
397+ value: " Search Results " ,
398+ comment: " Title for the search results section "
399+ )
347400}
0 commit comments