Skip to content

Commit

Permalink
convert vote reward to a decimal
Browse files Browse the repository at this point in the history
localize entire receive notification text
  • Loading branch information
dreacot committed May 28, 2021
1 parent 7985a1c commit 952e0f1
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 10 deletions.
6 changes: 6 additions & 0 deletions Decred Wallet/Extensions/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
import UIKit
import Dcrlibwallet

extension Int64 {
var toDecimal: NSDecimalNumber {
return NSDecimalNumber(value: self)
}
}

extension NSDecimalNumber {
public func round(_ decimals:Int) -> NSDecimalNumber {
return self.rounding(accordingToBehavior:
Expand Down
4 changes: 2 additions & 2 deletions Decred Wallet/Wallet Utils/TransactionNotification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ class TransactionNotification: NSObject {
var amount: String {
switch tx!.type {
case DcrlibwalletTxTypeVote:
return String(format: LocalizedStrings.voteReward, tx!.voteReward)
return String(format: LocalizedStrings.voteReward, tx!.voteReward.toDecimal)
case DcrlibwalletTxTypeRevocation:
return ""
default:
return "\(LocalizedStrings.youReceived) \(tx!.dcrAmount.round(8).description) DCR"
return String(format: LocalizedStrings.youReceived, tx!.dcrAmount.round(8).description)
}
}
notification.body = amount
Expand Down
2 changes: 1 addition & 1 deletion Decred Wallet/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@
/* Transaction Notification */
"walletNewTransaction" = "[%@] New Transaction";
"newTransaction" = "New Transaction";
"youReceived" = "You received";
"youReceived" = "You received %@ DCR";
"walletTicketVoted" = "[%@] A ticket just voted";
"ticketVoted" = "A ticket just voted";
"walletTicketRevoked" = "[%@] A ticket was revoked";
Expand Down
2 changes: 1 addition & 1 deletion Decred Wallet/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@
/* Transaction Notification */
"walletNewTransaction" = "[%@] New Transaction";
"newTransaction" = "Nueva Transacción";
"youReceived" = "Usted recibió";
"youReceived" = "Usted recibió %@ DCR";
"walletTicketVoted" = "[%@] A ticket just voted";
"ticketVoted" = "A ticket just voted";
"walletTicketRevoked" = "[%@] A ticket was revoked";
Expand Down
2 changes: 1 addition & 1 deletion Decred Wallet/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@
/* Transaction Notification */
"walletNewTransaction" = "[%@] New Transaction";
"newTransaction" = "Nouvelle Transaction";
"youReceived" = "You received";
"youReceived" = "You received %@ DCR";
"walletTicketVoted" = "[%@] A ticket just voted";
"ticketVoted" = "A ticket just voted";
"walletTicketRevoked" = "[%@] A ticket was revoked";
Expand Down
2 changes: 1 addition & 1 deletion Decred Wallet/pl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@
/* Transaction Notification */
"walletNewTransaction" = "[%@] New Transaction";
"newTransaction" = "Nowa transakcja";
"youReceived" = "Otrzymane";
"youReceived" = "Otrzymane %@ DCR";
"walletTicketVoted" = "[%@] A ticket just voted";
"ticketVoted" = "A ticket just voted";
"walletTicketRevoked" = "[%@] A ticket was revoked";
Expand Down
2 changes: 1 addition & 1 deletion Decred Wallet/pt-BR.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@
/* Transaction Notification */
"walletNewTransaction" = "[%@] New Transaction";
"newTransaction" = "Nova Transação";
"youReceived" = "Voce reebeu";
"youReceived" = "Voce reebeu %@ DCR";
"walletTicketVoted" = "[%@] A ticket just voted";
"ticketVoted" = "A ticket just voted";
"walletTicketRevoked" = "[%@] A ticket was revoked";
Expand Down
2 changes: 1 addition & 1 deletion Decred Wallet/ru-RU.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@
/* Transaction Notification */
"walletNewTransaction" = "[%@] New Transaction";
"newTransaction" = "Новая транзакция";
"youReceived" = "Вы получили";
"youReceived" = "Вы получили %@ DCR";
"walletTicketVoted" = "[%@] A ticket just voted";
"ticketVoted" = "A ticket just voted";
"walletTicketRevoked" = "[%@] A ticket was revoked";
Expand Down
2 changes: 1 addition & 1 deletion Decred Wallet/vi.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@
/* Transaction Notification */
"walletNewTransaction" = "[%@] New Transaction";
"newTransaction" = "Giao dịch mới";
"youReceived" = "Bạn đã nhận được";
"youReceived" = "Bạn đã nhận được %@ DCR";
"walletTicketVoted" = "[%@] A ticket just voted";
"ticketVoted" = "A ticket just voted";
"walletTicketRevoked" = "[%@] A ticket was revoked";
Expand Down
2 changes: 1 addition & 1 deletion Decred Wallet/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@
/* Transaction Notification */
"walletNewTransaction" = "[%@] New Transaction";
"newTransaction" = "新的交易";
"youReceived" = "您收到";
"youReceived" = "您收到 %@ DCR";
"walletTicketVoted" = "[%@] A ticket just voted";
"ticketVoted" = "A ticket just voted";
"walletTicketRevoked" = "[%@] A ticket was revoked";
Expand Down

0 comments on commit 952e0f1

Please sign in to comment.