diff --git a/Widget/Resources/Localizable.stringsdict b/Widget/Resources/Localizable.stringsdict index 367e1afb7..59c3ad26e 100644 --- a/Widget/Resources/Localizable.stringsdict +++ b/Widget/Resources/Localizable.stringsdict @@ -56,5 +56,21 @@ + %u more recent unread articles + LocalizedCount + + NSStringLocalizedFormatKey + %#@localized_count@ + localized_count + + NSStringFormatSpecTypeKey + NSStringPluralRuleType + NSStringFormatValueTypeKey + u + zero + 0 + other + %u + + diff --git a/Widget/Resources/Localized.swift b/Widget/Resources/Localized.swift index 5124e6ab9..6590ab301 100644 --- a/Widget/Resources/Localized.swift +++ b/Widget/Resources/Localized.swift @@ -10,6 +10,10 @@ 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 { + /// 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 diff --git a/Widget/Shared Views/ArticleItemView.swift b/Widget/Shared Views/ArticleItemView.swift index 929ff96e6..25060828e 100644 --- a/Widget/Shared Views/ArticleItemView.swift +++ b/Widget/Shared Views/ArticleItemView.swift @@ -44,7 +44,7 @@ struct ArticleItemView: View { } } }) - }).padding(.bottom, 4) + }) } func thumbnail(_ data: Data?) -> UIImage { diff --git a/Widget/Widget Views/StarredWidget.swift b/Widget/Widget Views/StarredWidget.swift index ab97ee4f6..3136e2f40 100644 --- a/Widget/Widget Views/StarredWidget.swift +++ b/Widget/Widget Views/StarredWidget.swift @@ -20,28 +20,36 @@ struct StarredWidgetView : View { inboxZero } else { - VStack(alignment: .leading) { - HStack(alignment: .top, spacing: 8) { - VStack { + GeometryReader { metrics in + HStack(alignment: .top, spacing: 4) { + VStack(alignment: .leading) { starredImage Spacer() - nnwImage + Text(L10n.localizedCount(entry.widgetData.currentStarredCount)).bold().font(Font.system(.footnote, design: .rounded)) + Text(L10n.starred.lowercased()).bold().font(Font.system(.footnote).lowercaseSmallCaps()).minimumScaleFactor(0.5).lineLimit(1) } - VStack(alignment:.leading, spacing: 2) { + .frame(width: metrics.size.width * 0.15) + .padding(.trailing, 4) + + Divider() + + VStack(alignment:.leading, spacing: 0) { ForEach(0.. Int { if family == .systemLarge { return entry.widgetData.currentStarredCount > 8 ? 8 : entry.widgetData.currentStarredCount diff --git a/Widget/Widget Views/TodayWidget.swift b/Widget/Widget Views/TodayWidget.swift index 80ddf0c80..6a5551116 100644 --- a/Widget/Widget Views/TodayWidget.swift +++ b/Widget/Widget Views/TodayWidget.swift @@ -20,29 +20,36 @@ struct TodayWidgetView : View { inboxZero } else { - VStack(alignment: .leading) { - HStack(alignment: .top, spacing: 8) { - VStack { + GeometryReader { metrics in + HStack(alignment: .top, spacing: 4) { + VStack(alignment: .leading) { todayImage Spacer() - nnwImage + Text(L10n.localizedCount(entry.widgetData.currentTodayCount)).bold().font(Font.system(.footnote, design: .rounded)) + Text(L10n.today.lowercased()).bold().font(Font.system(.footnote).lowercaseSmallCaps()).minimumScaleFactor(0.5).lineLimit(1) } - VStack(alignment:.leading, spacing: 2) { + .frame(width: metrics.size.width * 0.15) + .padding(.trailing, 4) + + Divider() + + VStack(alignment:.leading, spacing: 0) { ForEach(0.. Int { if family == .systemLarge { return entry.widgetData.todayArticles.count > 8 ? 8 : entry.widgetData.todayArticles.count diff --git a/Widget/Widget Views/UnreadWidget.swift b/Widget/Widget Views/UnreadWidget.swift index dbe12ebd9..83ca3664b 100644 --- a/Widget/Widget Views/UnreadWidget.swift +++ b/Widget/Widget Views/UnreadWidget.swift @@ -20,28 +20,36 @@ struct UnreadWidgetView : View { inboxZero } else { - VStack(alignment: .leading) { - HStack(alignment: .top, spacing: 8) { - VStack { + GeometryReader { metrics in + HStack(alignment: .top, spacing: 4) { + VStack(alignment: .leading) { unreadImage Spacer() - nnwImage + Text(L10n.localizedCount(entry.widgetData.currentUnreadCount)).bold().font(Font.system(.footnote, design: .rounded)) + Text(L10n.unread.lowercased()).bold().font(Font.system(.footnote).lowercaseSmallCaps()).minimumScaleFactor(0.5).lineLimit(1) } - VStack(alignment:.leading, spacing: 2) { + .frame(width: metrics.size.width * 0.15) + .padding(.trailing, 4) + + Divider() + + VStack(alignment:.leading, spacing: 0) { ForEach(0.. Int { if family == .systemLarge { return entry.widgetData.unreadArticles.count > 8 ? 8 : entry.widgetData.unreadArticles.count