From 402d76adbe3339a3c0a3bc00e0ffbe92a6161786 Mon Sep 17 00:00:00 2001 From: kean Date: Tue, 5 Nov 2024 18:30:55 -0500 Subject: [PATCH] Fix Reader localization --- WordPress/Classes/Utility/SharedStrings.swift | 2 ++ .../Reader/Controllers/ReaderStreamViewController.swift | 4 ++-- .../Reader/Sidebar/ReaderSidebarViewController.swift | 2 +- .../ViewRelated/System/Sidebar/SidebarViewController.swift | 2 +- .../Classes/ViewRelated/System/WPTabBarController+Swift.swift | 4 ++++ WordPress/Classes/ViewRelated/System/WPTabBarController.m | 4 ++-- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/WordPress/Classes/Utility/SharedStrings.swift b/WordPress/Classes/Utility/SharedStrings.swift index 0aef5e1b3ae4..628c684947b1 100644 --- a/WordPress/Classes/Utility/SharedStrings.swift +++ b/WordPress/Classes/Utility/SharedStrings.swift @@ -26,6 +26,8 @@ enum SharedStrings { } enum Reader { + /// - warning: This is the legacy value. It's not compliant with the new format but has the correct translation for different languages. + static let title = NSLocalizedString("Reader", comment: "The accessibility value of the Reader tab.") static let unfollow = NSLocalizedString("reader.button.unfollow", value: "Unfollow", comment: "Reader sidebar button title") static let recent = NSLocalizedString("reader.recent.title", value: "Recent", comment: "Used in multiple contexts, usually as a screen title") static let discover = NSLocalizedString("reader.discover.title", value: "Discover", comment: "Used in multiple contexts, usually as a screen title") diff --git a/WordPress/Classes/ViewRelated/Reader/Controllers/ReaderStreamViewController.swift b/WordPress/Classes/ViewRelated/Reader/Controllers/ReaderStreamViewController.swift index 1246e28c9ac5..d9a429b36199 100644 --- a/WordPress/Classes/ViewRelated/Reader/Controllers/ReaderStreamViewController.swift +++ b/WordPress/Classes/ViewRelated/Reader/Controllers/ReaderStreamViewController.swift @@ -550,7 +550,7 @@ import AutomatticTracks if contentType == .saved { title = SharedStrings.Reader.saved } else { - title = NSLocalizedString("Reader", comment: "The default title of the Reader") + title = SharedStrings.Reader.title } return } @@ -1543,7 +1543,7 @@ extension ReaderStreamViewController: SearchableActivityConvertable { } var activityTitle: String { - return NSLocalizedString("Reader", comment: "Title of the 'Reader' tab - used for spotlight indexing on iOS.") + return SharedStrings.Reader.title } var activityKeywords: Set? { diff --git a/WordPress/Classes/ViewRelated/Reader/Sidebar/ReaderSidebarViewController.swift b/WordPress/Classes/ViewRelated/Reader/Sidebar/ReaderSidebarViewController.swift index f67e7ab00e7c..ac5ceaab480e 100644 --- a/WordPress/Classes/ViewRelated/Reader/Sidebar/ReaderSidebarViewController.swift +++ b/WordPress/Classes/ViewRelated/Reader/Sidebar/ReaderSidebarViewController.swift @@ -205,7 +205,7 @@ private extension View { } private struct Strings { - static let reader = NSLocalizedString("reader.sidebar.navigationTitle", value: "Reader", comment: "Reader sidebar title") + static let reader = SharedStrings.Reader.title static let subscriptions = NSLocalizedString("reader.sidebar.section.subscriptions.title", value: "Subscriptions", comment: "Reader sidebar section title") static let lists = NSLocalizedString("reader.sidebar.section.lists.title", value: "Lists", comment: "Reader sidebar section title") static let tags = NSLocalizedString("reader.sidebar.section.tags.title", value: "Tags", comment: "Reader sidebar section title") diff --git a/WordPress/Classes/ViewRelated/System/Sidebar/SidebarViewController.swift b/WordPress/Classes/ViewRelated/System/Sidebar/SidebarViewController.swift index a2d03ab03dab..a2c71dd4ac9a 100644 --- a/WordPress/Classes/ViewRelated/System/Sidebar/SidebarViewController.swift +++ b/WordPress/Classes/ViewRelated/System/Sidebar/SidebarViewController.swift @@ -257,7 +257,7 @@ private enum Strings { static let addSite = NSLocalizedString("sidebar.addSite", value: "Add Site", comment: "Sidebar button title on iPad") static let createSite = NSLocalizedString("sidebar.createSite", value: "Create Site", comment: "Sidebar button title on iPad") static let notifications = NSLocalizedString("sidebar.notifications", value: "Notifications", comment: "Sidebar item on iPad") - static let reader = NSLocalizedString("sidebar.reader", value: "Reader", comment: "Sidebar item on iPad") + static let reader = SharedStrings.Reader.title static let domains = NSLocalizedString("sidebar.domains", value: "Domains", comment: "Sidebar item on iPad") static let help = NSLocalizedString("sidebar.help", value: "Help & Support", comment: "Sidebar item on iPad") static let me = NSLocalizedString("sidebar.me", value: "Me", comment: "Sidebar item on iPad") diff --git a/WordPress/Classes/ViewRelated/System/WPTabBarController+Swift.swift b/WordPress/Classes/ViewRelated/System/WPTabBarController+Swift.swift index 01cebc18fad6..e51ff96f6eae 100644 --- a/WordPress/Classes/ViewRelated/System/WPTabBarController+Swift.swift +++ b/WordPress/Classes/ViewRelated/System/WPTabBarController+Swift.swift @@ -18,6 +18,10 @@ fileprivate extension WPTab { } extension WPTabBarController { + @objc class func readerLocalizedTitle() -> String { + SharedStrings.Reader.title + } + func showReader(path: ReaderNavigationPath?) { showReaderTab() if let path { diff --git a/WordPress/Classes/ViewRelated/System/WPTabBarController.m b/WordPress/Classes/ViewRelated/System/WPTabBarController.m index e15030e1b758..2db02345694d 100644 --- a/WordPress/Classes/ViewRelated/System/WPTabBarController.m +++ b/WordPress/Classes/ViewRelated/System/WPTabBarController.m @@ -135,7 +135,7 @@ - (UINavigationController *)readerNavigationController _readerNavigationController.tabBarItem.image = [UIImage imageNamed:@"tab-bar-reader"]; _readerNavigationController.tabBarItem.accessibilityIdentifier = @"tabbar_reader"; - _readerNavigationController.tabBarItem.title = NSLocalizedString(@"Reader", @"The accessibility value of the Reader tab."); + _readerNavigationController.tabBarItem.title = [WPTabBarController readerLocalizedTitle]; UITabBarAppearance *scrollEdgeAppearance = [UITabBarAppearance new]; [scrollEdgeAppearance configureWithOpaqueBackground]; @@ -424,7 +424,7 @@ - (BOOL)canBecomeFirstResponder showMySitesTabCommand.discoverabilityTitle = NSLocalizedString(@"My Site", @"The accessibility value of the my site tab."); UIKeyCommand *showReaderTabCommand = [UIKeyCommand keyCommandWithInput:@"2" modifierFlags:UIKeyModifierCommand action:@selector(showReaderTab)]; - showMySitesTabCommand.discoverabilityTitle = NSLocalizedString(@"Reader", @"The accessibility value of the reader tab."); + showMySitesTabCommand.discoverabilityTitle = [WPTabBarController readerLocalizedTitle]; UIKeyCommand *showNotificationsTabCommand = [UIKeyCommand keyCommandWithInput:@"4" modifierFlags:UIKeyModifierCommand action:@selector(showNotificationsTab)]; showMySitesTabCommand.discoverabilityTitle = NSLocalizedString(@"Notifications", @"Notifications tab bar item accessibility label");