Skip to content

Commit

Permalink
Localized some strings
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoreymendez committed Dec 20, 2024
1 parent 47fce05 commit 654699e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
9 changes: 9 additions & 0 deletions DuckDuckGo/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,15 @@ public struct UserText {

public static let addVPNWidgetSettingsThirdParagraph = NSLocalizedString("vpn.addWidget.settings.title", value: "Find and select **DuckDuckGo**, then swipe to **VPN** and select **Add Widget**", comment: "Title for the VPN widget onboarding screen")

// MARK: - VPN Control Widget

public static let vpnControlWidgetEnableVPNIntentTitle = NSLocalizedString("vpn.control-widget.enable.vpn.intent.title", value: "Enable DuckDuckGo VPN", comment: "Title for the intent to enable the DuckDuckGo VPN")
public static let vpnControlWidgetEnableVPNIntentDescription = NSLocalizedString("vpn.control-widget.enable.vpn.intent.description", value: "Enable DuckDuckGo VPN", comment: "Description for the intent to enable the DuckDuckGo VPN")
public static let vpnControlWidgetEnableVPNIntentSuccess = NSLocalizedString("vpn.control-widget.enable.vpn.intent.success", value: "DuckDuckGo VPN is connected", comment: "Message for success when running the intent to enable the DuckDuckGo VPN")
public static let vpnControlWidgetDisableVPNIntentTitle = NSLocalizedString("vpn.control-widget.disable.vpn.intent.title", value: "Disable DuckDuckGo VPN", comment: "Title for the intent to disable the DuckDuckGo VPN")
public static let vpnControlWidgetDisableVPNIntentDescription = NSLocalizedString("vpn.control-widget.disable.vpn.intent.description", value: "Disable DuckDuckGo VPN", comment: "Description for the intent to disable the DuckDuckGo VPN")
public static let vpnControlWidgetDisableVPNIntentSuccess = NSLocalizedString("vpn.control-widget.disable.vpn.intent.success", value: "DuckDuckGo VPN is connected", comment: "Message for success when running the intent to enable the DuckDuckGo VPN")

// MARK: Custom DNS

public static let vpnSettingDNSSectionHeader = NSLocalizedString("vpn.settings.dns.section-header", value: "DNS", comment: "Header text for the DNS section on the VPN Settings screen")
Expand Down
14 changes: 7 additions & 7 deletions DuckDuckGo/VPNShortcutIntents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ struct DisableVPNIntent: AppIntent {
case cancelled
}

static let title: LocalizedStringResource = "Disable DuckDuckGo VPN"
static let description: LocalizedStringResource = "Disables the DuckDuckGo VPN"
static let title = LocalizedStringResource(stringLiteral: UserText.vpnControlWidgetDisableVPNIntentTitle)
static let description = LocalizedStringResource(stringLiteral: UserText.vpnControlWidgetDisableVPNIntentDescription)
static let openAppWhenRun: Bool = false
static let isDiscoverable: Bool = true
static var authenticationPolicy: IntentAuthenticationPolicy = .requiresAuthentication
Expand All @@ -57,10 +57,10 @@ struct DisableVPNIntent: AppIntent {
VPNReloadStatusWidgets()

DailyPixel.fireDailyAndCount(pixel: .vpnShortcutDisconnectSuccess)
return .result(dialog: "DuckDuckGo VPN is disconnecting...")
return .result(dialog: IntentDialog(stringLiteral: UserText.vpnControlWidgetDisableVPNIntentSuccess))
} catch VPNWidgetTunnelController.StopFailure.vpnNotConfigured {
DailyPixel.fireDailyAndCount(pixel: .vpnShortcutDisconnectCancelled)
return .result(dialog: "The DuckDuckGo VPN is not connected")
throw VPNWidgetTunnelController.StopFailure.vpnNotConfigured
} catch {
DailyPixel.fireDailyAndCount(pixel: .vpnShortcutDisconnectFailure, error: error)
throw error
Expand All @@ -76,8 +76,8 @@ struct DisableVPNIntent: AppIntent {
///
@available(iOS 17.0, *)
struct EnableVPNIntent: ForegroundContinuableIntent {
static let title: LocalizedStringResource = "Enable DuckDuckGo VPN"
static let description: LocalizedStringResource = "Enables the DuckDuckGo VPN"
static let title = LocalizedStringResource(stringLiteral: UserText.vpnControlWidgetEnableVPNIntentTitle)
static let description = LocalizedStringResource(stringLiteral: UserText.vpnControlWidgetEnableVPNIntentTitle)
static let openAppWhenRun: Bool = false
static let isDiscoverable: Bool = true
static var authenticationPolicy: IntentAuthenticationPolicy = .alwaysAllowed
Expand All @@ -94,7 +94,7 @@ struct EnableVPNIntent: ForegroundContinuableIntent {
VPNReloadStatusWidgets()

DailyPixel.fireDailyAndCount(pixel: .vpnShortcutConnectSuccess)
return .result(dialog: "DuckDuckGo VPN is connecting...")
return .result(dialog: IntentDialog(stringLiteral: UserText.vpnControlWidgetEnableVPNIntentSuccess))
} catch {
switch error {
case VPNWidgetTunnelController.StartFailure.vpnNotConfigured,
Expand Down
4 changes: 2 additions & 2 deletions Widgets/ControlWidgetVPNIntents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ struct ControlWidgetToggleVPNIntent: SetValueIntent {
}
}

static let title: LocalizedStringResource = "Toggle DuckDuckGo VPN from the Control Center Widget"
static let description: LocalizedStringResource = "Toggles the DuckDuckGo VPN from the Control Center widget"
static let title = LocalizedStringResource(stringLiteral: UserText.vpnControlWidgetToggleIntentTitle)

Check failure on line 44 in Widgets/ControlWidgetVPNIntents.swift

View workflow job for this annotation

GitHub Actions / Unit Tests

`LocalizedStringResource` must be initialized directly with a call to the type's initializer, or a String literal

Check failure on line 44 in Widgets/ControlWidgetVPNIntents.swift

View workflow job for this annotation

GitHub Actions / Make Release Build

`LocalizedStringResource` must be initialized directly with a call to the type's initializer, or a String literal
static let description = LocalizedStringResource(stringLiteral: UserText.vpnControlWidgetToggleIntentDescription)
static let isDiscoverable = false

@Parameter(title: "Enabled")
Expand Down
2 changes: 2 additions & 0 deletions Widgets/UserTextShared.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ import Foundation

extension UserText {
static let vpnNeedsToBeEnabledFromApp = NSLocalizedString("intent.vpn.needs.to.be.enabled.from.app", value: "You need to enable the VPN from the DuckDuckGo App.", comment: "Message that comes up when trying to enable the VPN from intents, asking the user to enable it from the app so it's configured")
static let vpnControlWidgetToggleIntentTitle = NSLocalizedString("intent.vpn.control.widget.toggle.intent.title", value: "Toggle DuckDuckGo VPN from the Control Center Widget", comment: "Title for the control widget toggle intent")
static let vpnControlWidgetToggleIntentDescription = NSLocalizedString("intent.vpn.control.widget.toggle.intent.description", value: "Toggles the DuckDuckGo VPN from the Control Center widget", comment: "Description for the control widget toggle intent")
}

0 comments on commit 654699e

Please sign in to comment.