[CHANGE] Extracted some example strings and replaced them by generated localized strings

This commit is contained in:
Fabian Thies
2022-12-22 10:29:57 +01:00
committed by Joe Mattiello
parent e23956d4ed
commit 6257fdcd61
4 changed files with 57 additions and 9 deletions

View File

@@ -10,6 +10,38 @@ import Foundation
// swiftlint:disable explicit_type_interface function_parameter_count identifier_name line_length
// swiftlint:disable nesting type_body_length type_name vertical_whitespace_opening_braces
internal enum L10n {
internal enum BrowseView {
/// Search
internal static let search = L10n.tr("Localizable", "BrowseView.search", fallback: "Search")
/// BrowseView
internal static let title = L10n.tr("Localizable", "BrowseView.title", fallback: "Browse")
internal enum Actions {
/// Sources
internal static let sources = L10n.tr("Localizable", "BrowseView.Actions.sources", fallback: "Sources")
}
internal enum Section {
internal enum AllApps {
/// All Apps
internal static let title = L10n.tr("Localizable", "BrowseView.Section.AllApps.title", fallback: "All Apps")
}
internal enum PromotedCategories {
/// Show all
internal static let showAll = L10n.tr("Localizable", "BrowseView.Section.PromotedCategories.showAll", fallback: "Show all")
/// Promoted Categories
internal static let title = L10n.tr("Localizable", "BrowseView.Section.PromotedCategories.title", fallback: "Promoted Categories")
}
}
}
internal enum NewsView {
/// NewsView
internal static let title = L10n.tr("Localizable", "NewsView.title", fallback: "News")
internal enum Section {
internal enum FromSources {
/// From your Sources
internal static let title = L10n.tr("Localizable", "NewsView.Section.FromSources.title", fallback: "From your Sources")
}
}
}
}
// swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length
// swiftlint:enable nesting type_body_length type_name vertical_whitespace_opening_braces

View File

@@ -5,3 +5,17 @@
Created by Fabian Thies on 22.12.22.
Copyright © 2022 SideStore. All rights reserved.
*/
/* NewsView */
"NewsView.title" = "News";
"NewsView.Section.FromSources.title" = "From your Sources";
/* BrowseView */
"BrowseView.title" = "Browse";
"BrowseView.search" = "Search";
"BrowseView.Section.PromotedCategories.title" = "Promoted Categories";
"BrowseView.Section.PromotedCategories.showAll" = "Show all";
"BrowseView.Section.AllApps.title" = "All Apps";
"BrowseView.Actions.sources" = "Sources";

View File

@@ -37,7 +37,7 @@ struct BrowseView: View {
VStack(alignment: .leading, spacing: 32) {
promotedCategoriesView
Text("All Apps")
Text(L10n.BrowseView.Section.AllApps.title)
.font(.title2)
.bold()
}
@@ -55,16 +55,16 @@ struct BrowseView: View {
}
}
.padding()
.searchable(text: self.$searchText, placeholder: "Search")
.searchable(text: self.$searchText, placeholder: L10n.BrowseView.search)
}
.background(Color(UIColor.systemGroupedBackground).ignoresSafeArea())
.navigationTitle("Browse")
.navigationTitle(L10n.BrowseView.title)
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
SwiftUI.Button {
self.isShowingSourcesView = true
} label: {
Text("Sources")
Text(L10n.BrowseView.Actions.sources)
}
.sheet(isPresented: self.$isShowingSourcesView) {
NavigationView {
@@ -88,12 +88,14 @@ struct BrowseView: View {
var promotedCategoriesView: some View {
VStack {
HStack {
Text("Promoted Categories")
Text(L10n.BrowseView.Section.PromotedCategories.title)
.font(.title2)
.bold()
Spacer()
SwiftUI.Button(action: {}, label: { Text("Show all") })
.font(.callout)
SwiftUI.Button(action: {}, label: {
Text(L10n.BrowseView.Section.PromotedCategories.showAll)
})
.font(.callout)
}
LazyVGrid(columns: [GridItem(.flexible()), GridItem(.flexible())]) {

View File

@@ -29,7 +29,7 @@ struct NewsView: View {
self.announcementsCarousel
VStack(alignment: .leading) {
Text("From your Sources")
Text(L10n.NewsView.Section.FromSources.title)
.font(.title2)
.bold()
@@ -49,7 +49,7 @@ struct NewsView: View {
.padding()
}
.background(Color(UIColor.systemGroupedBackground).ignoresSafeArea())
.navigationTitle("News")
.navigationTitle(L10n.NewsView.title)
.sheet(item: self.$activeExternalUrl) { url in
SafariView(url: url)
.ignoresSafeArea()