From 7d63bd5ce4f660004fab6d779ca5d078289e344f Mon Sep 17 00:00:00 2001 From: Terry Yiu Date: Wed, 22 Jan 2025 00:27:57 -0500 Subject: [PATCH] Make NostrClientView toggle strings localizable --- Yeti/Resources/Localizable.xcstrings | 16 +++++------ Yeti/Views/NostrClientView.swift | 43 ++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 16 deletions(-) diff --git a/Yeti/Resources/Localizable.xcstrings b/Yeti/Resources/Localizable.xcstrings index bc3e6d6..7ff95f0 100644 --- a/Yeti/Resources/Localizable.xcstrings +++ b/Yeti/Resources/Localizable.xcstrings @@ -14,25 +14,25 @@ "comment" : "Button to create a key." }, "Decrypt DMs" : { - + "comment" : "Permission toggle to allow Nostr client to decrypt direct messages." }, "Decrypt legacy DMs" : { - + "comment" : "Permission toggle to allow Nostr client to decrypt legacy direct messages." }, "Decrypt zap events" : { - + "comment" : "Permission toggle to allow Nostr client to decrypt zap events." }, "Done" : { "comment" : "Button to go to the next view that adds the user’s entered private key." }, "Encrypt DMs" : { - + "comment" : "Permission toggle to allow Nostr client to encrypt direct messages." }, "Encrypt legacy DMs" : { - + "comment" : "Permission toggle to allow Nostr client to encrypt legacy direct messages." }, "Get relays" : { - + "comment" : "Permission toggle to allow Nostr client to get relays." }, "History" : { "comment" : "Title for History tab" @@ -56,7 +56,7 @@ "comment" : "Title for Permissions tab" }, "Read your profile" : { - + "comment" : "Permission toggle to allow Nostr client to read your profile." }, "Recommended for most people. This policy will minimize the number of interruptions during your app usage." : { "comment" : "Description of event signing policy that approves basic actions." @@ -74,7 +74,7 @@ "comment" : "Prompt asking user which signing policy to use." }, "Sign kind %@ events" : { - + "comment" : "Permission toggle to allow Nostr client to sign events of a specific kind.." }, "Yeti: Nostr Helper" : { "comment" : "Application title." diff --git a/Yeti/Views/NostrClientView.swift b/Yeti/Views/NostrClientView.swift index 6cd5c5f..02c6302 100644 --- a/Yeti/Views/NostrClientView.swift +++ b/Yeti/Views/NostrClientView.swift @@ -29,16 +29,43 @@ struct NostrClientView: View { .font(.headline) List { - Toggle("Read your profile", isOn: bindableNostrClientModel.readPublicKeyPermission) - Toggle("Get relays", isOn: bindableNostrClientModel.getRelaysPermission) - Toggle("Encrypt DMs", isOn: bindableNostrClientModel.nip44EncryptPermission) - Toggle("Decrypt DMs", isOn: bindableNostrClientModel.nip44DecryptPermission) - Toggle("Encrypt legacy DMs", isOn: bindableNostrClientModel.nip04EncryptPermission) - Toggle("Decrypt legacy DMs", isOn: bindableNostrClientModel.nip04DecryptPermission) - Toggle("Decrypt zap events", isOn: bindableNostrClientModel.decryptZapEventPermission) + Toggle( + String(localized: "Read your profile", comment: "Permission toggle to allow Nostr client to read your profile."), + isOn: bindableNostrClientModel.readPublicKeyPermission + ) + Toggle( + String(localized: "Get relays", comment: "Permission toggle to allow Nostr client to get relays."), + isOn: bindableNostrClientModel.getRelaysPermission + ) + Toggle( + String(localized: "Encrypt DMs", comment: "Permission toggle to allow Nostr client to encrypt direct messages."), + isOn: bindableNostrClientModel.nip44EncryptPermission + ) + Toggle( + String(localized: "Decrypt DMs", comment: "Permission toggle to allow Nostr client to decrypt direct messages."), + isOn: bindableNostrClientModel.nip44DecryptPermission + ) + Toggle( + String(localized: "Encrypt legacy DMs", comment: "Permission toggle to allow Nostr client to encrypt legacy direct messages."), + isOn: bindableNostrClientModel.nip04EncryptPermission + ) + Toggle( + String(localized: "Decrypt legacy DMs", comment: "Permission toggle to allow Nostr client to decrypt legacy direct messages."), + isOn: bindableNostrClientModel.nip04DecryptPermission + ) + Toggle( + String(localized: "Decrypt zap events", comment: "Permission toggle to allow Nostr client to decrypt zap events."), + isOn: bindableNostrClientModel.decryptZapEventPermission + ) ForEach(bindableNostrClientModel.signEventPermissions, id: \.self) { signEventPermissionModel in - Toggle("Sign kind \(signEventPermissionModel.kind.wrappedValue.description) events", isOn: signEventPermissionModel.allowed) + Toggle( + String( + localized: "Sign kind \(signEventPermissionModel.kind.wrappedValue.description) events", + comment: "Permission toggle to allow Nostr client to sign events of a specific kind.." + ), + isOn: signEventPermissionModel.allowed + ) } } }