From e71e00c995700e60addd95b04c5f42b1b0e70cd9 Mon Sep 17 00:00:00 2001 From: poka Date: Sat, 18 Jun 2022 03:01:22 +0200 Subject: [PATCH] App is fully translate en/fr ! --- assets/translations/en.json | 22 +++++++++- assets/translations/fr.json | 22 +++++++++- lib/providers/wallet_options.dart | 2 +- lib/screens/myWallets/choose_wallet.dart | 4 +- lib/screens/myWallets/wallet_options.dart | 6 +-- lib/screens/search.dart | 12 ++--- lib/screens/search_result.dart | 2 +- lib/screens/settings.dart | 3 +- lib/screens/transaction_in_progress.dart | 18 ++++---- lib/screens/wallet_view.dart | 53 +++++++---------------- 10 files changed, 84 insertions(+), 60 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index 8b53278..478705a 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -40,6 +40,7 @@ "thisWalletIsDefault": "This wallet is the default one", "defineWalletAsDefault": "Define this as the default one", "displayActivity": "Display activity", + "displayNActivity": "Display\nactivity", "memberValidated": "Validated member!", "copyAddress": "Copy\naddress", "copy": "Copy", @@ -148,5 +149,24 @@ "mustWaitXBeforeCertify": "You have to wait\n{} before\ncertifying again", "canRenewCertInX": "You can renew\nthis certification\nin {}", "executeATransfer": "Execute a transfer", - "executeTheTransfer": "Execute the transfer" + "executeTheTransfer": "Execute the transfer", + "doATransfer" : "Execute a\ntransfer", + "seconds": "{} seconds", + "minutes": "{} minutes", + "hours": "{} hours {}", + "days": "{} days", + "months": "{} months", + "certify": "Certify", + "from": "From:", + "amount": "Amount:", + "choiceOfSourceWallet": "Choose a source wallet", + "extrinsicInProgress": "{} in progress", + "extrinsicValidated": "{} validated !", + "fromMinus": "from", + "toMinus": "to", + "deleteThisWallet": "Delete this wallet", + "cancel": "Cancel", + "inBlockchainResult": "In {} blockchain", + "search": "Search", + "currencyNode": "{} node :" } \ No newline at end of file diff --git a/assets/translations/fr.json b/assets/translations/fr.json index a7055ea..98b185b 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -40,6 +40,7 @@ "thisWalletIsDefault": "Ce portefeuille est celui par defaut", "defineWalletAsDefault": "Définir comme portefeuille par défaut", "displayActivity": "Voir l'activité", + "displayNActivity": "Voir\nl'activité", "memberValidated": "Membre validé !", "copyAddress": "Copier\nl'adresse", "copy": "Copier", @@ -149,5 +150,24 @@ "mustWaitXBeforeCertify": "Vous devez attendre\n{} avant\nde pouvoir certifier", "canRenewCertInX": "Vous pourrez renouveller\ncette certification\ndans {}", "executeATransfer": "Effectuer un virement", - "executeTheTransfer": "Effectuer le virement" + "executeTheTransfer": "Effectuer le virement", + "doATransfer": "Faire un\nvirement", + "seconds": "{} secondes", + "minutes": "{} minutes", + "hours": "{} heures {}", + "days": "{} jours", + "months": "{} mois", + "certify": "Certifier", + "from": "Depuis:", + "amount": "Montant:", + "choiceOfSourceWallet": "Choix du portefeuille source", + "extrinsicInProgress": "{} en cours", + "extrinsicValidated": "{} validé !", + "fromMinus": "de", + "toMinus": "vers", + "deleteThisWallet": "Supprimer ce portefeuille", + "cancel": "Annuler", + "inBlockchainResult": "Dans la blockchain {}", + "search": "Rechercher", + "currencyNode": "Noeud {} :" } \ No newline at end of file diff --git a/lib/providers/wallet_options.dart b/lib/providers/wallet_options.dart index e9c923a..55143bb 100644 --- a/lib/providers/wallet_options.dart +++ b/lib/providers/wallet_options.dart @@ -378,7 +378,7 @@ class WalletOptionsProvider with ChangeNotifier { TextButton( key: const Key('cancel'), child: Text( - "Annuler", + "cancel".tr(), style: TextStyle( fontSize: 18, color: Colors.grey[800], diff --git a/lib/screens/myWallets/choose_wallet.dart b/lib/screens/myWallets/choose_wallet.dart index b1f054b..f54d6d8 100644 --- a/lib/screens/myWallets/choose_wallet.dart +++ b/lib/screens/myWallets/choose_wallet.dart @@ -29,9 +29,9 @@ class ChooseWalletScreen extends StatelessWidget { backgroundColor: backgroundColor, appBar: AppBar( toolbarHeight: 60 * ratio, - title: const SizedBox( + title: SizedBox( height: 22, - child: Text('Choix du portefeuille source'), + child: Text('choiceOfSourceWallet'.tr()), )), body: SafeArea( child: Stack(children: [ diff --git a/lib/screens/myWallets/wallet_options.dart b/lib/screens/myWallets/wallet_options.dart index 75509f2..15551af 100644 --- a/lib/screens/myWallets/wallet_options.dart +++ b/lib/screens/myWallets/wallet_options.dart @@ -490,9 +490,9 @@ class WalletOptions extends StatelessWidget { height: 45, ), const SizedBox(width: 19), - const Text('Supprimer ce portefeuille', - style: - TextStyle(fontSize: 20, color: Color(0xffD80000))), + Text('deleteThisWallet'.tr(), + style: const TextStyle( + fontSize: 20, color: Color(0xffD80000))), ]) : const SizedBox(width: 30), ); diff --git a/lib/screens/search.dart b/lib/screens/search.dart index 8560503..be13c68 100644 --- a/lib/screens/search.dart +++ b/lib/screens/search.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/services.dart'; import 'package:gecko/globals.dart'; import 'package:flutter/material.dart'; @@ -31,9 +32,9 @@ class SearchScreen extends StatelessWidget { appBar: AppBar( elevation: 1, toolbarHeight: 60 * ratio, - title: const SizedBox( + title: SizedBox( height: 22, - child: Text('Rechercher'), + child: Text('search'.tr()), ), leading: IconButton( icon: const Icon(Icons.arrow_back, color: Colors.black), @@ -105,9 +106,10 @@ class SearchScreen extends StatelessWidget { ); } : null, - child: const Text( - 'Rechercher', - style: TextStyle(fontSize: 24, fontWeight: FontWeight.w600), + child: Text( + 'search'.tr(), + style: const TextStyle( + fontSize: 24, fontWeight: FontWeight.w600), ), ), ), diff --git a/lib/screens/search_result.dart b/lib/screens/search_result.dart index 3f206e1..3f4978b 100644 --- a/lib/screens/search_result.dart +++ b/lib/screens/search_result.dart @@ -72,7 +72,7 @@ class SearchResultScreen extends StatelessWidget { ), const SizedBox(height: 40), Text( - 'Dans la blockchain $currencyName', + 'inBlockchainResult'.tr(args: [currencyName]), style: const TextStyle(fontSize: 20), ), const SizedBox(height: 20), diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 0873692..bc0b488 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -53,7 +53,8 @@ class SettingsScreen extends StatelessWidget { log.d(_sub.sdk.api.connectedNode?.endpoint); return Expanded( child: Row(children: [ - Text(' Noeud $currencyName :'), + const SizedBox(width: 10), + Text('currencyNode'.tr(args: [currencyName])), const Spacer(), Icon(_sub.nodeConnected && !_sub.isLoadingEndpoint ? Icons.check diff --git a/lib/screens/transaction_in_progress.dart b/lib/screens/transaction_in_progress.dart index 1e89c60..732595b 100644 --- a/lib/screens/transaction_in_progress.dart +++ b/lib/screens/transaction_in_progress.dart @@ -87,7 +87,7 @@ class TransactionInProgress extends StatelessWidget { log.d(_result); if (_result.contains('blockHash: ')) { isValid = true; - _resultText = '$_actionName validé !'; + _resultText = 'extrinsicValidated'.tr(args: [_actionName]); } else { isValid = false; _resultText = "anErrorOccured".tr() + ":\n"; @@ -159,7 +159,9 @@ class TransactionInProgress extends StatelessWidget { height: 22, child: Row( mainAxisAlignment: MainAxisAlignment.center, - children: [Text('$_actionName en cours')]), + children: [ + Text('extrinsicInProgress'.tr(args: [_actionName])) + ]), )), body: SafeArea( child: Align( @@ -186,10 +188,10 @@ class TransactionInProgress extends StatelessWidget { fontSize: 18, fontWeight: FontWeight.w600), ), if (transType == 'pay') const SizedBox(height: 10), - const Text( - 'de', + Text( + 'fromMinus'.tr(), textAlign: TextAlign.center, - style: TextStyle(fontSize: 18), + style: const TextStyle(fontSize: 18), ), Text( from, @@ -198,10 +200,10 @@ class TransactionInProgress extends StatelessWidget { fontSize: 18, fontWeight: FontWeight.w600), ), const SizedBox(height: 10), - const Text( - 'vers', + Text( + 'toMinus'.tr(), textAlign: TextAlign.center, - style: TextStyle(fontSize: 18), + style: const TextStyle(fontSize: 18), ), Text( to, diff --git a/lib/screens/wallet_view.dart b/lib/screens/wallet_view.dart index c3eec23..9cb9108 100644 --- a/lib/screens/wallet_view.dart +++ b/lib/screens/wallet_view.dart @@ -113,7 +113,7 @@ class WalletViewScreen extends StatelessWidget { ), const SizedBox(height: 9), Text( - "Voir\nl'activité", + "displayNActivity".tr(), textAlign: TextAlign.center, style: TextStyle( fontSize: buttonFontSize, fontWeight: FontWeight.w500), @@ -139,32 +139,34 @@ class WalletViewScreen extends StatelessWidget { // TODO translate timing if (_seconds <= 0) { - _duration = '0 secondes'; + _duration = 'seconds'.tr(args: ['0']); } else if (_seconds <= 60) { - _duration = '$_seconds secondes'; + _duration = 'seconds'.tr(args: [_seconds.toString()]); } else if (_seconds <= 3600) { - _duration = '$_minutes minutes'; + _duration = 'minutes'.tr(args: [_minutes.toString()]); } else if (_seconds <= 86400) { final int _hours = _durationSeconds.inHours; final int _minutesLeft = _minutes - _hours * 60; String _showMinutes = ''; if (_minutesLeft < 60) {} - _showMinutes = ' $_minutesLeft minutes'; - _duration = '$_hours heures$_showMinutes'; + _showMinutes = + 'minutes'.tr(args: [_minutesLeft.toString()]); + _duration = + 'hours'.tr(args: [_hours.toString(), _showMinutes]); } else if (_seconds <= 2592000) { final int _days = _durationSeconds.inDays; - _duration = '$_days jours'; + _duration = 'days'.tr(args: [_days.toString()]); } else { final int _months = (_durationSeconds.inDays / 30).round(); - _duration = '$_months mois'; + _duration = 'months'.tr(args: [_months.toString()]); } } return Visibility( visible: (snapshot.data != {}), child: Column(children: [ if (snapshot.data!['canCert'] != null || - _duration == '0 secondes') + _duration == 'seconds'.tr(args: ['0'])) Column(children: [ SizedBox( height: buttonSize, @@ -233,7 +235,7 @@ class WalletViewScreen extends StatelessWidget { ), const SizedBox(height: 9), Text( - "Certifier", + "certify".tr(), textAlign: TextAlign.center, style: TextStyle( fontSize: buttonFontSize, @@ -271,7 +273,7 @@ class WalletViewScreen extends StatelessWidget { ), ]), if (snapshot.data!['certRenewable'] != null && - _duration != '0 secondes') + _duration != 'seconds'.tr(args: ['0'])) Column(children: [ SizedBox( height: buttonSize, @@ -336,29 +338,6 @@ class WalletViewScreen extends StatelessWidget { ), ]), ]), - // FutureBuilder( - // future: _walletOptions.generateQRcode(_historyProvider.pubkey), - // builder: (context, snapshot) { - // return snapshot.data != null - // ? GestureDetector( - // key: const Key('openQrcode'), - // onTap: () { - // Navigator.push( - // context, - // MaterialPageRoute(builder: (context) { - // return AvatarFullscreen( - // Image.memory(snapshot.data), - // title: 'QrCode du profil', - // color: Colors.white, - // ); - // }), - // ); - // }, - // child: Image.memory(snapshot.data, height: 60 * ratio), - // ) - // : const Text('-', style: TextStyle(fontSize: 20)); - // }, - // ), const Spacer(), Consumer(builder: (context, _sub, _) { return Opacity( @@ -397,7 +376,7 @@ class WalletViewScreen extends StatelessWidget { const SizedBox(height: 9), Consumer(builder: (context, _sub, _) { return Text( - "Faire un\nvirement", + 'doATransfer'.tr(), textAlign: TextAlign.center, style: TextStyle( color: _sub.nodeConnected ? Colors.black : Colors.grey[500], @@ -489,7 +468,7 @@ class WalletViewScreen extends StatelessWidget { ]), const SizedBox(height: 20), Text( - 'Depuis:', + 'from'.tr(), style: TextStyle( fontSize: 19, fontWeight: FontWeight.w500, @@ -579,7 +558,7 @@ class WalletViewScreen extends StatelessWidget { // const SizedBox(height: 10), Text( - 'Montant:', + 'amount'.tr(), style: TextStyle( fontSize: 19, fontWeight: FontWeight.w500,