feat: add describeOption to localize receive types

This commit is contained in:
Rafael Saes 2023-12-06 10:21:39 -03:00
parent 4f0f1544fb
commit ad3d2f1166
29 changed files with 268 additions and 124 deletions

View file

@ -1,3 +1,4 @@
import 'package:cake_wallet/generated/i18n.dart';
enum ReceivePageOption {
mainnet,
@ -9,13 +10,13 @@ enum ReceivePageOption {
String label = '';
switch (this) {
case ReceivePageOption.mainnet:
label = 'Mainnet';
label = S.current.mainnet;
break;
case ReceivePageOption.anonPayInvoice:
label = 'Trocador AnonPay Invoice';
label = S.current.trocador_anonpay_invoice;
break;
case ReceivePageOption.anonPayDonationLink:
label = 'Trocador AnonPay Donation Link';
label = S.current.trocador_anonpay_donation_link;
break;
}
return label;

View file

@ -10,8 +10,7 @@ import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:cake_wallet/generated/i18n.dart';
class PresentReceiveOptionPicker extends StatelessWidget {
PresentReceiveOptionPicker(
{required this.receiveOptionViewModel, required this.color});
PresentReceiveOptionPicker({required this.receiveOptionViewModel, required this.color});
final ReceiveOptionViewModel receiveOptionViewModel;
final Color color;
@ -43,17 +42,11 @@ class PresentReceiveOptionPicker extends StatelessWidget {
Text(
S.current.receive,
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
fontFamily: 'Lato',
color: color),
fontSize: 18.0, fontWeight: FontWeight.bold, fontFamily: 'Lato', color: color),
),
Observer(
builder: (_) => Text(receiveOptionViewModel.selectedReceiveOption.toString(),
style: TextStyle(
fontSize: 10.0,
fontWeight: FontWeight.w500,
color: color)))
builder: (_) => Text(describeOption(receiveOptionViewModel.selectedReceiveOption),
style: TextStyle(fontSize: 10.0, fontWeight: FontWeight.w500, color: color)))
],
),
SizedBox(width: 5),
@ -73,7 +66,8 @@ class PresentReceiveOptionPicker extends StatelessWidget {
backgroundColor: Colors.transparent,
body: Stack(
alignment: AlignmentDirectional.center,
children:[ AlertBackground(
children: [
AlertBackground(
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
@ -107,10 +101,12 @@ class PresentReceiveOptionPicker extends StatelessWidget {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(option.toString(),
Text(describeOption(option),
textAlign: TextAlign.left,
style: textSmall(
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
color: Theme.of(context)
.extension<CakeTextTheme>()!
.titleColor,
).copyWith(
fontWeight:
value == option ? FontWeight.w800 : FontWeight.w500,

View file

@ -3,6 +3,7 @@ import 'package:cw_core/wallet_base.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:mobx/mobx.dart';
import 'package:bitcoin_flutter/bitcoin_flutter.dart' as bitcoin;
import 'package:cake_wallet/generated/i18n.dart';
part 'receive_option_view_model.g.dart';
@ -45,3 +46,22 @@ abstract class ReceiveOptionViewModelBase with Store {
selectedReceiveOption = option;
}
}
String describeOption(dynamic option) {
if (option is ReceivePageOption) {
return option.toString();
}
if (option is bitcoin.AddressType) {
switch (option) {
case bitcoin.AddressType.p2sp:
return S.current.bitcoin_silent_payments;
case bitcoin.AddressType.p2pkh:
return S.current.bitcoin_legacy;
default:
return option.toString();
}
}
return "";
}

View file

@ -748,5 +748,10 @@
"seedtype_polyseed": "بوليسيد (16 كلمة)",
"seed_language_czech": "التشيكية",
"seed_language_korean": "الكورية",
"seed_language_chinese_traditional": "تقاليد صينية)"
"seed_language_chinese_traditional": "تقاليد صينية)",
"mainnet": "mainnet",
"trocador_anonpay_invoice": "فاتورة Trocador Anonpay",
"trocador_anonpay_donation_link": "رابط التبرع Trocador Anonpay",
"bitcoin_silent_payments": "مدفوعات بيتكوين صامتة",
"bitcoin_legacy": "إرث البيتكوين"
}

View file

@ -744,5 +744,10 @@
"seedtype_polyseed": "Поли семе (16 думи)",
"seed_language_czech": "Чех",
"seed_language_korean": "Корейски",
"seed_language_chinese_traditional": "Традиционен китайски)"
"seed_language_chinese_traditional": "Традиционен китайски)",
"mainnet": "Mainnet",
"trocador_anonpay_invoice": "Трокадор Anonpay Фактура",
"trocador_anonpay_donation_link": "Трокадорна връзка за дарение на Anonpay",
"bitcoin_silent_payments": "Биткойн мълчаливи плащания",
"bitcoin_legacy": "Legacy Bitcoin"
}

View file

@ -744,5 +744,10 @@
"seedtype_polyseed": "Polyseed (16 slov)",
"seed_language_czech": "čeština",
"seed_language_korean": "korejština",
"seed_language_chinese_traditional": "Číňan (tradiční)"
"seed_language_chinese_traditional": "Číňan (tradiční)",
"mainnet": "Mainnet",
"trocador_anonpay_invoice": "Trocador anonpay faktura",
"trocador_anonpay_donation_link": "Trocador AnonPay Darovací odkaz",
"bitcoin_silent_payments": "Bitcoinové tiché platby",
"bitcoin_legacy": "Bitcoin Legacy"
}

View file

@ -752,5 +752,10 @@
"seedtype_polyseed": "Polyseed (16 Wörter)",
"seed_language_czech": "Tschechisch",
"seed_language_korean": "Koreanisch",
"seed_language_chinese_traditional": "Chinesisch (Traditionell)"
"seed_language_chinese_traditional": "Chinesisch (Traditionell)",
"mainnet": "Hauptnetz",
"trocador_anonpay_invoice": "Trocador Anonpay In Rechnung",
"trocador_anonpay_donation_link": "Trocador Anonpay Spendenlink",
"bitcoin_silent_payments": "Bitcoin stille Zahlungen",
"bitcoin_legacy": "Bitcoin -Erbe"
}

View file

@ -753,5 +753,10 @@
"seedtype_polyseed": "Polyseed (16 words)",
"seed_language_czech": "Czech",
"seed_language_korean": "Korean",
"seed_language_chinese_traditional": "Chinese (Traditional)"
"seed_language_chinese_traditional": "Chinese (Traditional)",
"mainnet": "Mainnet",
"trocador_anonpay_invoice": "Trocador AnonPay Invoice",
"trocador_anonpay_donation_link": "Trocador AnonPay Donation Link",
"bitcoin_silent_payments": "Bitcoin Silent Payments",
"bitcoin_legacy": "Bitcoin Legacy"
}

View file

@ -752,5 +752,10 @@
"seedtype_polyseed": "Polieta (16 palabras)",
"seed_language_czech": "checo",
"seed_language_korean": "coreano",
"seed_language_chinese_traditional": "Chino (tradicional)"
"seed_language_chinese_traditional": "Chino (tradicional)",
"mainnet": "Red",
"trocador_anonpay_invoice": "Trocador Anonpay Factura",
"trocador_anonpay_donation_link": "Trocador Anonpay Donation Link",
"bitcoin_silent_payments": "Pagos silenciosos de Bitcoin",
"bitcoin_legacy": "Legado de bitcoin"
}

View file

@ -729,7 +729,7 @@
"exchange_provider_unsupported": "${providerName} n'est plus pris en charge !",
"domain_looks_up": "Résolution de nom",
"require_for_exchanges_to_external_wallets": "Exiger pour les échanges vers des portefeuilles externes",
"camera_permission_is_required": "L'autorisation de la caméra est requise.\nVeuillez l'activer à partir des paramètres de l'application.",
"camera_permission_is_required": "L'autorisation d'accès à la caméra est requise.\nVeuillez l'activer depuis les paramètres de l'application.",
"switchToETHWallet": "Veuillez passer à un portefeuille (wallet) Ethereum et réessayer",
"importNFTs": "Importer des NFT",
"noNFTYet": "Pas encore de NFT",
@ -741,13 +741,10 @@
"seed_phrase_length": "Longueur de la phrase de départ",
"unavailable_balance": "Solde indisponible",
"unavailable_balance_description": "Solde indisponible : ce total comprend les fonds bloqués dans les transactions en attente et ceux que vous avez activement gelés dans vos paramètres de contrôle des pièces. Les soldes bloqués deviendront disponibles une fois leurs transactions respectives terminées, tandis que les soldes gelés resteront inaccessibles aux transactions jusqu'à ce que vous décidiez de les débloquer.",
"camera_permission_is_required": "L'autorisation d'accès à la caméra est requise.\nVeuillez l'activer depuis les paramètres de l'application.",
"switchToETHWallet": "Veuillez passer à un portefeuille (wallet) Ethereum et réessayer",
"unspent_change": "Changement",
"Block_remaining": "${status} bloc restant",
"labeled_silent_addresses": "Adresses silencieuses étiquetées",
"use_testnet": "Utiliser TestNet",
"unspent_change": "Changement",
"tor_connection": "Connexion Tor",
"seed_hex_form": "Graine du portefeuille (forme hexagonale)",
"seedtype": "Type de type graine",
@ -755,5 +752,10 @@
"seedtype_polyseed": "Polyseed (16 mots)",
"seed_language_czech": "tchèque",
"seed_language_korean": "coréen",
"seed_language_chinese_traditional": "Chinois (Traditionnel)"
"seed_language_chinese_traditional": "Chinois (Traditionnel)",
"mainnet": "MainNet",
"trocador_anonpay_invoice": "Facture anonpay du Trocador",
"trocador_anonpay_donation_link": "Lien de don du Trocador anonpay",
"bitcoin_silent_payments": "Bitcoin Paiements silencieux",
"bitcoin_legacy": "Bitcoin Legacy"
}

View file

@ -730,5 +730,10 @@
"seedtype_polyseed": "Polyseed (16 kalmomi)",
"seed_language_czech": "Czech",
"seed_language_korean": "Yaren Koriya",
"seed_language_chinese_traditional": "Sinanci (na gargajiya)"
"seed_language_chinese_traditional": "Sinanci (na gargajiya)",
"mainnet": "Otnet",
"trocador_anonpay_invoice": "Atroador Antonpay",
"trocador_anonpay_donation_link": "Hanyar bayar da gudummawa na Trorojador",
"bitcoin_silent_payments": "Bitcoin Silent biya",
"bitcoin_legacy": "Gado bitcoin"
}

View file

@ -752,5 +752,10 @@
"seedtype_polyseed": "पॉलीसीड (16 शब्द)",
"seed_language_czech": "चेक",
"seed_language_korean": "कोरियाई",
"seed_language_chinese_traditional": "चीनी पारंपरिक)"
"seed_language_chinese_traditional": "चीनी पारंपरिक)",
"mainnet": "मेननेट",
"trocador_anonpay_invoice": "Trocador anonpay चालान",
"trocador_anonpay_donation_link": "Trocador anonpay दान लिंक",
"bitcoin_silent_payments": "बिटकॉइन मूक भुगतान",
"bitcoin_legacy": "बिटकॉइन विरासत"
}

