Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Localizations
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHeaps committed Nov 13, 2023
1 parent 6284392 commit 7cb9d06
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,21 @@ struct SendTransactionSummaryView: View {
@ScaledMetric private var networkSymbolLength: CGFloat = 15
private let maxNetworkSymbolLength: CGFloat = 30

private var sendTitle: String {
String.localizedStringWithFormat(
Strings.Wallet.transactionSummaryIntentLabel,
Strings.Wallet.sent
)
}

var body: some View {
VStack {
HStack { // header
Text(time, style: .time)
Image(braveSystemName: "leo.send")
.imageScale(.small)
.foregroundColor(Color(braveSystemName: .iconDefault))
Text("Send from ") + Text(sentFromAccountName).bold()
Text(sendTitle) + Text(" " + sentFromAccountName).bold()
}
.font(secondaryFont)
.foregroundColor(secondaryTextColor)
Expand Down Expand Up @@ -263,7 +270,7 @@ struct SwapTransactionSummaryView: View {
Image(braveSystemName: "leo.currency.exchange")
.imageScale(.small)
.foregroundColor(Color(braveSystemName: .iconDefault))
Text("Swap on ") + Text(swappedOnAccountName).bold()
Text(Strings.Wallet.transactionSummarySwapOn) + Text(" " + swappedOnAccountName).bold()
}
.font(secondaryFont)
.foregroundColor(secondaryTextColor)
Expand Down Expand Up @@ -354,7 +361,7 @@ struct SolanaSwapTransactionSummaryView: View {
Image(braveSystemName: "leo.currency.exchange")
.imageScale(.small)
.foregroundColor(Color(braveSystemName: .iconDefault))
Text("Swap on ") + Text(swappedOnAccountName).bold()
Text(Strings.Wallet.transactionSummarySwapOn) + Text(" " + swappedOnAccountName).bold()
}
.font(secondaryFont)
.foregroundColor(secondaryTextColor)
Expand All @@ -376,7 +383,7 @@ struct SolanaSwapTransactionSummaryView: View {
}
}
HStack {
Text("Solana Swap")
Text(Strings.Wallet.transactionSummarySolanaSwap)
.font(primaryFont)
}
.foregroundColor(primaryTextColor)
Expand Down Expand Up @@ -429,14 +436,21 @@ struct ApprovalTransactionSummaryView: View {
@ScaledMetric private var networkSymbolLength: CGFloat = 15
private let maxNetworkSymbolLength: CGFloat = 30

private var approvedTitle: String {
String.localizedStringWithFormat(
Strings.Wallet.transactionSummaryIntentLabel,
Strings.Wallet.transactionTypeApprove
)
}

var body: some View {
VStack {
HStack { // header
Text(time, style: .time)
Image(braveSystemName: "leo.check.normal")
.imageScale(.small)
.foregroundColor(Color(braveSystemName: .iconDefault))
Text("Approved from ") + Text(fromAccountName).bold()
Text(approvedTitle) + Text(" " + fromAccountName).bold()
}
.font(secondaryFont)
.foregroundColor(secondaryTextColor)
Expand Down Expand Up @@ -545,6 +559,16 @@ struct TransactionSummaryRow_Previews: PreviewProvider {
status: .submitted,
time: Date()
)
Divider()
ApprovalTransactionSummaryView(
fromAccountName: "Account 1",
token: .mockUSDCToken,
network: .mockMainnet,
valueApproved: "1",
fiatValueApproved: "$1,500",
status: .submitted,
time: Date()
)
}
.previewLayout(.sizeThatFits)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ struct TransactionsListView: View {
private var searchBarAndFiltersContainer: some View {
VStack(spacing: 0) {
HStack(spacing: 10) {
SearchBar(text: $query, placeholder: "Search")
SearchBar(text: $query, placeholder: Strings.Wallet.search)
AssetButton(braveSystemName: "leo.filter.settings", action: filtersButtonTapped)
}
.padding(.vertical, 8)
Expand Down
32 changes: 30 additions & 2 deletions Sources/BraveWallet/WalletStrings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1563,8 +1563,8 @@ extension Strings {
value: "Approved %@ %@",
comment: "The title shown for ERC20 approvals. The first '%@' becomes the amount, the second '%@' becomes the symbol for the cryptocurrency. For example: \"Approved 150.0 BAT\""
)
public static let transactionUnknownApprovalTitle = NSLocalizedString(
"wallet.transactionUnknownApprovalTitle",
public static let transactionApprovalTitle = NSLocalizedString(
"wallet.transactionApprovalTitle",
tableName: "BraveWallet",
bundle: .module,
value: "Approved",
Expand Down Expand Up @@ -4752,5 +4752,33 @@ extension Strings {
value: "Details",
comment: "The title of the details view for Sign In With Ethereum/Brave Wallet requests."
)
public static let transactionSummaryIntentLabel = NSLocalizedString(
"wallet.transactionSummarySendType",
tableName: "BraveWallet",
bundle: .module,
value: "%@ from",
comment: "The label used to describe a transaction type. Used like 'Send from' or 'Approved from'."
)
public static let transactionSummarySwapOn = NSLocalizedString(
"wallet.transactionSummarySwapOn",
tableName: "BraveWallet",
bundle: .module,
value: "Swap on",
comment: "The label to describe an Swap transaction."
)
public static let transactionSummarySolanaSwap = NSLocalizedString(
"wallet.transactionSummarySolanaSwap",
tableName: "BraveWallet",
bundle: .module,
value: "Solana Swap",
comment: "The label to describe an Solana Swap transaction."
)
public static let search = NSLocalizedString(
"wallet.search",
tableName: "BraveWallet",
bundle: .module,
value: "Search",
comment: "The label as a placeholder in search fields."
)
}
}

0 comments on commit 7cb9d06

Please sign in to comment.