Localization work

This commit is contained in:
Stuart Breckenridge
2022-12-30 21:53:07 +08:00
parent d457b2dd53
commit 2bca08195e
54 changed files with 1172 additions and 350 deletions

View File

@@ -18,7 +18,7 @@ struct SettingsViewRows {
/// This row, when tapped, will open iOS System Settings.
static var openSystemSettings: some View {
Label {
Text("Open System Settings", comment: "Button: opens device Settings app.")
Text("button.title.open-system-settings", comment: "Open System Settings")
} icon: {
Image("system.settings")
.resizable()
@@ -36,7 +36,7 @@ struct SettingsViewRows {
static var configureNewArticleNotifications: some View {
NavigationLink(destination: NewArticleNotificationsView()) {
Label {
Text("New Article Notifications", comment: "Button: opens New Article Notifications view")
Text("button.title.new-article-notifications", comment: "New Article Notifications")
} icon: {
Image("notifications.sounds")
.resizable()
@@ -51,7 +51,7 @@ struct SettingsViewRows {
static var addAccount: some View {
NavigationLink(destination: AccountsManagementView()) {
Label {
Text("Manage Accounts", comment: "Button: opens Accounts Management view")
Text("button.title.manage-accounts", comment: "Manage Accounts")
} icon: {
Image("app.account")
.resizable()
@@ -66,7 +66,7 @@ struct SettingsViewRows {
static var manageExtensions: some View {
NavigationLink(destination: ExtensionsManagementView()) {
Label {
Text("Manage Extensions", comment: "Button: opens Extensions Management view")
Text("button.title.manage-extensions", comment: "Manage Extensions")
} icon: {
Image("app.extension")
.resizable()
@@ -83,7 +83,7 @@ struct SettingsViewRows {
showImportActionSheet.wrappedValue.toggle()
} label: {
Label {
Text("Import Subscriptions", comment: "Button: opens import subscriptions view")
Text("button.title.import-subscriptions", comment: "Import Subscriptions")
.foregroundColor(.primary)
} icon: {
@@ -102,7 +102,7 @@ struct SettingsViewRows {
showExportActionSheet.wrappedValue.toggle()
} label: {
Label {
Text("Export Subscriptions", comment: "Button: opens Export Subscriptions view")
Text("button.title.export-subscriptions", comment: "Export Subscriptions")
.foregroundColor(.primary)
} icon: {
@@ -119,7 +119,7 @@ struct SettingsViewRows {
/// - Returns: `Toggle`
static func sortOldestToNewest(_ preference: Binding<Bool>) -> some View {
Toggle(isOn: preference) {
Text("Sort Oldest to Newest", comment: "Toggle: Sort articles from oldest to newest when enabled.")
Text("toggle.title.sort-oldest-to-newest", comment: "Sort Oldest to Newest")
}
}
@@ -128,7 +128,7 @@ struct SettingsViewRows {
/// - Returns: `Toggle`
static func groupByFeed(_ preference: Binding<Bool>) -> some View {
Toggle(isOn: preference) {
Text("Group by Feed", comment: "Toggle: groups articles by feed when enabled.")
Text("toggle.title.group-by-feed", comment: "Group by Feed")
}
}
@@ -137,7 +137,7 @@ struct SettingsViewRows {
/// - Returns: `Toggle`
static func refreshToClearReadArticles(_ preference: Binding<Bool>) -> some View {
Toggle(isOn: preference) {
Text("Refresh to Clear Read Articles", comment: "Toggle: when enabled, articles will be cleared when the timeline is refreshed")
Text("toggle.title.refresh-to-clear-articles", comment: "Refresh to Clear Articles")
}
}
@@ -147,7 +147,7 @@ struct SettingsViewRows {
NavigationLink {
TimelineCustomizerView()
} label: {
Text("Timeline Layout", comment: "Button: opens the timeline customiser")
Text("button.title.timeline-layout", comment: "Timeline Layout")
}
}
@@ -156,7 +156,7 @@ struct SettingsViewRows {
static var themeSelection: some View {
NavigationLink(destination: ArticleThemeManagerView()) {
HStack {
Text("Article Theme", comment: "Button: opens the Article Theme manager view")
Text("button.title.artice-themes", comment: "Article Themes")
Spacer()
Text(ArticleThemesManager.shared.currentTheme.name)
.font(.callout)
@@ -170,7 +170,7 @@ struct SettingsViewRows {
/// - Returns: `Toggle`
static func confirmMarkAllAsRead(_ preference: Binding<Bool>) -> some View {
Toggle(isOn: preference) {
Text("Confirm Mark All as Read", comment: "Toggle: when enabled, the app will confirm whether to mark all items as read")
Text("toggle.title.confirm-mark-all-as-read", comment: "Confirm Mark All as Read")
}
}
@@ -179,7 +179,7 @@ struct SettingsViewRows {
/// - Returns: `Toggle`
static func openLinksInNetNewsWire(_ preference: Binding<Bool>) -> some View {
Toggle(isOn: preference) {
Text("Open Links in NetNewsWire", comment: "Toggle: when enabled, links will open in NetNewsWire")
Text("toggle.title.open-links-in-netnewswire", comment: "Open Links in NetNewsWire")
}
}
@@ -190,7 +190,7 @@ struct SettingsViewRows {
static func configureAppearance(_ isShown: Binding<Bool>) -> some View {
NavigationLink(destination: DisplayAndBehaviorsView(), isActive: isShown) {
Label {
Text("Display & Behaviours", comment: "Button: opens the Display and Appearance view.")
Text("button.title.display-and-behaviors", comment: "Display & Behaviors")
} icon: {
Image("app.appearance")
.resizable()
@@ -228,7 +228,7 @@ struct SettingsViewRows {
AboutView()
} label: {
Label {
Text("About", comment: "Button: opens the NetNewsWire about view.")
Text("button.title.about", comment: "About")
} icon: {
Image(systemName: "info.circle")
.resizable()

View File

@@ -23,18 +23,18 @@ struct SettingsView: View {
NavigationView {
List {
// Device Permissions
Section(header: Text("Device Permissions", comment: "Settings: Device Permissions section header."),
footer: Text("Configure NetNewsWire's access to Siri, background app refresh, mobile data, and more.", comment: "Settings: Device Permissions section footer.")) {
Section(header: Text("label.text.device-permissions", comment: "Device Permissions"),
footer: Text("label.text.device-permissions-explainer", comment: "Configure NetNewsWire's access to Siri, background app refresh, mobile data, and more.")) {
SettingsViewRows.openSystemSettings
}
// Account/Extensions/OPML Management
Section(header: Text("Accounts & Extensions", comment: "Settings: Accounts and Extensions section header."),
footer: Text("Add, delete, enable, or disable accounts and extensions.", comment: "Settings: Accounts and Extensions section footer.")) {
Section(header: Text("label.text.accounts-and-extensions", comment: "Settings: Accounts & Extensions section header."),
footer: Text("label.text.account-and-extensions-explainer", comment: "Add, delete, enable, or disable accounts and extensions.")) {
SettingsViewRows.addAccount
SettingsViewRows.manageExtensions
SettingsViewRows.importOPML(showImportActionSheet: $viewModel.showImportActionSheet)
.confirmationDialog(Text("Choose an account to receive the imported feeds and folders", comment: "Import OPML confirmation title."),
.confirmationDialog(Text("actionsheet.title.choose-opml-destination", comment: "Choose an account to receive the imported feeds and folders"),
isPresented: $viewModel.showImportActionSheet,
titleVisibility: .visible) {
ForEach(AccountManager.shared.sortedActiveAccounts, id: \.self) { account in
@@ -46,7 +46,7 @@ struct SettingsView: View {
}
SettingsViewRows.exportOPML(showExportActionSheet: $viewModel.showExportActionSheet)
.confirmationDialog(Text("Choose an account with the subscriptions to export", comment: "Export OPML confirmation title."),
.confirmationDialog(Text("actionsheet.title.choose-opml-export-account", comment: "Choose an account with the subscriptions to export"),
isPresented: $viewModel.showExportActionSheet,
titleVisibility: .visible) {
ForEach(AccountManager.shared.sortedAccounts, id: \.self) { account in
@@ -65,8 +65,8 @@ struct SettingsView: View {
}
// Appearance
Section(header: Text("Appearance", comment: "Settings: Appearance section header."),
footer: Text("Manage the look, feel, and behavior of NetNewsWire.", comment: "Settings: Appearance section footer.")) {
Section(header: Text("label.text.appearance", comment: "Settings: Appearance section header."),
footer: Text("label.text.appearance-explainer", comment: "Manage the look, feel, and behavior of NetNewsWire.")) {
SettingsViewRows.configureAppearance($isConfigureAppearanceShown)
if viewModel.notificationPermissions == .authorized {
SettingsViewRows.configureNewArticleNotifications
@@ -83,11 +83,11 @@ struct SettingsView: View {
}
.tint(Color(uiColor: AppAssets.primaryAccentColor))
.listStyle(.insetGrouped)
.navigationTitle(Text("Settings", comment: "Navigation bar title for Settings."))
.navigationTitle(Text("navigation.title.settings", comment: "Settings"))
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .navigationBarLeading, content: {
Button(action: { dismiss() }, label: { Text("Done", comment: "Button title") })
Button(action: { dismiss() }, label: { Text("button.title.done", comment: "Done") })
})
}
.sheet(isPresented: $viewModel.showAddAccountView) {
@@ -144,18 +144,18 @@ struct SettingsView: View {
viewModel.showImportExportError = true
}
})
.alert(Text("Imported Successfully", comment: "Alert title: imported OPML file successfully."),
.alert(Text("alert.title.opml.opml-import-success", comment: "Alert title: Imported Successfully"),
isPresented: $viewModel.showImportSuccess,
actions: {},
message: { Text("Subscriptions have been imported to your \(viewModel.importAccount?.nameForDisplay ?? "") account.", comment: "Alert message: imported OPML file successfully.") })
.alert(Text("Exported Successfully", comment: "Alert title: exported OPML file successfully."),
message: { Text("alert.message.opml-import-success.%@", comment: "Subscriptions have been imported to your “%@“ account.") })
.alert(Text("alert.title.opml.opml-export-success", comment: "Alert title: Exported Successfully"),
isPresented: $viewModel.showExportSuccess,
actions: {},
message: { Text("Your OPML file has been successfully exported.", comment: "Alert message: exported OPML file successfully.") })
.alert(Text("Error", comment: "Alert title: Error"),
message: { Text("alert.message.opml.opml-export-success", comment: "Your subscriptions have been exported successfully.") })
.alert(Text("alert.title.error", comment: "Error"),
isPresented: $viewModel.showImportExportError,
actions: {},
message: { Text(viewModel.importExportError?.localizedDescription ?? "Import/Export Error") } )
message: { Text(verbatim: viewModel.importExportError?.localizedDescription ?? "") } )
}.navigationViewStyle(.stack)
}
}