View file

@ -750,5 +750,10 @@
"seedtype_polyseed": "Poliseed (16 riječi)",
"seed_language_czech": "češki",
"seed_language_korean": "korejski",
"seed_language_chinese_traditional": "Kinesko (tradicionalno)"
"seed_language_chinese_traditional": "Kinesko (tradicionalno)",
"mainnet": "Mainnet",
"trocador_anonpay_invoice": "Trokador anonpay faktura",
"trocador_anonpay_donation_link": "Link za donaciju trokadora",
"bitcoin_silent_payments": "Bitcoin tiha plaćanja",
"bitcoin_legacy": "Nasljeđe bitcoina"
}

View file

@ -740,5 +740,10 @@
"seedtype_polyseed": "Polyseed (16 kata)",
"seed_language_czech": "Ceko",
"seed_language_korean": "Korea",
"seed_language_chinese_traditional": "Cina (tradisional)"
"seed_language_chinese_traditional": "Cina (tradisional)",
"mainnet": "Mainnet",
"trocador_anonpay_invoice": "Faktur Trocador Anonpay",
"trocador_anonpay_donation_link": "Tautan donasi trocador anonpay",
"bitcoin_silent_payments": "Bitcoin pembayaran diam",
"bitcoin_legacy": "Bitcoin Legacy"
}

