Skip to content

Commit

Permalink
Mark remaining Sync strings as localizable (#2329)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ayoy authored Jan 11, 2024
1 parent eaafe0b commit 5f8b88c
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 15 deletions.
5 changes: 3 additions & 2 deletions DuckDuckGo/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Core
import BrowserServicesKit
import Persistence
import SwiftUI
import SyncUI
import Common
import DDGSync
import Combine
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/SyncSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class SyncSettingsViewController: UIHostingController<SyncSettingsView> {
.store(in: &cancellables)

rootView.model.delegate = self
navigationItem.title = UserText.syncTitle
navigationItem.title = SyncUI.UserText.syncTitle
}

@MainActor required dynamic init?(coder aDecoder: NSCoder) {
Expand Down
19 changes: 9 additions & 10 deletions DuckDuckGo/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
27 changes: 27 additions & 0 deletions DuckDuckGo/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -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.";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5f8b88c

Please sign in to comment.