From b7dbe5c6a5a73aac49b65c6f9469a7adaac9dd18 Mon Sep 17 00:00:00 2001 From: Stuart Breckenridge Date: Sun, 8 Jan 2023 09:20:19 +0800 Subject: [PATCH] Converts widget to localization standards The widget has been converted to the new Localization standards. Additionally, it has removed the build phase script for SwiftGen. --- .../en-GB.lproj/Localizable.stringsdict | 4 +- NetNewsWire.xcodeproj/project.pbxproj | 45 ++++------ Widget/Resources/Localized.swift | 86 ------------------- .../Resources/en-GB.lproj/Localizable.strings | 85 +++++++++--------- .../{ => en-GB.lproj}/Localizable.stringsdict | 56 +++++------- Widget/Resources/en.lproj/Localizable.strings | 34 ++++---- .../en.lproj/Localizable.stringsdict | 60 +++++++++++++ Widget/Shared Views/ArticleItemView.swift | 8 +- .../Widget Views/SmartFeedSummaryWidget.swift | 6 +- Widget/Widget Views/StarredWidget.swift | 12 ++- Widget/Widget Views/TodayWidget.swift | 14 ++- Widget/Widget Views/UnreadWidget.swift | 12 ++- Widget/WidgetBundle.swift | 16 ++-- 13 files changed, 196 insertions(+), 242 deletions(-) delete mode 100644 Widget/Resources/Localized.swift rename Widget/Resources/{ => en-GB.lproj}/Localizable.stringsdict (66%) create mode 100644 Widget/Resources/en.lproj/Localizable.stringsdict diff --git a/Mac/Resources/en-GB.lproj/Localizable.stringsdict b/Mac/Resources/en-GB.lproj/Localizable.stringsdict index 9a5aa2079..f271d95e3 100644 --- a/Mac/Resources/en-GB.lproj/Localizable.stringsdict +++ b/Mac/Resources/en-GB.lproj/Localizable.stringsdict @@ -12,10 +12,10 @@ NSStringPluralRuleType NSStringFormatValueTypeKey ld - other - Copy Article URLs one Copy Article URL + other + Copy Article URLs diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index 6ba549ea8..b9d58ccf1 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -8,7 +8,6 @@ /* Begin PBXBuildFile section */ 1701E1B52568983D009453D8 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1701E1B72568983D009453D8 /* Localizable.strings */; }; - 1701E1E725689D1E009453D8 /* Localized.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1701E1E625689D1E009453D8 /* Localized.swift */; }; 17071EF026F8137400F5E71D /* ArticleTheme+Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17071EEF26F8137400F5E71D /* ArticleTheme+Notifications.swift */; }; 17071EF126F8137400F5E71D /* ArticleTheme+Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17071EEF26F8137400F5E71D /* ArticleTheme+Notifications.swift */; }; 1710B9132552354E00679C0D /* AddAccountHelpView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1710B9122552354E00679C0D /* AddAccountHelpView.swift */; }; @@ -49,7 +48,6 @@ 179D280D26F73D83003B2E0A /* ArticleThemePlist.swift in Sources */ = {isa = PBXBuildFile; fileRef = 179D280C26F73D83003B2E0A /* ArticleThemePlist.swift */; }; 179DB1DFBCF9177104B12E0F /* AccountsNewsBlurWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 179DBBA2B22A659F81EED6F9 /* AccountsNewsBlurWindowController.swift */; }; 179DB3CE822BFCC2D774D9F4 /* AccountsNewsBlurWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 179DBBA2B22A659F81EED6F9 /* AccountsNewsBlurWindowController.swift */; }; - 17D0682C2564F47E00C0B37E /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 17D0682B2564F47E00C0B37E /* Localizable.stringsdict */; }; 17D643B126F8A436008D4C05 /* ArticleThemeDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17D643B026F8A436008D4C05 /* ArticleThemeDownloader.swift */; }; 17D643B226F8A436008D4C05 /* ArticleThemeDownloader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17D643B026F8A436008D4C05 /* ArticleThemeDownloader.swift */; }; 17E0084625941887000C23F0 /* SizeCategories.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17E0084525941887000C23F0 /* SizeCategories.swift */; }; @@ -861,6 +859,7 @@ DF790D6228E990A900455FC7 /* AboutData.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF790D6128E990A900455FC7 /* AboutData.swift */; }; DF84E563295122BA0045C334 /* TimelineCustomizerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF84E562295122BA0045C334 /* TimelineCustomizerView.swift */; }; DF93DB2B296A319000586C0E /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DF93DB2D296A319000586C0E /* Localizable.stringsdict */; }; + DF93DB2F296A42BD00586C0E /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = DF93DB31296A42BD00586C0E /* Localizable.stringsdict */; }; DFB3497A294A962D00BC81AD /* AddAccountListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFB34979294A962D00BC81AD /* AddAccountListView.swift */; }; DFB34980294B085100BC81AD /* AccountInspectorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFB3497F294B085100BC81AD /* AccountInspectorView.swift */; }; DFB34988294B447F00BC81AD /* InjectedNavigationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFB34987294B447F00BC81AD /* InjectedNavigationView.swift */; }; @@ -1163,7 +1162,6 @@ /* Begin PBXFileReference section */ 1701E1B62568983D009453D8 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; - 1701E1E625689D1E009453D8 /* Localized.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Localized.swift; sourceTree = ""; }; 17071EEF26F8137400F5E71D /* ArticleTheme+Notifications.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ArticleTheme+Notifications.swift"; sourceTree = ""; }; 1710B9122552354E00679C0D /* AddAccountHelpView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAccountHelpView.swift; sourceTree = ""; }; 1710B928255246F900679C0D /* EnableExtensionPointHelpView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EnableExtensionPointHelpView.swift; sourceTree = ""; }; @@ -1194,7 +1192,6 @@ 178A9F9C2549449F00AB7E9D /* AddAccountsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAccountsView.swift; sourceTree = ""; }; 179D280C26F73D83003B2E0A /* ArticleThemePlist.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleThemePlist.swift; sourceTree = ""; }; 179DBBA2B22A659F81EED6F9 /* AccountsNewsBlurWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountsNewsBlurWindowController.swift; sourceTree = ""; }; - 17D0682B2564F47E00C0B37E /* Localizable.stringsdict */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; path = Localizable.stringsdict; sourceTree = ""; }; 17D643B026F8A436008D4C05 /* ArticleThemeDownloader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleThemeDownloader.swift; sourceTree = ""; }; 17D7586C2679C21700B17787 /* NetNewsWire-iOS-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NetNewsWire-iOS-Bridging-Header.h"; sourceTree = ""; }; 17E0084525941887000C23F0 /* SizeCategories.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SizeCategories.swift; sourceTree = ""; }; @@ -1638,6 +1635,9 @@ DF84E562295122BA0045C334 /* TimelineCustomizerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineCustomizerView.swift; sourceTree = ""; }; DF93DB2C296A319000586C0E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = ""; }; DF93DB2E296A324100586C0E /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "en-GB"; path = "en-GB.lproj/Localizable.stringsdict"; sourceTree = ""; }; + DF93DB30296A42BD00586C0E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = en; path = en.lproj/Localizable.stringsdict; sourceTree = ""; }; + DF93DB33296A4A8F00586C0E /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-GB"; path = "en-GB.lproj/Localizable.strings"; sourceTree = ""; }; + DF93DB34296A4A9300586C0E /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = "en-GB"; path = "en-GB.lproj/Localizable.stringsdict"; sourceTree = ""; }; DFB34979294A962D00BC81AD /* AddAccountListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddAccountListView.swift; sourceTree = ""; }; DFB3497F294B085100BC81AD /* AccountInspectorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountInspectorView.swift; sourceTree = ""; }; DFB34987294B447F00BC81AD /* InjectedNavigationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InjectedNavigationView.swift; sourceTree = ""; }; @@ -1669,7 +1669,6 @@ DFB616BD29653A0700A359AB /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-GB"; path = "en-GB.lproj/Localizable.strings"; sourceTree = ""; }; DFB616BE29653A0700A359AB /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-GB"; path = "en-GB.lproj/Localizable.strings"; sourceTree = ""; }; DFB616BF29653A0700A359AB /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-GB"; path = "en-GB.lproj/Localizable.strings"; sourceTree = ""; }; - DFB616C029653A0700A359AB /* en-GB */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "en-GB"; path = "en-GB.lproj/Localizable.strings"; sourceTree = ""; }; DFBB4EAB2951BC0200639228 /* NNWThemeDocument.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NNWThemeDocument.swift; sourceTree = ""; }; DFBB4EAF2951BCAC00639228 /* ArticleThemeManagerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArticleThemeManagerView.swift; sourceTree = ""; }; DFC14F0E28EA55BD00F6EE86 /* AboutWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutWindowController.swift; sourceTree = ""; }; @@ -1885,10 +1884,9 @@ 176814792564BE3C00D98635 /* Resources */ = { isa = PBXGroup; children = ( - 1701E1E625689D1E009453D8 /* Localized.swift */, 1768147A2564BE5400D98635 /* widget-sample.json */, 1701E1B72568983D009453D8 /* Localizable.strings */, - 17D0682B2564F47E00C0B37E /* Localizable.stringsdict */, + DF93DB31296A42BD00586C0E /* Localizable.stringsdict */, ); path = Resources; sourceTree = ""; @@ -3075,7 +3073,6 @@ 176813EF2564BB2C00D98635 /* Sources */, 176813F02564BB2C00D98635 /* Frameworks */, 176813F12564BB2C00D98635 /* Resources */, - 1701E1BF25689B44009453D8 /* SwiftGen Localization */, 17EF6A1725C4E59D002C9F81 /* Embed Frameworks */, ); buildRules = ( @@ -3496,7 +3493,7 @@ 176813FC2564BB2D00D98635 /* Assets.xcassets in Resources */, 1701E1B52568983D009453D8 /* Localizable.strings in Resources */, 1768147B2564BE5400D98635 /* widget-sample.json in Resources */, - 17D0682C2564F47E00C0B37E /* Localizable.stringsdict in Resources */, + DF93DB2F296A42BD00586C0E /* Localizable.stringsdict in Resources */, DF6DE5282965971A002EC085 /* InfoPlist.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -3737,24 +3734,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 1701E1BF25689B44009453D8 /* SwiftGen Localization */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "SwiftGen Localization"; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "if ! command -v swiftgen &> /dev/null\nthen\n echo \"swiftgen could not be found\"\n exit\nfi\n\nswiftgen run strings -t structured-swift5 \"$PROJECT_DIR/Widget/Resources/en.lproj/Localizable.strings\" \"$PROJECT_DIR/Widget/Resources/Localizable.stringsdict\" --output \"$PROJECT_DIR/Widget/Resources/Localized.swift\";\n"; - }; 515D50802326D02600EE1167 /* Run Script: Verify No Build Settings */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 8; @@ -3939,7 +3918,6 @@ 1768146C2564BD8100D98635 /* WidgetDeepLinks.swift in Sources */, 1768143E2564BCC800D98635 /* TodayWidget.swift in Sources */, 1768142D2564BCA800D98635 /* TimelineProvider.swift in Sources */, - 1701E1E725689D1E009453D8 /* Localized.swift in Sources */, 176814652564BD7F00D98635 /* WidgetData.swift in Sources */, 1768145E2564BD7B00D98635 /* WidgetDataDecoder.swift in Sources */, 176814132564BC8A00D98635 /* WidgetBundle.swift in Sources */, @@ -4698,7 +4676,7 @@ isa = PBXVariantGroup; children = ( 1701E1B62568983D009453D8 /* en */, - DFB616C029653A0700A359AB /* en-GB */, + DF93DB33296A4A8F00586C0E /* en-GB */, ); name = Localizable.strings; sourceTree = ""; @@ -4925,6 +4903,15 @@ name = Localizable.stringsdict; sourceTree = ""; }; + DF93DB31296A42BD00586C0E /* Localizable.stringsdict */ = { + isa = PBXVariantGroup; + children = ( + DF93DB30296A42BD00586C0E /* en */, + DF93DB34296A4A9300586C0E /* en-GB */, + ); + name = Localizable.stringsdict; + sourceTree = ""; + }; DFB616A72965300400A359AB /* Localizable.strings */ = { isa = PBXVariantGroup; children = ( diff --git a/Widget/Resources/Localized.swift b/Widget/Resources/Localized.swift deleted file mode 100644 index f8a05b221..000000000 --- a/Widget/Resources/Localized.swift +++ /dev/null @@ -1,86 +0,0 @@ -// swiftlint:disable all -// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen - -import Foundation - -// swiftlint:disable superfluous_disable_command file_length implicit_return - -// MARK: - Strings - -// 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 { - /// Plural format key: "%#@localized_count@" - internal static func localizedCount(_ p1: Int) -> String { - return L10n.tr("Localizable", "LocalizedCount", p1) - } - /// Your smart feeds, summarized. - internal static let smartFeedSummaryWidgetDescription = L10n.tr("Localizable", "SmartFeedSummary_Widget_Description") - /// Your Smart Feed Summary - internal static let smartFeedSummaryWidgetTitle = L10n.tr("Localizable", "SmartFeedSummary_Widget_Title") - /// Starred - internal static let starred = L10n.tr("Localizable", "Starred") - /// A sneak peek at your starred articles. - internal static let starredWidgetDescription = L10n.tr("Localizable", "Starred_Widget_Description") - /// When you mark articles as Starred, they'll appear here. - internal static let starredWidgetNoItems = L10n.tr("Localizable", "Starred_Widget_NoItems") - /// Starred - internal static let starredWidgetNoItemsTitle = L10n.tr("Localizable", "Starred_Widget_NoItemsTitle") - /// Your Starred Articles - internal static let starredWidgetTitle = L10n.tr("Localizable", "Starred_Widget_Title") - /// Plural format key: "%#@starred_count@" - internal static func starredCount(_ p1: Int) -> String { - return L10n.tr("Localizable", "StarredCount", p1) - } - /// Today - internal static let today = L10n.tr("Localizable", "Today") - /// A sneak peek at recently published unread articles. - internal static let todayWidgetDescription = L10n.tr("Localizable", "Today_Widget_Description") - /// There are no recent unread articles left to read. - internal static let todayWidgetNoItems = L10n.tr("Localizable", "Today_Widget_NoItems") - /// Today - internal static let todayWidgetNoItemsTitle = L10n.tr("Localizable", "Today_Widget_NoItemsTitle") - /// Your Today Articles - internal static let todayWidgetTitle = L10n.tr("Localizable", "Today_Widget_Title") - /// Plural format key: "%#@today_count@" - internal static func todayCount(_ p1: Int) -> String { - return L10n.tr("Localizable", "TodayCount", p1) - } - /// Unread - internal static let unread = L10n.tr("Localizable", "Unread") - /// A sneak peek at your unread articles. - internal static let unreadWidgetDescription = L10n.tr("Localizable", "Unread_Widget_Description") - /// There are no unread articles left to read. - internal static let unreadWidgetNoItems = L10n.tr("Localizable", "Unread_Widget_NoItems") - /// Unread - internal static let unreadWidgetNoItemsTitle = L10n.tr("Localizable", "Unread_Widget_NoItemsTitle") - /// Your Unread Articles - internal static let unreadWidgetTitle = L10n.tr("Localizable", "Unread_Widget_Title") - /// Plural format key: "%#@unread_count@" - internal static func unreadCount(_ p1: Int) -> String { - return L10n.tr("Localizable", "UnreadCount", p1) - } -} -// swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length -// swiftlint:enable nesting type_body_length type_name vertical_whitespace_opening_braces - -// MARK: - Implementation Details - -extension L10n { - private static func tr(_ table: String, _ key: String, _ args: CVarArg...) -> String { - let format = BundleToken.bundle.localizedString(forKey: key, value: nil, table: table) - return String(format: format, locale: Locale.current, arguments: args) - } -} - -// swiftlint:disable convenience_type -private final class BundleToken { - static let bundle: Bundle = { - #if SWIFT_PACKAGE - return Bundle.module - #else - return Bundle(for: BundleToken.self) - #endif - }() -} -// swiftlint:enable convenience_type diff --git a/Widget/Resources/en-GB.lproj/Localizable.strings b/Widget/Resources/en-GB.lproj/Localizable.strings index 3b3d974e6..222640afe 100644 --- a/Widget/Resources/en-GB.lproj/Localizable.strings +++ b/Widget/Resources/en-GB.lproj/Localizable.strings @@ -1,54 +1,51 @@ -/* (No Comment) */ -"SmartFeedSummary_Widget_Description" = "Your smart feeds, summarised."; +/* Starred */ +"label.text.starred" = "Starred"; -/* (No Comment) */ -"SmartFeedSummary_Widget_Title" = "Your Smart Feed Summary"; - -/* (No Comment) */ -"Starred" = "Starred"; - -/* (No Comment) */ -"Starred_Widget_Description" = "A sneak peek at your starred articles."; - -/* (No Comment) */ -"Starred_Widget_NoItems" = "When you mark articles as Starred, they'll appear here."; - -/* Starred Widget */ -"Starred_Widget_NoItemsTitle" = "Starred"; - -/* (No Comment) */ -"Starred_Widget_Title" = "Your Starred Articles"; - -/* (No Comment) */ -"Today" = "Today "; - -/* (No Comment) */ -"Today_Widget_Description" = "A sneak peek at recently published unread articles."; - -/* (No Comment) */ -"Today_Widget_NoItems" = "There are no recent unread articles left to read."; - -/* Today Widget */ -"Today_Widget_NoItemsTitle" = "Today"; - -/* (No Comment) */ -"Today_Widget_Title" = "Your Today Articles"; +/* Today */ +"label.text.today" = "Today"; /* Smart Feed Summary Widget */ -"Unread" = "Unread"; +"label.text.unread" = "Unread"; -/* (No Comment) */ -"Unread_Widget_Description" = "A sneak peek at your unread articles."; +/* Your smart feeds, summarized. */ +"widget.description.smart-feed-summary" = "Your smart feeds, summarised."; -/* (No Comment) */ -"Unread_Widget_NoItems" = "There are no unread articles left to read."; +/* A sneak peek at your starred articles. */ +"widget.description.starred" = "A sneak peek at your starred articles."; -/* Unread Widget */ -"Unread_Widget_NoItemsTitle" = "Unread"; +/* When you mark articles as Starred, they'll appear here. */ +"widget.description.starred-no-items" = "When you mark articles as Starred, they'll appear here."; + +/* A sneak peek at recently published unread articles. */ +"widget.description.today" = "A sneak peek at recently published unread articles."; + +/* There are no recent unread articles left to read. */ +"widget.description.today-no-items" = "There are no recent unread articles left to read."; + +/* A sneak peek at your unread articles. */ +"widget.description.unread" = "A sneak peek at your unread articles."; + +/* There are no unread articles left to read. */ +"widget.description.unread-no-items" = "There are no unread articles left to read."; + +/* Your Smart Feed Summary */ +"widget.title.smart-feed-summary" = "Your Smart Feed Summary"; + +/* Your Starred Articles */ +"widget.title.starred" = "Your Starred Articles"; + +/* Starred Widget */ +"widget.title.starred-no-items" = "Starred"; + +/* Your Today Articles */ +"widget.title.today" = "Your Today Articles"; + +/* Today Widget */ +"widget.title.today-no-items" = "Today"; /* Bundle */ -"Unread_Widget_Title" = "Your Unread Articles"; +"widget.title.unread" = "Your Unread Articles"; -/* No comment provided by engineer. */ -"Untitled" = "Untitled"; +/* Unread Widget */ +"widget.title.unread-no-items" = "Unread"; diff --git a/Widget/Resources/Localizable.stringsdict b/Widget/Resources/en-GB.lproj/Localizable.stringsdict similarity index 66% rename from Widget/Resources/Localizable.stringsdict rename to Widget/Resources/en-GB.lproj/Localizable.stringsdict index 59c3ad26e..a4e956d25 100644 --- a/Widget/Resources/Localizable.stringsdict +++ b/Widget/Resources/en-GB.lproj/Localizable.stringsdict @@ -2,25 +2,7 @@ - UnreadCount - - NSStringLocalizedFormatKey - %#@unread_count@ - unread_count - - NSStringFormatSpecTypeKey - NSStringPluralRuleType - NSStringFormatValueTypeKey - u - zero - No more unread articles - one - + 1 more unread article - other - + %u more unread articles - - - StarredCount + starred.count.%lld NSStringLocalizedFormatKey %#@starred_count@ @@ -29,47 +11,49 @@ NSStringFormatSpecTypeKey NSStringPluralRuleType NSStringFormatValueTypeKey - u - zero - No more starred articles + lld one + 1 more starred article other - + %u more starred articles + + %lld more starred articles + zero + No more starred articles - TodayCount + today.count.%lld NSStringLocalizedFormatKey %#@today_count@ - today_count + today.count NSStringFormatSpecTypeKey NSStringPluralRuleType NSStringFormatValueTypeKey - u - zero - No more recent articles + lld one + 1 more recent unread article other - + %u more recent unread articles + + %lld more recent unread articles + zero + No more recent articles - LocalizedCount + unread.count.%lld NSStringLocalizedFormatKey - %#@localized_count@ - localized_count + %#@unread_count@ + unread_count NSStringFormatSpecTypeKey NSStringPluralRuleType NSStringFormatValueTypeKey - u - zero - 0 + lld + one + + 1 more unread article other - %u + + %lld more unread articles + zero + No more unread articles diff --git a/Widget/Resources/en.lproj/Localizable.strings b/Widget/Resources/en.lproj/Localizable.strings index fed487392..d78aa49d5 100644 --- a/Widget/Resources/en.lproj/Localizable.strings +++ b/Widget/Resources/en.lproj/Localizable.strings @@ -7,31 +7,31 @@ */ /* Bundle */ -"Unread_Widget_Title" = "Your Unread Articles"; -"Unread_Widget_Description" = "A sneak peek at your unread articles."; +"widget.title.unread" = "Your Unread Articles"; +"widget.description.unread" = "A sneak peek at your unread articles."; -"Today_Widget_Title" = "Your Today Articles"; -"Today_Widget_Description" = "A sneak peek at recently published unread articles."; +"widget.title.today" = "Your Today Articles"; +"widget.description.today" = "A sneak peek at recently published unread articles."; -"Starred_Widget_Title" = "Your Starred Articles"; -"Starred_Widget_Description" = "A sneak peek at your starred articles."; +"widget.title.starred" = "Your Starred Articles"; +"widget.description.starred" = "A sneak peek at your starred articles."; -"SmartFeedSummary_Widget_Title" = "Your Smart Feed Summary"; -"SmartFeedSummary_Widget_Description" = "Your smart feeds, summarized."; +"widget.title.smart-feed-summary" = "Your Smart Feed Summary"; +"widget.description.smart-feed-summary" = "Your smart feeds, summarized."; /* Unread Widget */ -"Unread_Widget_NoItemsTitle" = "Unread"; -"Unread_Widget_NoItems" = "There are no unread articles left to read."; +"widget.title.unread-no-items" = "Unread"; +"widget.description.unread-no-items" = "There are no unread articles left to read."; /* Today Widget */ -"Today_Widget_NoItemsTitle" = "Today"; -"Today_Widget_NoItems" = "There are no recent unread articles left to read."; +"widget.title.today-no-items" = "Today"; +"widget.description.today-no-items" = "There are no recent unread articles left to read."; /* Starred Widget */ -"Starred_Widget_NoItemsTitle" = "Starred"; -"Starred_Widget_NoItems" = "When you mark articles as Starred, they'll appear here."; +"widget.title.starred-no-items" = "Starred"; +"widget.description.starred-no-items" = "When you mark articles as Starred, they'll appear here."; /* Smart Feed Summary Widget */ -"Unread" = "Unread"; -"Today" = "Today "; -"Starred" = "Starred"; +"label.text.unread" = "Unread"; +"label.text.today" = "Today"; +"label.text.starred" = "Starred"; diff --git a/Widget/Resources/en.lproj/Localizable.stringsdict b/Widget/Resources/en.lproj/Localizable.stringsdict new file mode 100644 index 000000000..06dad2aeb --- /dev/null +++ b/Widget/Resources/en.lproj/Localizable.stringsdict @@ -0,0 +1,60 @@ + + + + + unread.count.%lld + + NSStringLocalizedFormatKey + %#@unread_count@ + unread_count + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + lld + zero + No more unread articles + one + + 1 more unread article + other + + %lld more unread articles + + + starred.count.%lld + + NSStringLocalizedFormatKey + %#@starred_count@ + starred_count + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + lld + zero + No more starred articles + one + + 1 more starred article + other + + %lld more starred articles + + + today.count.%lld + + NSStringLocalizedFormatKey + %#@today_count@ + today.count + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + lld + zero + No more recent articles + one + + 1 more recent unread article + other + + %lld more recent unread articles + + + + diff --git a/Widget/Shared Views/ArticleItemView.swift b/Widget/Shared Views/ArticleItemView.swift index 87c06bea9..f7a11a22d 100644 --- a/Widget/Shared Views/ArticleItemView.swift +++ b/Widget/Shared Views/ArticleItemView.swift @@ -11,8 +11,6 @@ import RSWeb struct ArticleItemView: View { - - var article: LatestArticle var deepLink: URL @State private var iconImage: Image? @@ -30,7 +28,7 @@ struct ArticleItemView: View { // Title and Feed Name VStack(alignment: .leading) { - Text(article.articleTitle ?? "Untitled") + Text(verbatim: article.articleTitle ?? "Untitled") .font(.footnote) .bold() .lineLimit(1) @@ -38,12 +36,12 @@ struct ArticleItemView: View { .padding(.top, -3) HStack { - Text(article.feedTitle) + Text(verbatim: article.feedTitle) .font(.caption) .lineLimit(1) .foregroundColor(.secondary) Spacer() - Text(pubDate(article.pubDate)) + Text(verbatim: pubDate(article.pubDate)) .font(.caption) .lineLimit(1) .foregroundColor(.secondary) diff --git a/Widget/Widget Views/SmartFeedSummaryWidget.swift b/Widget/Widget Views/SmartFeedSummaryWidget.swift index b2cd3da6b..7e1acfa17 100644 --- a/Widget/Widget Views/SmartFeedSummaryWidget.swift +++ b/Widget/Widget Views/SmartFeedSummaryWidget.swift @@ -26,7 +26,7 @@ struct SmartFeedSummaryWidgetView: View { VStack(alignment: .leading, spacing: 2) { HStack { todayImage - Text(L10n.today).bold().font(.body) + Text("label.text.today", comment: "Today").bold().font(.body) Spacer() Text(formattedCount(entry.widgetData.currentTodayCount)).bold() @@ -34,14 +34,14 @@ struct SmartFeedSummaryWidgetView: View { HStack { unreadImage - Text(L10n.unread).bold().font(.body) + Text("label.text.unread", comment: "Unread").bold().font(.body) Spacer() Text(formattedCount(entry.widgetData.currentUnreadCount)).bold() } HStack { starredImage - Text(L10n.starred).bold().font(.body) + Text("label.text.starred", comment: "Starred").bold().font(.body) Spacer() Text(formattedCount(entry.widgetData.currentStarredCount)).bold() } diff --git a/Widget/Widget Views/StarredWidget.swift b/Widget/Widget Views/StarredWidget.swift index 6667e29f1..52b03b7f6 100644 --- a/Widget/Widget Views/StarredWidget.swift +++ b/Widget/Widget Views/StarredWidget.swift @@ -37,7 +37,7 @@ struct StarredWidgetView : View { Spacer() VStack(alignment:.leading, spacing: 0) { - ForEach(0.. 0 { - Text(L10n.starredCount(entry.widgetData.currentStarredCount - maxCount())) + Text(String(format: NSLocalizedString("starred.count.%lld", comment: "Number of starred articles beyond what are currently displayed in the widget."), locale: .current, starredCount())) .font(.caption2) .bold() .foregroundColor(.secondary) @@ -97,6 +97,10 @@ struct StarredWidgetView : View { return entry.widgetData.currentStarredCount >= 3 ? (3 - reduceAccessibilityCount) : entry.widgetData.currentStarredCount } + func starredCount() -> Int { + entry.widgetData.currentStarredCount - maxCount() + } + var inboxZero: some View { VStack(alignment: .center) { Spacer() @@ -107,11 +111,11 @@ struct StarredWidgetView : View { .foregroundColor(.yellow) - Text(L10n.starredWidgetNoItemsTitle) + Text("widget.title.starred-no-items", comment: "Starred") .font(.headline) .foregroundColor(.primary) - Text(L10n.starredWidgetNoItems) + Text("widget.description.starred-no-items", comment: "When you mark articles as Starred, they'll appear here.") .font(.caption) .foregroundColor(.gray) Spacer() diff --git a/Widget/Widget Views/TodayWidget.swift b/Widget/Widget Views/TodayWidget.swift index 01791d6d8..5eaa24f0f 100644 --- a/Widget/Widget Views/TodayWidget.swift +++ b/Widget/Widget Views/TodayWidget.swift @@ -37,7 +37,7 @@ struct TodayWidgetView : View { Spacer() VStack(alignment:.leading, spacing: 0) { - ForEach(0.. 0 { - Text(L10n.todayCount(entry.widgetData.currentTodayCount - maxCount())) + Text(String(format: NSLocalizedString("today.count.%lld", comment: "Number of today articles beyond what are currently displayed in the widget."), locale: .current, todayCount())) .font(.caption2) .bold() .foregroundColor(.secondary) + + } } } @@ -84,6 +86,10 @@ struct TodayWidgetView : View { .foregroundColor(.orange) } + func todayCount() -> Int { + entry.widgetData.currentTodayCount - maxCount() + } + func maxCount() -> Int { var reduceAccessibilityCount: Int = 0 if SizeCategories().isSizeCategoryLarge(category: sizeCategory) { @@ -106,11 +112,11 @@ struct TodayWidgetView : View { .foregroundColor(.orange) - Text(L10n.todayWidgetNoItemsTitle) + Text("widget.title.today-no-items", comment: "Today") .font(.headline) .foregroundColor(.primary) - Text(L10n.todayWidgetNoItems) + Text("widget.description.today-no-items", comment: "There are no recent unread articles left to read.") .font(.caption) .foregroundColor(.gray) Spacer() diff --git a/Widget/Widget Views/UnreadWidget.swift b/Widget/Widget Views/UnreadWidget.swift index fe3b1da46..c94859ff2 100644 --- a/Widget/Widget Views/UnreadWidget.swift +++ b/Widget/Widget Views/UnreadWidget.swift @@ -37,7 +37,7 @@ struct UnreadWidgetView : View { Spacer() VStack(alignment:.leading, spacing: 0) { - ForEach(0.. 0 { - Text(L10n.unreadCount(entry.widgetData.currentUnreadCount - maxCount())) + Text(String(format: NSLocalizedString("unread.count.%lld", comment: "Number of unread articles beyond what are currently displayed in the widget."), locale: .current, unreadCount())) .font(.caption2) .bold() .foregroundColor(.secondary) @@ -95,6 +95,10 @@ struct UnreadWidgetView : View { return entry.widgetData.unreadArticles.count >= 3 ? (3 - reduceAccessibilityCount) : entry.widgetData.unreadArticles.count } + func unreadCount() -> Int { + entry.widgetData.currentUnreadCount - maxCount() + } + var inboxZero: some View { VStack(alignment: .center) { Spacer() @@ -104,11 +108,11 @@ struct UnreadWidgetView : View { .foregroundColor(.accentColor) .frame(width: 30) - Text(L10n.unreadWidgetNoItemsTitle) + Text("widget.title.unread-no-items", comment: "Unread") .font(.headline) .foregroundColor(.primary) - Text(L10n.unreadWidgetNoItems) + Text("widget.description.unread-no-items", comment: "There are no unread articles left to read.") .font(.caption) .foregroundColor(.gray) Spacer() diff --git a/Widget/WidgetBundle.swift b/Widget/WidgetBundle.swift index 6a4907ad9..5e6ec0c95 100644 --- a/Widget/WidgetBundle.swift +++ b/Widget/WidgetBundle.swift @@ -22,8 +22,8 @@ struct UnreadWidget: Widget { .background(Color("WidgetBackground")) }) - .configurationDisplayName(L10n.unreadWidgetTitle) - .description(L10n.unreadWidgetDescription) + .configurationDisplayName(Text("widget.title.unread", comment: "Your Unread Articles")) + .description(Text("widget.description.unread", comment: "A sneak peek at your unread articles.")) .supportedFamilies([.systemMedium, .systemLarge]) } @@ -40,8 +40,8 @@ struct TodayWidget: Widget { .background(Color("WidgetBackground")) }) - .configurationDisplayName(L10n.todayWidgetTitle) - .description(L10n.todayWidgetDescription) + .configurationDisplayName(Text("widget.title.today", comment: "Your Today Articles")) + .description(Text("widget.description.today", comment: "A sneak peek at recently published unread articles.")) .supportedFamilies([.systemMedium, .systemLarge]) } @@ -58,8 +58,8 @@ struct StarredWidget: Widget { .background(Color("WidgetBackground")) }) - .configurationDisplayName(L10n.starredWidgetTitle) - .description(L10n.starredWidgetDescription) + .configurationDisplayName(Text("widget.title.starred", comment: "Your Starred Articles")) + .description(Text("widget.description.starred", comment: "A sneak peek at your starred articles.")) .supportedFamilies([.systemMedium, .systemLarge]) } @@ -75,8 +75,8 @@ struct SmartFeedSummaryWidget: Widget { return StaticConfiguration(kind: kind, provider: Provider(), content: { entry in SmartFeedSummaryWidgetView(entry: entry) }) - .configurationDisplayName(L10n.smartFeedSummaryWidgetTitle) - .description(L10n.smartFeedSummaryWidgetDescription) + .configurationDisplayName(Text("widget.title.smart-feed-summary", comment: "Your Smart Feed Summary")) + .description(Text("widget.description.smart-feed-summary", comment: "Your smart feeds, summarized.")) .supportedFamilies([.accessoryRectangular]) } }