Skip to content

Commit

Permalink
Screenshots for localization and comments for text strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
jensutbult committed Jan 10, 2024
1 parent 9e5d0ad commit d823188
Show file tree
Hide file tree
Showing 38 changed files with 27 additions and 27 deletions.
14 changes: 7 additions & 7 deletions Authenticator/UI/AccountDetailsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ struct AccountDetailsView: View {
}
}
.accessibilityElement()
.accessibilityHint("Dismiss details view")
.accessibilityHint(String(localized: "Dismiss details view", comment: "Accessibility hint"))
.accessibilityAction {
self.data = nil
}
Expand Down Expand Up @@ -148,7 +148,7 @@ struct AccountDetailsView: View {
account.calculate()
}
.accessibilityAddTraits(.isButton)
.accessibilityLabel(account.state == .expired ? "Code expired" : account.formattedCode ?? "Code not calculated")
.accessibilityLabel(account.state == .expired ? String(localized: "Code expired", comment: "Accessibility label") : account.formattedCode ?? String(localized: "Code not calculated", comment: "Accessibility label"))

ZStack {
if let otp = data.account.formattedCode {
Expand Down Expand Up @@ -212,20 +212,20 @@ struct AccountDetailsView: View {
}

DetachedMenu(menuActions: [
DetachedMenuAction(style: .default, isEnabled: account.enableRefresh, title: "Calculate", systemImage: "arrow.clockwise", action: {
DetachedMenuAction(style: .default, isEnabled: account.enableRefresh, title: String(localized: "Calculate", comment: "Menu"), systemImage: "arrow.clockwise", action: {
self.account.calculate()
}),
DetachedMenuAction(style: .default, isEnabled: account.state != .expired && account.otp != nil, title: "Copy", systemImage: "square.and.arrow.up", action: {
DetachedMenuAction(style: .default, isEnabled: account.state != .expired && account.otp != nil, title: String(localized: "Copy", comment: "Menu"), systemImage: "square.and.arrow.up", action: {
guard let otp = account.otp?.code else { return }
toastPresenter.copyToClipboard(otp)
}),
DetachedMenuAction(style: .default, isEnabled: true, title: account.isPinned ? "Unpin" : "Pin", systemImage: "pin", action: {
DetachedMenuAction(style: .default, isEnabled: true, title: account.isPinned ? String(localized: "Unpin", comment: "Menu") : String(localized: "Pin", comment: "Menu"), systemImage: "pin", action: {
account.isPinned.toggle()
}),
account.keyVersion >= YKFVersion(string: "5.3.0") ? DetachedMenuAction(style: .default, isEnabled: true, title: "Rename", systemImage: "square.and.pencil", action: {
account.keyVersion >= YKFVersion(string: "5.3.0") ? DetachedMenuAction(style: .default, isEnabled: true, title: String(localized: "Rename", comment: "Menu"), systemImage: "square.and.pencil", action: {
showEditing.toggle()
}) : nil,
DetachedMenuAction(style: .destructive, isEnabled: true, title: "Delete", systemImage: "trash", action: {
DetachedMenuAction(style: .destructive, isEnabled: true, title: String(localized: "Delete", comment: "Menu"), systemImage: "trash", action: {
showDeleteConfirmation = true
})
].compactMap { $0 } )
Expand Down
2 changes: 1 addition & 1 deletion Authenticator/UI/AccountRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ struct AccountRowView: View {
.stroke(pillColor, lineWidth: 1)
}
.accessibilityElement()
.accessibilityLabel(account.state == .expired ? "Code expired" : account.formattedCode ?? "Code not calculated")
.accessibilityLabel(account.state == .expired ? String(localized: "Code expired", comment: "Accessibility label") : account.formattedCode ?? String(localized: "Code not calculated", comment: "Accessibility label"))
.opacity(pillOpacity)
.scaleEffect(pillScaling)
}
Expand Down
2 changes: 1 addition & 1 deletion Authenticator/UI/ErrorAlertView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import SwiftUI

extension View {
func errorAlert(error: Binding<Error?>, buttonTitle: String = "OK", handler: (() -> Void)? = nil) -> some View {
func errorAlert(error: Binding<Error?>, buttonTitle: String = String(localized: "OK", comment:"OK button in error alert."), handler: (() -> Void)? = nil) -> some View {
let localizedAlertError = LocalizedAlertError(error: error.wrappedValue)
return alert(isPresented: .constant(localizedAlertError != nil), error: localizedAlertError) { _ in
Button(buttonTitle) {
Expand Down
8 changes: 4 additions & 4 deletions Authenticator/UI/ListStatusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ struct ListStatusView: View {
.frame(height: height - 100)
.listRowSeparator(.hidden)
.sheet(isPresented: $showWhatsNew) {
VersionHistoryView(title: "What's new in\nYubico Authenticator")
VersionHistoryView(title: String(localized: "What's new in\nYubico Authenticator", comment: "Version history title"))
}
}
}

struct WhatsNewView: View {

var text: AttributedString {
var see = AttributedString("See ")
var see = AttributedString(localized: "See ", comment: "Substring in \"See what's new in this version\"")
see.foregroundColor = .secondaryLabel
var whatsNew = AttributedString("what's new")
var whatsNew = AttributedString(localized: "what's new", comment: "Substring in \"See what's new in this version\"")
whatsNew.foregroundColor = Color(.yubiBlue)
var inThisVersion = AttributedString(" in this version")
var inThisVersion = AttributedString(localized: " in this version", comment: "Substring in \"See what's new in this version\"")
inThisVersion.foregroundColor = .secondaryLabel
return see + whatsNew + inThisVersion
}
Expand Down
28 changes: 14 additions & 14 deletions Authenticator/UI/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ struct MainView: View {

var insertYubiKeyMessage = {
if YubiKitDeviceCapabilities.supportsISO7816NFCTags {
"Insert YubiKey \(!UIAccessibility.isVoiceOverRunning ? "or pull down to activate NFC" : "or scan a NFC YubiKey")"
String(localized: "Insert YubiKey") + "\(!UIAccessibility.isVoiceOverRunning ? String(localized: "or pull down to activate NFC") : String(localized: "or scan a NFC YubiKey"))"
} else {
"Insert YubiKey"
String(localized: "Insert YubiKey")
}
}()

Expand All @@ -61,7 +61,7 @@ struct MainView: View {
AccountRowView(account: account, showAccountDetails: $showAccountDetails)
}
} else {
ListStatusView(image: Image(systemName: "person.crop.circle.badge.questionmark"), message: "No matching accounts on YubiKey", height: reader.size.height)
ListStatusView(image: Image(systemName: "person.crop.circle.badge.questionmark"), message: String(localized: "No matching accounts on YubiKey"), height: reader.size.height)
}
} else if model.pinnedAccounts.count > 0 {
Section(header: Text("Pinned").frame(maxWidth: .infinity, alignment: .leading).font(.title3.bold()).foregroundColor(Color("ListSectionHeaderColor"))) {
Expand All @@ -87,12 +87,12 @@ struct MainView: View {
AccountRowView(account: account, showAccountDetails: $showAccountDetails)
}
} else {
ListStatusView(image: Image(systemName: "person.crop.circle"), message: "No accounts on YubiKey", height: reader.size.height)
ListStatusView(image: Image(systemName: "person.crop.circle"), message: String(localized: "No accounts on YubiKey"), height: reader.size.height)
}
}
}
.accessibilityHidden(showAccountDetails != nil)
.searchable(text: $searchText, prompt: "Search")
.searchable(text: $searchText, prompt: String(localized: "Search"))
.autocorrectionDisabled(true)
.keyboardType(.asciiCapable)
.listStyle(.inset)
Expand Down Expand Up @@ -138,7 +138,7 @@ struct MainView: View {
}
}
}
.navigationTitle(model.accountsLoaded ? "Accounts" : "")
.navigationTitle(model.accountsLoaded ? String(localized: "Accounts", comment: "Navigation title in main view.") : "")
}
.accessibilityHidden(showAccountDetails != nil)
.overlay {
Expand All @@ -159,24 +159,24 @@ struct MainView: View {
DisableOTPView()
}

.alert("Enter password", isPresented: $model.presentPasswordEntry) {
SecureField("Password", text: $password)
Button("Cancel", role: .cancel) { password = "" }
Button("Ok") {
.alert(String(localized: "Enter password", comment: "Password alert"), isPresented: $model.presentPasswordEntry) {
SecureField(String(localized: "Password", comment: "Password alert"), text: $password)
Button(String(localized: "Cancel", comment: "Password alert"), role: .cancel) { password = "" }
Button(String(localized: "Ok", comment: "Password alert")) {
model.password.send(password)
password = ""
}
} message: {
Text(model.passwordEntryMessage)
}
.alertOrConfirmationDialog("Save password?", isPresented: $model.presentPasswordSaveType) {
Button("Save password") { model.passwordSaveType.send(.some(.save)) }
.alertOrConfirmationDialog(String(localized: "Save password?", comment: "Save password alert"), isPresented: $model.presentPasswordSaveType) {
Button("Save password", comment: "Save password alert.") { model.passwordSaveType.send(.some(.save)) }
let authenticationType = PasswordPreferences.evaluatedAuthenticationType()
if authenticationType != .none {
Button("Save and protect with \(authenticationType.title)") { model.passwordSaveType.send(.some(.lock)) }
}
Button("Never for this YubiKey") { model.passwordSaveType.send(.some(.never)) }
Button("Not now" , role: .cancel) { model.passwordSaveType.send(nil) }
Button("Never for this YubiKey", comment: "Save password alert.") { model.passwordSaveType.send(.some(.never)) }
Button("Not now", comment: "Save passsword alert" , role: .cancel) { model.passwordSaveType.send(nil) }
}
.errorAlert(error: $model.sessionError)
.errorAlert(error: $model.connectionError) { model.start() }
Expand Down
Binary file added LocalizationScreenshots/1-start.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LocalizationScreenshots/13-configuration.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LocalizationScreenshots/24-about.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LocalizationScreenshots/25-about-tutorial-1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LocalizationScreenshots/26-about-tutorial-2.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LocalizationScreenshots/27-about-tutorial-3.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LocalizationScreenshots/28-about-tutorial-4.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LocalizationScreenshots/30-disable-otp.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added LocalizationScreenshots/4-start-list.jpeg
Binary file added LocalizationScreenshots/5-details.jpeg
Binary file added LocalizationScreenshots/6-rename.jpeg
Binary file added LocalizationScreenshots/7-delete-alert.jpeg
Binary file added LocalizationScreenshots/8-start-menu.jpeg

0 comments on commit d823188

Please sign in to comment.