From 5f8b88cb2c4bd46767c648d660901fb1e2d9bf89 Mon Sep 17 00:00:00 2001 From: Dominik Kapusta Date: Thu, 11 Jan 2024 17:05:48 +0100 Subject: [PATCH] Mark remaining Sync strings as localizable (#2329) Task/Issue URL: https://app.asana.com/0/1201493110486074/1206326734532644/f Description: Reusing Sync Settings cell title from SyncUI package, and marking other strings as localizable. --- DuckDuckGo/SettingsViewController.swift | 5 ++-- DuckDuckGo/SyncSettingsViewController.swift | 2 +- DuckDuckGo/UserText.swift | 19 +++++++------ DuckDuckGo/en.lproj/Localizable.strings | 27 +++++++++++++++++++ .../SyncUI/Views/Internal/UserText.swift | 4 +-- 5 files changed, 42 insertions(+), 15 deletions(-) diff --git a/DuckDuckGo/SettingsViewController.swift b/DuckDuckGo/SettingsViewController.swift index be726a9d4b..9dbceb020f 100644 --- a/DuckDuckGo/SettingsViewController.swift +++ b/DuckDuckGo/SettingsViewController.swift @@ -22,6 +22,7 @@ import Core import BrowserServicesKit import Persistence import SwiftUI +import SyncUI import Common import DDGSync import Combine @@ -259,10 +260,10 @@ class SettingsViewController: UITableViewController { } private func configureSyncCell() { - syncCell.textLabel?.text = "Sync & Backup" + syncCell.textLabel?.text = SyncUI.UserText.syncTitle let isDataSyncingDisabled = !syncService.featureFlags.contains(.dataSyncing) && syncService.authState == .active if SyncBookmarksAdapter.isSyncBookmarksPaused || SyncCredentialsAdapter.isSyncCredentialsPaused || isDataSyncingDisabled { - syncCell.textLabel?.text = "⚠️ " + "Sync & Backup" + syncCell.textLabel?.text = "⚠️ " + SyncUI.UserText.syncTitle } syncCell.isHidden = !shouldShowSyncCell } diff --git a/DuckDuckGo/SyncSettingsViewController.swift b/DuckDuckGo/SyncSettingsViewController.swift index 86cb9f8b95..d74642813e 100644 --- a/DuckDuckGo/SyncSettingsViewController.swift +++ b/DuckDuckGo/SyncSettingsViewController.swift @@ -81,7 +81,7 @@ class SyncSettingsViewController: UIHostingController { .store(in: &cancellables) rootView.model.delegate = self - navigationItem.title = UserText.syncTitle + navigationItem.title = SyncUI.UserText.syncTitle } @MainActor required dynamic init?(coder aDecoder: NSCoder) { diff --git a/DuckDuckGo/UserText.swift b/DuckDuckGo/UserText.swift index 579eb3b1e6..8c7ff2b022 100644 --- a/DuckDuckGo/UserText.swift +++ b/DuckDuckGo/UserText.swift @@ -836,20 +836,19 @@ But if you *do* want a peek under the hood, you can find more information about // MARK: Sync - public static let syncTurnOffConfirmTitle = "Turn Off Sync?" - public static let syncTurnOffConfirmMessage = "This Device will no longer be able to access your synced data." - public static let syncTurnOffConfirmAction = "Remove" - public static let syncDeleteAllConfirmTitle = "Delete Server Data?" - public static let syncDeleteAllConfirmMessage = "All devices will be disconnected and your synced data will be deleted from the server." - public static let syncDeleteAllConfirmAction = "Delete Server Data" - public static let syncRemoveDeviceTitle = "Remove Device?" + public static let syncTurnOffConfirmTitle = NSLocalizedString("sync.turn.off.confirm.title", value:"Turn Off Sync?", comment: "Title of the dialog to confirm turning off Sync") + public static let syncTurnOffConfirmMessage = NSLocalizedString("sync.turn.off.confirm.message", value:"This Device will no longer be able to access your synced data.", comment: "Message for the dialog to confirm turning off Sync") + public static let syncTurnOffConfirmAction = NSLocalizedString("sync.turn.off.confirm.action", value:"Remove", comment: "Caption for a button to remove current device from Sync") + public static let syncDeleteAllConfirmTitle = NSLocalizedString("sync.delete.all.confirm.title", value:"Delete Server Data?", comment: "Title of the dialog to confirm deleting Sync server data") + public static let syncDeleteAllConfirmMessage = NSLocalizedString("sync.delete.all.confirm.message", value:"All devices will be disconnected and your synced data will be deleted from the server.", comment: "Message for the dialog to confirm deleting Sync server data") + public static let syncDeleteAllConfirmAction = NSLocalizedString("sync.delete.all.confirm.action", value:"Delete Server Data", comment: "Caption for a button to delete Sync server data") + public static let syncRemoveDeviceTitle = NSLocalizedString("sync.remove-device.title", value:"Remove Device?", comment: "Title of the dialog to remove device from Sync") public static func syncRemoveDeviceMessage(_ deviceName: String) -> String { let message = NSLocalizedString("sync.remove-device.message", value: "\"%@\" will no longer be able to access your synced data.", comment: "") return message.format(arguments: deviceName) } - public static let syncRemoveDeviceConfirmAction = "Remove" - public static let syncCodeCopied = "Recovery Code copied" - public static let syncTitle = "Sync & Backup" + public static let syncRemoveDeviceConfirmAction = NSLocalizedString("sync.remove-device.action", value:"Remove", comment: "Caption for a button to remove device from Sync") + public static let syncCodeCopied = NSLocalizedString("sync.code.copied", value:"Recovery code copied to clipboard", comment: "Message confirming that recovery code was copied to clipboard") // MARK: Errors diff --git a/DuckDuckGo/en.lproj/Localizable.strings b/DuckDuckGo/en.lproj/Localizable.strings index 7904d15ae1..22bea7ac52 100644 --- a/DuckDuckGo/en.lproj/Localizable.strings +++ b/DuckDuckGo/en.lproj/Localizable.strings @@ -1774,9 +1774,36 @@ But if you *do* want a peek under the hood, you can find more information about /* No comment provided by engineer. */ "siteFeedback.urlPlaceholder" = "Which website is broken?"; +/* Message confirming that recovery code was copied to clipboard */ +"sync.code.copied" = "Recovery Code copied"; + +/* Caption for a button to delete Sync server data */ +"sync.delete.all.confirm.action" = "Delete Server Data"; + +/* Message for the dialog to confirm deleting Sync server data */ +"sync.delete.all.confirm.message" = "All devices will be disconnected and your synced data will be deleted from the server."; + +/* Title of the dialog to confirm deleting Sync server data */ +"sync.delete.all.confirm.title" = "Delete Server Data?"; + +/* Caption for a button to remove device from Sync */ +"sync.remove-device.action" = "Remove"; + /* No comment provided by engineer. */ "sync.remove-device.message" = "\"%@\" will no longer be able to access your synced data."; +/* Title of the dialog to remove device from Sync */ +"sync.remove-device.title" = "Remove Device?"; + +/* Caption for a button to remove current device from Sync */ +"sync.turn.off.confirm.action" = "Remove"; + +/* Message for the dialog to confirm turning off Sync */ +"sync.turn.off.confirm.message" = "This Device will no longer be able to access your synced data."; + +/* Title of the dialog to confirm turning off Sync */ +"sync.turn.off.confirm.title" = "Turn Off Sync?"; + /* Data syncing unavailable warning message */ "sync.warning.data.syncing.disabled" = "Sorry, but Sync & Backup is currently unavailable. Please try again later."; diff --git a/LocalPackages/SyncUI/Sources/SyncUI/Views/Internal/UserText.swift b/LocalPackages/SyncUI/Sources/SyncUI/Views/Internal/UserText.swift index 250e1b5eb9..8de7361c7c 100644 --- a/LocalPackages/SyncUI/Sources/SyncUI/Views/Internal/UserText.swift +++ b/LocalPackages/SyncUI/Sources/SyncUI/Views/Internal/UserText.swift @@ -21,10 +21,10 @@ import Foundation // swiftlint:disable line_length // Localise these later, when feature is closer to exernal release -struct UserText { +public struct UserText { // Sync Title - static let syncTitle = NSLocalizedString("sync.title", bundle: Bundle.module, value: "Sync & Backup", comment: "Sync & Backup Title") + public static let syncTitle = NSLocalizedString("sync.title", bundle: Bundle.module, value: "Sync & Backup", comment: "Sync & Backup Title") static let syncRollOutBannerDescription = NSLocalizedString("preferences.sync.rollout-banner.description", bundle: Bundle.module, value: "Sync & Backup is rolling out gradually and may not be available yet within DuckDuckGo on your other devices.", comment: "Description of rollout banner") // Sync Set Up