View file

@ -752,5 +752,10 @@
"seedtype_polyseed": "Polyseed (16 parole)",
"seed_language_czech": "ceco",
"seed_language_korean": "coreano",
"seed_language_chinese_traditional": "Cinese tradizionale)"
"seed_language_chinese_traditional": "Cinese tradizionale)",
"mainnet": "Mainnet",
"trocador_anonpay_invoice": "Trocador Anonpay fattura",
"trocador_anonpay_donation_link": "Link di donazione di Trocador Anonpay",
"bitcoin_silent_payments": "Pagamenti silenziosi bitcoin",
"bitcoin_legacy": "Bitcoin Legacy"
}

View file

@ -752,5 +752,10 @@
"seedtype_polyseed": "ポリシード16語",
"seed_language_czech": "チェコ",
"seed_language_korean": "韓国語",
"seed_language_chinese_traditional": "中国の伝統的な)"
"seed_language_chinese_traditional": "中国の伝統的な)",
"mainnet": "メインネット",
"trocador_anonpay_invoice": "Trocador Anonpay請求書",
"trocador_anonpay_donation_link": "Trocador Anonpay寄付リンク",
"bitcoin_silent_payments": "ビットコインサイレント支払い",
"bitcoin_legacy": "ビットコインレガシー"
}

