Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add SwiftUI translations into VaultUI project directly (#520)
Leendert de Borst1efc06eaac2f
diff --git a/apps/mobile-app/ios/Autofill/en.lproj/Localizable.strings b/apps/mobile-app/ios/Autofill/en.lproj/Localizable.stringsindex 1f888c7a2..3320eaf13 100644Binary files a/apps/mobile-app/ios/Autofill/en.lproj/Localizable.strings and b/apps/mobile-app/ios/Autofill/en.lproj/Localizable.strings differdiff --git a/apps/mobile-app/ios/VaultUI/Bundle+VaultUI.swift b/apps/mobile-app/ios/VaultUI/Bundle+VaultUI.swiftnew file mode 100644index 000000000..3ae9c8801--- /dev/null+++ b/apps/mobile-app/ios/VaultUI/Bundle+VaultUI.swift@@ -0,0 +1,12 @@+import Foundation++private final class VaultUIBundleToken {}++extension Bundle {+ /// The bundle that contains VaultUI’s localized resources+ static var vaultUI: Bundle {+ // If you don’t use a separate .bundle target, this is the framework bundle itself.+ let frameworkBundle = Bundle(for: VaultUIBundleToken.self)+ return frameworkBundle+ }+}diff --git a/apps/mobile-app/ios/VaultUI/Components/SearchBar.swift b/apps/mobile-app/ios/VaultUI/Components/SearchBar.swiftindex 9d5216f5f..82f4ce85d 100644--- a/apps/mobile-app/ios/VaultUI/Components/SearchBar.swift+++ b/apps/mobile-app/ios/VaultUI/Components/SearchBar.swift@@ -1,6 +1,8 @@import SwiftUIimport Macaw+private let locBundle = Bundle.vaultUI+/// Search bar viewpublic struct SearchBarView: View {@Binding var text: String@@ -13,7 +15,7 @@ public struct SearchBarView: View {.foregroundColor(colorScheme == .dark ? ColorConstants.Dark.text : ColorConstants.Light.text).padding(.leading, 8)- TextField(NSLocalizedString("search_credentials", comment: "Search credentials placeholder"), text: $text)+ TextField(String(localized: "search_credentials", bundle: locBundle), text: $text).autocapitalization(.none).disableAutocorrection(true).foregroundColor(colorScheme == .dark ? ColorConstants.Dark.text : ColorConstants.Light.text)diff --git a/apps/mobile-app/ios/VaultUI/Views/CredentialProviderView.swift b/apps/mobile-app/ios/VaultUI/Views/CredentialProviderView.swiftindex c1a0a76a6..ffdb0de45 100644--- a/apps/mobile-app/ios/VaultUI/Views/CredentialProviderView.swift+++ b/apps/mobile-app/ios/VaultUI/Views/CredentialProviderView.swift@@ -2,6 +2,8 @@ import SwiftUIimport AuthenticationServicesimport VaultModels+private let locBundle = Bundle.vaultUI+/// Credential provider viewpublic struct CredentialProviderView: View {@ObservedObject public var viewModel: CredentialProviderViewModel@@ -30,7 +32,7 @@ public struct CredentialProviderView: View {if viewModel.isLoading {Spacer()- ProgressView(NSLocalizedString("loading_credentials", comment: ""))+ ProgressView(String(localized: "loading_credentials", bundle: locBundle)).progressViewStyle(.circular).scaleEffect(1.5)Spacer()@@ -42,11 +44,11 @@ public struct CredentialProviderView: View {.font(.system(size: 50)).foregroundColor(colorScheme == .dark ? ColorConstants.Dark.text : ColorConstants.Light.text)- Text(NSLocalizedString("no_credentials_found", comment: ""))+ Text(String(localized: "no_credentials_found", bundle: locBundle)).font(.headline).foregroundColor(colorScheme == .dark ? ColorConstants.Dark.text : ColorConstants.Light.text)- Text(NSLocalizedString("no_credentials_match", comment: ""))+ Text(String(localized: "no_credentials_match", bundle: locBundle)).font(.subheadline).foregroundColor(colorScheme == .dark ? ColorConstants.Dark.text : ColorConstants.Light.text).multilineTextAlignment(.center)@@ -65,7 +67,7 @@ public struct CredentialProviderView: View {}, label: {HStack {Image(systemName: "plus.circle.fill")- Text(NSLocalizedString("create_new_credential", comment: ""))+ Text(String(localized: "create_new_credential", bundle: locBundle))}.padding().frame(maxWidth: .infinity)@@ -98,11 +100,11 @@ public struct CredentialProviderView: View {}}}- .navigationTitle(viewModel.isChoosingTextToInsert ? NSLocalizedString("select_text_to_insert", comment: "") : NSLocalizedString("select_credential", comment: ""))+ .navigationTitle(viewModel.isChoosingTextToInsert ? String(localized: "select_text_to_insert", bundle: locBundle) : String(localized: "select_credential", bundle: locBundle)).navigationBarTitleDisplayMode(.inline).toolbar {ToolbarItem(placement: .navigationBarLeading) {- Button(NSLocalizedString("cancel", comment: "")) {+ Button(String(localized: "cancel", bundle: locBundle)) {viewModel.cancel()}.foregroundColor(ColorConstants.Light.primary)@@ -128,25 +130,29 @@ public struct CredentialProviderView: View {.actionSheet(isPresented: $viewModel.showSelectionOptions) {// Define all text stringsguard let credential = viewModel.selectedCredential else {- return ActionSheet(title: Text(NSLocalizedString("choose_username", comment: "")), message: Text(NSLocalizedString("no_credential_selected", comment: "")), buttons: [.cancel()])+ return ActionSheet(+ title: Text(String(localized: "choose_username", bundle: locBundle)),+ message: Text(String(localized: "no_credential_selected", bundle: locBundle)),+ buttons: [.cancel()]+ )}var buttons: [ActionSheet.Button] = []if viewModel.isChoosingTextToInsert {if let username = credential.username, !username.isEmpty {- buttons.append(.default(Text(NSLocalizedString("username_prefix", comment: "") + username)) {+ buttons.append(.default(Text(String(localized: "username_prefix", bundle: locBundle) + username)) {viewModel.selectUsername()})}if let email = credential.alias?.email, !email.isEmpty {- buttons.append(.default(Text(NSLocalizedString("email_prefix", comment: "") + email)) {+ buttons.append(.default(Text(String(localized: "email_prefix", bundle: locBundle) + email)) {viewModel.selectEmail()})}- buttons.append(.default(Text(NSLocalizedString("password", comment: ""))) {+ buttons.append(.default(Text(String(localized: "password", bundle: locBundle))) {viewModel.selectPassword()})} else {@@ -165,14 +171,17 @@ public struct CredentialProviderView: View {buttons.append(.cancel())+ let titleKey = viewModel.isChoosingTextToInsert ? "select_text_to_insert" : "choose_username"+ let messageKey = viewModel.isChoosingTextToInsert ? "select_text_to_insert_message" : "choose_username_message"+return ActionSheet(- title: viewModel.isChoosingTextToInsert ? Text(NSLocalizedString("select_text_to_insert", comment: "")) : Text(NSLocalizedString("choose_username", comment: "")),- message: viewModel.isChoosingTextToInsert ? Text(NSLocalizedString("select_text_to_insert_message", comment: "")) : Text(NSLocalizedString("choose_username_message", comment: "")),+ title: Text(NSLocalizedString(titleKey, bundle: locBundle, comment: "")),+ message: Text(NSLocalizedString(messageKey, bundle: locBundle, comment: "")),buttons: buttons)}- .alert(NSLocalizedString("error", comment: ""), isPresented: $viewModel.showError) {- Button(NSLocalizedString("ok", comment: "")) {+ .alert(String(localized: "error", bundle: locBundle), isPresented: $viewModel.showError) {+ Button(String(localized: "ok", bundle: locBundle)) {viewModel.dismissError()}} message: {@@ -241,16 +250,15 @@ public class CredentialProviderViewModel: ObservableObject {isLoading = false} catch {isLoading = false- errorMessage = NSLocalizedString("credentials_load_error", comment: "")+ errorMessage = String(localized: "credentials_load_error", bundle: locBundle)showError = true}}- func filterCredentials() {+ func filterCredentials() {filteredCredentials = CredentialFilter.filterCredentials(credentials, searchText: searchText)}-func selectCredential(_ credential: Credential) {selectedCredential = credentialdiff --git a/apps/mobile-app/ios/VaultUI/Views/PasskeyProviderView.swift b/apps/mobile-app/ios/VaultUI/Views/PasskeyProviderView.swiftindex 298b7c463..758e73a98 100644--- a/apps/mobile-app/ios/VaultUI/Views/PasskeyProviderView.swift+++ b/apps/mobile-app/ios/VaultUI/Views/PasskeyProviderView.swift@@ -2,6 +2,8 @@ import SwiftUIimport AuthenticationServicesimport VaultModels+private let locBundle = Bundle.vaultUI+/// Passkey provider view for selecting passkeys during authentication/// TODO: review filepublic struct PasskeyProviderView: View {@@ -31,7 +33,7 @@ public struct PasskeyProviderView: View {if viewModel.isLoading {Spacer()- ProgressView(NSLocalizedString("loading_passkeys", comment: ""))+ ProgressView(String(localized: "loading_passkeys", bundle: locBundle)).progressViewStyle(.circular).scaleEffect(1.5)Spacer()@@ -43,11 +45,11 @@ public struct PasskeyProviderView: View {.font(.system(size: 50)).foregroundColor(colorScheme == .dark ? ColorConstants.Dark.text : ColorConstants.Light.text)- Text(NSLocalizedString("no_passkeys_found", comment: ""))+ Text(String(localized: "no_passkeys_found", bundle: locBundle)).font(.headline).foregroundColor(colorScheme == .dark ? ColorConstants.Dark.text : ColorConstants.Light.text)- Text(NSLocalizedString("no_passkeys_match", comment: ""))+ Text(String(localized: "no_passkeys_match", bundle: locBundle)).font(.subheadline).foregroundColor(colorScheme == .dark ? ColorConstants.Dark.text : ColorConstants.Light.text).multilineTextAlignment(.center)@@ -75,18 +77,18 @@ public struct PasskeyProviderView: View {}}}- .navigationTitle(NSLocalizedString("select_passkey", comment: ""))+ .navigationTitle(String(localized: "select_passkey", bundle: locBundle)).navigationBarTitleDisplayMode(.inline).toolbar {ToolbarItem(placement: .navigationBarLeading) {- Button(NSLocalizedString("cancel", comment: "")) {+ Button(String(localized: "cancel", bundle: locBundle)) {viewModel.cancel()}.foregroundColor(ColorConstants.Light.primary)}}- .alert(NSLocalizedString("error", comment: ""), isPresented: $viewModel.showError) {- Button(NSLocalizedString("ok", comment: "")) {+ .alert(String(localized: "error", bundle: locBundle), isPresented: $viewModel.showError) {+ Button(String(localized: "ok", bundle: locBundle)) {viewModel.dismissError()}} message: {@@ -135,6 +137,7 @@ private struct PasskeyCredentialCard: View {.foregroundColor(ColorConstants.Light.primary)}.frame(width: 40, height: 40)+ .padding()}VStack(alignment: .leading, spacing: 4) {@@ -219,7 +222,7 @@ public class PasskeyProviderViewModel: ObservableObject {isLoading = false} catch {isLoading = false- errorMessage = NSLocalizedString("passkeys_load_error", comment: "")+ errorMessage = String(localized: "passkeys_load_error", bundle: locBundle)showError = true}}diff --git a/apps/mobile-app/ios/VaultUI/Views/PasskeyRegistrationView.swift b/apps/mobile-app/ios/VaultUI/Views/PasskeyRegistrationView.swiftindex 0378711d8..07afa4de5 100644--- a/apps/mobile-app/ios/VaultUI/Views/PasskeyRegistrationView.swift+++ b/apps/mobile-app/ios/VaultUI/Views/PasskeyRegistrationView.swift@@ -1,6 +1,8 @@import SwiftUIimport AuthenticationServices+private let locBundle = Bundle.vaultUI+/// Passkey registration view for the autofill extensionpublic struct PasskeyRegistrationView: View {@ObservedObject public var viewModel: PasskeyRegistrationViewModel@@ -28,12 +30,12 @@ public struct PasskeyRegistrationView: View {.frame(width: 80, height: 80).padding(.top, 20)- Text(NSLocalizedString("create_passkey_title", comment: ""))+ Text(String(localized: "create_passkey_title", bundle: locBundle)).font(.title).fontWeight(.bold).foregroundColor(colorScheme == .dark ? ColorConstants.Dark.text : ColorConstants.Light.text)- Text(NSLocalizedString("create_passkey_subtitle", comment: ""))+ Text(String(localized: "create_passkey_subtitle", bundle: locBundle)).font(.subheadline).foregroundColor(colorScheme == .dark ? ColorConstants.Dark.textMuted : ColorConstants.Light.textMuted).multilineTextAlignment(.center)@@ -44,14 +46,14 @@ public struct PasskeyRegistrationView: View {// Request detailsVStack(spacing: 16) {InfoRow(- label: NSLocalizedString("website", comment: ""),+ label: String(localized: "website", bundle: locBundle),value: viewModel.rpId,icon: "globe")if let userName = viewModel.userName {InfoRow(- label: NSLocalizedString("username", comment: ""),+ label: String(localized: "username", bundle: locBundle),value: userName,icon: "person.fill")@@ -68,7 +70,7 @@ public struct PasskeyRegistrationView: View {}, label: {HStack {Image(systemName: "key.fill")- Text(NSLocalizedString("create_passkey_button_confirm", comment: ""))+ Text(String(localized: "create_passkey_button_confirm", bundle: locBundle))}.padding().frame(maxWidth: .infinity)@@ -80,7 +82,7 @@ public struct PasskeyRegistrationView: View {Button(action: {viewModel.cancel()}, label: {- Text(NSLocalizedString("cancel", comment: ""))+ Text(String(localized: "cancel", bundle: locBundle)).padding().frame(maxWidth: .infinity).foregroundColor(ColorConstants.Light.primary)diff --git a/apps/mobile-app/ios/VaultUI/en.lproj/Localizable.strings b/apps/mobile-app/ios/VaultUI/en.lproj/Localizable.stringsnew file mode 100644index 000000000..bb82dda6fBinary files /dev/null and b/apps/mobile-app/ios/VaultUI/en.lproj/Localizable.strings differ