View file

@ -750,5 +750,10 @@
"seedtype_polyseed": "다문 (16 단어)",
"seed_language_czech": "체코 사람",
"seed_language_korean": "한국인",
"seed_language_chinese_traditional": "중국 전통)"
"seed_language_chinese_traditional": "중국 전통)",
"mainnet": "메인 넷",
"trocador_anonpay_invoice": "Trocador Anonpay 송장",
"trocador_anonpay_donation_link": "Trocador Anonpay 기부 링크",
"bitcoin_silent_payments": "비트 코인 사일런트 지불",
"bitcoin_legacy": "비트 코인 유산"
}

View file

@ -750,5 +750,10 @@
"seedtype_polyseed": "polyseed (စကားလုံး 16 လုံး)",
"seed_language_czech": "ချက်",
"seed_language_korean": "ကိုးရီးယား",
"seed_language_chinese_traditional": "တရုတ်ရိုးရာ)"
"seed_language_chinese_traditional": "တရုတ်ရိုးရာ)",
"mainnet": "မမက်မ",
"trocador_anonpay_invoice": "Trocador Anonpay ငွေတောင်းခံလွှာ",
"trocador_anonpay_donation_link": "Trocador Anonpay အလှူငွေလင့်ခ်",
"bitcoin_silent_payments": "Bitcoin အသံတိတ်ငွေပေးချေမှု",
"bitcoin_legacy": "Bitcoin အမွေ"
}

View file

@ -752,5 +752,10 @@
"seedtype_polyseed": "Polyseed (16 woorden)",
"seed_language_czech": "Tsjechisch",
"seed_language_korean": "Koreaans",
"seed_language_chinese_traditional": "Chinese (traditionele)"
"seed_language_chinese_traditional": "Chinese (traditionele)",
"mainnet": "Maimet",
"trocador_anonpay_invoice": "Trocador anonpay factuur",
"trocador_anonpay_donation_link": "Trocador anonpay donatielink",
"bitcoin_silent_payments": "Bitcoin stille betalingen",
"bitcoin_legacy": "Bitcoin Legacy"
}

View file

@ -752,5 +752,10 @@
"seedtype_polyseed": "Poliqueed (16 słów)",
"seed_language_czech": "Czech",
"seed_language_korean": "koreański",
"seed_language_chinese_traditional": "Chiński tradycyjny)"
"seed_language_chinese_traditional": "Chiński tradycyjny)",
"mainnet": "Mainnet",
"trocador_anonpay_invoice": "Trocador anonpay faktura",
"trocador_anonpay_donation_link": "Link darowizny Trocador Anonpay",
"bitcoin_silent_payments": "Bitcoin ciche płatności",
"bitcoin_legacy": "Dziedzictwo bitcoinowe"
}

View file

@ -751,5 +751,10 @@
"seedtype_polyseed": "Polyseed (16 palavras)",
"seed_language_czech": "Tcheco",
"seed_language_korean": "coreano",
"seed_language_chinese_traditional": "Chinês tradicional)"
"seed_language_chinese_traditional": "Chinês tradicional)",
"mainnet": "Mainnet",
"trocador_anonpay_invoice": "Fatura Trocador Anonpay",
"trocador_anonpay_donation_link": "Link de doação de Trocador Anonpay",
"bitcoin_silent_payments": "Bitcoin Pagamentos Silenciosos",
"bitcoin_legacy": "Bitcoin Legado"
}

View file

@ -752,5 +752,10 @@
"seedtype_polyseed": "Полиса (16 слов)",
"seed_language_czech": "Чешский",
"seed_language_korean": "Корейский",
"seed_language_chinese_traditional": "Китайский традиционный)"
"seed_language_chinese_traditional": "Китайский традиционный)",
"mainnet": "Mainnet",
"trocador_anonpay_invoice": "Трокадор Anonpay",
"trocador_anonpay_donation_link": "Ссылка пожертвования Trocador Anonpay",
"bitcoin_silent_payments": "Биткойн молчаливые платежи",
"bitcoin_legacy": "Биткойн наследие"
}

View file

@ -750,5 +750,10 @@
"seedtype_polyseed": "โพลีส (16 คำ)",
"seed_language_czech": "ภาษาเช็ก",
"seed_language_korean": "เกาหลี",
"seed_language_chinese_traditional": "จีน (ดั้งเดิม)"
"seed_language_chinese_traditional": "จีน (ดั้งเดิม)",
"mainnet": "หลัก",
"trocador_anonpay_invoice": "ใบแจ้งหนี้ Trocador Anonpay",
"trocador_anonpay_donation_link": "ลิงค์บริจาค Trocador Anonpay",
"bitcoin_silent_payments": "Bitcoin Silent Payments",
"bitcoin_legacy": "มรดก Bitcoin"
}

View file

@ -746,5 +746,10 @@
"seedtype_polyseed": "Polyseed (16 na salita)",
"seed_language_czech": "Czech",
"seed_language_korean": "Korean",
"seed_language_chinese_traditional": "Intsik (tradisyonal)"
"seed_language_chinese_traditional": "Intsik (tradisyonal)",
"mainnet": "Mainnet",
"trocador_anonpay_invoice": "Trocador Anonpay Invoice",
"trocador_anonpay_donation_link": "Trocador Anonpay Donation Link",
"bitcoin_silent_payments": "Bitcoin tahimik na pagbabayad",
"bitcoin_legacy": "Pamana ng Bitcoin"
}

View file

@ -750,5 +750,10 @@
"seedtype_polyseed": "Polyseed (16 kelime)",
"seed_language_czech": "Çek",
"seed_language_korean": "Koreli",
"seed_language_chinese_traditional": "Çin geleneği)"
"seed_language_chinese_traditional": "Çin geleneği)",
"mainnet": "Ana ağ",
"trocador_anonpay_invoice": "Trocador anonpay faturası",
"trocador_anonpay_donation_link": "Trocador anonpay bağış bağlantısı",
"bitcoin_silent_payments": "Bitcoin sessiz ödemeler",
"bitcoin_legacy": "Bitcoin Mirası"
}

View file

@ -752,5 +752,10 @@
"seedtype_polyseed": "Полісей (16 слів)",
"seed_language_czech": "Чеський",
"seed_language_korean": "Корейський",
"seed_language_chinese_traditional": "Китайський (традиційний)"
"seed_language_chinese_traditional": "Китайський (традиційний)",
"mainnet": "Мейннет",
"trocador_anonpay_invoice": "Рахунок -фактура Trocador Anonpay",
"trocador_anonpay_donation_link": "Посилання на пожертву Trocador Anonpay",
"bitcoin_silent_payments": "Біткойн мовчазні платежі",
"bitcoin_legacy": "Bitcoin Legacy"
}

View file

@ -744,5 +744,10 @@
"seedtype_polyseed": "پالیسیڈ (16 الفاظ)",
"seed_language_czech": "چیک",
"seed_language_korean": "کورین",
"seed_language_chinese_traditional": "چینی (روایتی)"
"seed_language_chinese_traditional": "چینی (روایتی)",
"mainnet": "مینیٹ",
"trocador_anonpay_invoice": "ٹروکاڈور انون پے انوائس",
"trocador_anonpay_donation_link": "ٹروکاڈور انونپے چندہ کا لنک",
"bitcoin_silent_payments": "بٹ کوائن خاموش ادائیگی",
"bitcoin_legacy": "بٹ کوائن میراث"
}

View file

@ -746,5 +746,10 @@
"seedtype_polyseed": "Polyseed (awọn ọrọ 16)",
"seed_language_czech": "Czech",
"seed_language_korean": "Ara ẹni",
"seed_language_chinese_traditional": "Kannada (ibile)"
"seed_language_chinese_traditional": "Kannada (ibile)",
"mainnet": "Akọkọ",
"trocador_anonpay_invoice": "Tragbar anonpaya risiti",
"trocador_anonpay_donation_link": "Ọna asopọ Ẹbun Anontay Anontay",
"bitcoin_silent_payments": "Awọn sisanwọle bitcoin",
"bitcoin_legacy": "Olokan Bitcoin"
}

View file

@ -751,5 +751,10 @@
"seedtype_polyseed": "多种物品16个单词",
"seed_language_czech": "捷克",
"seed_language_korean": "韩国人",
"seed_language_chinese_traditional": "中国传统的)"
"seed_language_chinese_traditional": "中国传统的)",
"mainnet": "主网",
"trocador_anonpay_invoice": "Trocador Anonpay发票",
"trocador_anonpay_donation_link": "trocador anonpay捐赠链接",
"bitcoin_silent_payments": "比特币无声付款",
"bitcoin_legacy": "比特币遗产"
}