From 87a6f444b31b1462b0eaededd38c933a292564a8 Mon Sep 17 00:00:00 2001 From: Hugo Trentesaux Date: Sat, 18 Jun 2022 01:50:06 +0200 Subject: [PATCH] translation 4 --- assets/translations/en.json | 52 +++++++++++++++-- assets/translations/fr.json | 49 +++++++++++++++- lib/providers/duniter_indexer.dart | 5 +- lib/providers/substrate_sdk.dart | 8 +-- lib/screens/activity.dart | 72 ++++++++++++------------ lib/screens/home.dart | 8 +-- lib/screens/search_result.dart | 9 +-- lib/screens/settings.dart | 6 +- lib/screens/substrate_sandbox.dart | 18 +++--- lib/screens/transaction_in_progress.dart | 34 +++++------ lib/screens/wallet_view.dart | 23 ++++---- 11 files changed, 187 insertions(+), 97 deletions(-) diff --git a/assets/translations/en.json b/assets/translations/en.json index c99bfa2..8b53278 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -102,9 +102,51 @@ "identityCreated": "Identity created", "identityConfirmed": "Identity confirmed", "identityExpired": "Identity expired", - "confirmYourIdentity": "Confirm your identity" - - - - + "confirmYourIdentity": "Confirm your identity", + "noDuniterNodeAvailableTryLater": "No Duniter node available, please try again later", + "youAreConnectedToNode": "You are connected to node", + "accountActivity": "Account activity", + "noNetworkNoHistory": "Network state does not allow\nto display account history", + "noDataToDisplay": "No data to be displayed.", + "noTranscationToDisplay": "No transaction to display", + "month1": "January", + "month2": "February", + "month3": "March", + "month4": "April", + "month5": "May", + "month6": "June", + "month7": "July", + "month8": "August", + "month9": "September", + "month10": "October", + "month11": "November", + "month12": "December", + "today": "Today", + "yesterday": "Yesterday", + "thisWeek": "This week", + "chestNotCompatibleMustReinstallGecko": "The version of your safes is no longer compatible with this version of Ğecko.\nAll your safes will be forgotten, you must import them again.", + "notConnectedToInternet": "You are note connected to internet", + "researchResults": "Results of your research", + "resultsFor": "Results for ", + "forgetAllMyChests": "Forget all my chests", + "transaction": "Transaction", + "certification": "Certification", + "identityConfirm": "Identity confirmation", + "revokeAdhesion": "Adhesion revocation", + "strangeTransaction": "Strange transaction", + "sending": "Sending...", + "propagating": "Propagating...", + "validating": "Validating...", + "anErrorOccured": "An error occured", + "24hbetweenCerts": "You have to wait 24h between certs", + "canNotCertifySelf": "You can not certify yourself", + "nameAlreadyExist": "This name is already taken", + "2GDtoKeepAlive": "You have to keep at least 2ĞD to keep your account alive", + "youHaveToFeedThisAccountBeforeUsing": "You have to feed this account\nbefore using it.", + "execTimeoutOver": "Execution timeout is over", + "seeAWallet": "See a wallet", + "mustWaitXBeforeCertify": "You have to wait\n{} before\ncertifying again", + "canRenewCertInX": "You can renew\nthis certification\nin {}", + "executeATransfer": "Execute a transfer", + "executeTheTransfer": "Execute the transfer" } \ No newline at end of file diff --git a/assets/translations/fr.json b/assets/translations/fr.json index e415823..a7055ea 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -102,5 +102,52 @@ "identityCreated": "Identité créée", "identityConfirmed": "Identité confirmée", "identityExpired": "Identité expirée", - "confirmYourIdentity": "Confirmez votre identité" + "confirmYourIdentity": "Confirmez votre identité", + "noResult": "Aucun résultat", + "noDuniterNodeAvailableTryLater": "Aucun noeud Duniter disponible, veuillez réessayer ultérieurement", + "youAreConnectedToNode": "Vous êtes connecté au noeud", + "accountActivity": "Activité du compte", + "noNetworkNoHistory": "L'état du réseau ne permet pas\nd'afficher l'historique du compte", + "noDataToDisplay": "Aucune donnée à afficher.", + "noTranscationToDisplay": "Aucune transaction à afficher", + "month1": "Janvier", + "month2": "Février", + "month3": "Mars", + "month4": "Avril", + "month5": "Mai", + "month6": "Juin", + "month7": "Juillet", + "month8": "Aout", + "month9": "Septembre", + "month10": "Octobre", + "month11": "Novembre", + "month12": "Décembre", + "today": "Aujourd'hui", + "yesterday": "Hier", + "thisWeek": "Cette semaine", + "chestNotCompatibleMustReinstallGecko": "La version de vos coffres n'est plus comptabile avec cette version de Ğecko.\nTous vos coffres vont être oubliés, vous devez les importer de nouveau.", + "notConnectedToInternet": "Vous n'êtes pas connecté à internet", + "researchResults": "Résultats de votre recherche", + "resultsFor": "Résultats pour ", + "forgetAllMyChests": "Oublier tous mes coffres", + "transaction": "Transaction", + "certification": "Certification", + "identityConfirm": "Confirmation d'identité", + "revokeAdhesion": "Révocation d'adhésion", + "strangeTransaction": "Transaction étrange", + "sending": "Envoi en cours...", + "propagating": "En cours de propagation...", + "validating": "En cours de validation...", + "anErrorOccured": "Une erreur s'est produite", + "24hbetweenCerts": "Vous devez attendre 24h entre chaque certification", + "canNotCertifySelf": "Vous ne pouvez pas vous certifier\nvous même ...", + "nameAlreadyExist": "Ce nom est déjà pris", + "2GDtoKeepAlive": "Vous devez garder au moins 2ĞD sur votre compte pour le garder actif", + "youHaveToFeedThisAccountBeforeUsing": "Vous devez alimenter ce compte avant\nde pouvoir l'utiliser", + "execTimeoutOver": "Le délais d'éxecution est dépassé", + "seeAWallet": "Voir un portefeuille", + "mustWaitXBeforeCertify": "Vous devez attendre\n{} avant\nde pouvoir certifier", + "canRenewCertInX": "Vous pourrez renouveller\ncette certification\ndans {}", + "executeATransfer": "Effectuer un virement", + "executeTheTransfer": "Effectuer le virement" } \ No newline at end of file diff --git a/lib/providers/duniter_indexer.dart b/lib/providers/duniter_indexer.dart index 4a5a501..c2d5620 100644 --- a/lib/providers/duniter_indexer.dart +++ b/lib/providers/duniter_indexer.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:convert'; import 'dart:io'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:gecko/globals.dart'; @@ -229,13 +230,13 @@ class DuniterIndexer with ChangeNotifier { } if (result.isLoading) { - return const Text('Loading'); + return Text('loading'.tr()); } final List identities = result.data?['search_identity'] ?? []; if (identities.isEmpty) { - return const Text('Aucun résultat'); + return Text('noResult'.tr()); } int keyID = 0; diff --git a/lib/providers/substrate_sdk.dart b/lib/providers/substrate_sdk.dart index fbe3347..e64b45a 100644 --- a/lib/providers/substrate_sdk.dart +++ b/lib/providers/substrate_sdk.dart @@ -758,13 +758,13 @@ class AddressInfo { void snackNode(BuildContext context, bool isConnected) { String _message; if (!isConnected) { - _message = - "Aucun noeud Duniter disponible, veuillez réessayer ultérieurement:\n${configBox.get('endpoint').first}"; + _message = "noDuniterNodeAvailableTryLater".tr() + + ":\n${configBox.get('endpoint').first}"; } else { SubstrateSdk _sub = Provider.of(context, listen: false); - _message = - "Vous êtes connecté au noeud\n${_sub.getConnectedEndpoint()!.split('//')[1]}"; + _message = "youAreConnectedToNode".tr() + + "\n${_sub.getConnectedEndpoint()!.split('//')[1]}"; } final snackBar = SnackBar( padding: const EdgeInsets.all(20), diff --git a/lib/screens/activity.dart b/lib/screens/activity.dart index 18017cf..ff682f9 100644 --- a/lib/screens/activity.dart +++ b/lib/screens/activity.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/services.dart'; import 'package:gecko/globals.dart'; import 'package:gecko/models/queries_indexer.dart'; @@ -9,7 +10,6 @@ import 'package:gecko/providers/wallets_profiles.dart'; import 'package:flutter/material.dart'; import 'package:gecko/screens/wallet_view.dart'; import 'package:graphql_flutter/graphql_flutter.dart'; -import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; // ignore: must_be_immutable @@ -40,9 +40,9 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier { appBar: AppBar( elevation: 0, toolbarHeight: 60 * ratio, - title: const SizedBox( + title: SizedBox( height: 22, - child: Text('Activité du compte'), + child: Text('accountActivity'.tr()), ), ), bottomNavigationBar: _homeProvider.bottomAppBar(context), @@ -57,12 +57,12 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier { Provider.of(context, listen: false); if (indexerEndpoint == '') { - Column(children: const [ - SizedBox(height: 50), + Column(children: [ + const SizedBox(height: 50), Text( - "L'état du réseau ne permet pas\nd'afficher l'historique du compte", + "noNetworkNoHistory".tr(), textAlign: TextAlign.center, - style: TextStyle(fontSize: 18), + style: const TextStyle(fontSize: 18), ) ]); } @@ -103,20 +103,20 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier { if (result.hasException) { log.e('Error Indexer: ' + result.exception.toString()); - return Column(children: const [ - SizedBox(height: 50), + return Column(children: [ + const SizedBox(height: 50), Text( - "L'état du réseau ne permet pas\nd'afficher l'historique du compte", + "noNetworkNoHistory".tr(), textAlign: TextAlign.center, - style: TextStyle(fontSize: 18), + style: const TextStyle(fontSize: 18), ) ]); } else if (result.data == null) { - return Column(children: const [ - SizedBox(height: 50), + return Column(children: [ + const SizedBox(height: 50), Text( - "Aucune donnée à afficher.", - style: TextStyle(fontSize: 18), + "noDataToDisplay".tr(), + style: const TextStyle(fontSize: 18), ) ]); } @@ -159,11 +159,11 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier { Provider.of(context, listen: false); return _duniterIndexer.transBC == null - ? Column(children: const [ - SizedBox(height: 50), + ? Column(children: [ + const SizedBox(height: 50), Text( - "Aucune transaction à afficher.", - style: TextStyle(fontSize: 18), + "noTransactionToDisplay".tr(), + style: const TextStyle(fontSize: 18), ) ]) : Column(children: [ @@ -202,19 +202,19 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier { bool isYesterday = false; bool isThisWeek = false; - const Map monthsInYear = { - 1: "Janvier", - 2: "Février", - 3: "Mars", - 4: "Avril", - 5: "Mai", - 6: "Juin", - 7: "Juillet", - 8: "Aout", - 9: "Septembre", - 10: "Octobre", - 11: "Novembre", - 12: "Décembre" + final Map monthsInYear = { + 1: "month1".tr(), + 2: "month2".tr(), + 3: "month3".tr(), + 4: "month4".tr(), + 5: "month5".tr(), + 6: "month6".tr(), + 7: "month7".tr(), + 8: "month8".tr(), + 9: "month9".tr(), + 10: "month10".tr(), + 11: "month11".tr(), + 12: "month12".tr() }; return Column( @@ -243,18 +243,18 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier { final yesterdayDate = DateTime(now.year, now.month, now.day - 1); if (transactionDate == todayDate && !isTody) { - dateDelimiter = lastDateDelimiter = "Aujourd'hui"; + dateDelimiter = lastDateDelimiter = "today".tr(); isTody = true; } else if (transactionDate == yesterdayDate && !isYesterday) { - dateDelimiter = lastDateDelimiter = "Hier"; + dateDelimiter = lastDateDelimiter = "yesterday".tr(); isYesterday = true; } else if (weekNumber(date) == weekNumber(now) && date.year == now.year && - lastDateDelimiter != "Cette semaine" && + lastDateDelimiter != "thisWeek".tr() && transactionDate != yesterdayDate && transactionDate != todayDate && !isThisWeek) { - dateDelimiter = lastDateDelimiter = "Cette semaine"; + dateDelimiter = lastDateDelimiter = "thisWeek".tr(); isThisWeek = true; } else if (lastDateDelimiter != monthsInYear[date.month] && lastDateDelimiter != "${monthsInYear[date.month]} ${date.year}" && diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 7a7ad59..58468b3 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -112,8 +112,8 @@ class HomeScreen extends StatelessWidget { // Check if versionData non compatible, drop everything if (walletBox.isNotEmpty && walletBox.getAt(0)!.version! < dataVersion) { - await infoPopup(context, - "La version de vos coffres n'est plus comptabile avec cette version de Ğecko.\nTous vos coffres vont être oubliés, vous devez les importer de nouveau."); + await infoPopup( + context, "chestNotCompatibleMustReinstallGecko".tr()); await walletBox.clear(); await chestBox.clear(); await configBox.delete('defaultWallet'); @@ -128,7 +128,7 @@ class HomeScreen extends StatelessWidget { if (connectivityResult != ConnectivityResult.mobile && connectivityResult != ConnectivityResult.wifi) { _homeProvider.changeMessage( - "Vous n'êtes pas connecté à internet", 0); + "notConnectedToInternet".tr(), 0); _sub.nodeConnected = false; } @@ -140,7 +140,7 @@ class HomeScreen extends StatelessWidget { _sub.nodeConnected = false; await _sub.sdk.api.setting.unsubscribeBestNumber(); _homeProvider.changeMessage( - "Vous n'êtes pas connecté à internet", 0); + "notConnectedToInternet".tr(), 0); _sub.reload(); } else { await _sub.connectNode(ctx); diff --git a/lib/screens/search_result.dart b/lib/screens/search_result.dart index 9542946..3f206e1 100644 --- a/lib/screens/search_result.dart +++ b/lib/screens/search_result.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'; @@ -38,9 +39,9 @@ class SearchResultScreen extends StatelessWidget { appBar: AppBar( elevation: 1, toolbarHeight: 60 * ratio, - title: const SizedBox( + title: SizedBox( height: 22, - child: Text('Résultats de votre recherche'), + child: Text('researchResults'.tr()), ), ), bottomNavigationBar: _homeProvider.bottomAppBar(context), @@ -59,8 +60,8 @@ class SearchResultScreen extends StatelessWidget { color: Colors.grey[700], ), children: [ - const TextSpan( - text: "Résultats pour ", + TextSpan( + text: "resultsFor".tr(), ), TextSpan( text: '"${_searchProvider.searchController.text}"', diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 4fb67cb..0873692 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -98,9 +98,9 @@ class SettingsScreen extends StatelessWidget { log.i('Oublier tous mes coffres'); await _myWallets.deleteAllWallet(context); }, - child: const Text( - 'Oublier tous mes coffres', - style: TextStyle( + child: Text( + 'forgetAllMyChests'.tr(), + style: const TextStyle( fontSize: fontSize + 4, color: Color(0xffD80000), fontWeight: FontWeight.w600, diff --git a/lib/screens/substrate_sandbox.dart b/lib/screens/substrate_sandbox.dart index a62fdfc..0c3ed95 100644 --- a/lib/screens/substrate_sandbox.dart +++ b/lib/screens/substrate_sandbox.dart @@ -21,7 +21,7 @@ class SubstrateSandBox extends StatelessWidget { toolbarHeight: 60 * ratio, title: const SizedBox( height: 22, - child: Text('Substrate Sandbox'), + child: Text('⏳ Substrate Sandbox'), ), ), body: SafeArea( @@ -36,12 +36,12 @@ class SubstrateSandBox extends StatelessWidget { await _sub.connectNode(context); }, child: Text( - 'Noeud connecté ?: ${_sub.nodeConnected} (${_sub.sdk.api.connectedNode?.endpoint})')), + '🌐 Noeud connecté ?: ${_sub.nodeConnected} (${_sub.sdk.api.connectedNode?.endpoint})')), if (_sub.nodeConnected) - Text('Noeud "$currencyName", bloc N°${_sub.blocNumber}'), + Text('🏆 Noeud "$currencyName", bloc N°${_sub.blocNumber}'), const SizedBox(height: 20), Row(children: [ - const Text('Liste des coffres:'), + const Text('💳 Liste des coffres:'), const Spacer(), InkWell( child: Image.asset( @@ -93,13 +93,13 @@ class SubstrateSandBox extends StatelessWidget { addressInfo.address!, 2, _sub.keystorePassword.text), - child: const Text("Dériver"), + child: const Text("🏂 Dériver"), ) ]) ]); }), const SizedBox(height: 20), - const Text('Mot de passe du coffre:'), + const Text('🔒 Mot de passe du coffre:'), TextField( controller: _sub.keystorePassword, obscureText: true, @@ -130,7 +130,7 @@ class SubstrateSandBox extends StatelessWidget { } : null, child: const Text( - 'Importer depuis le presse-papier', + '📎 Importer depuis le presse-papier', style: TextStyle(fontSize: 20), ), ), @@ -149,7 +149,7 @@ class SubstrateSandBox extends StatelessWidget { snack(context, 'Le mnemonic a été copié'); }, child: const Text( - "Générer un mnemonic et le copier", + "🏦 Générer un mnemonic et le copier", style: TextStyle(fontSize: 20), ), ), @@ -161,7 +161,7 @@ class SubstrateSandBox extends StatelessWidget { textAlign: TextAlign.center, ), ), - const Text('--------'), + const Text('-〰️---〰️---〰️-'), const SizedBox(height: 10), Text(_sub.debugConnection) ]) diff --git a/lib/screens/transaction_in_progress.dart b/lib/screens/transaction_in_progress.dart index b6c1e48..1e89c60 100644 --- a/lib/screens/transaction_in_progress.dart +++ b/lib/screens/transaction_in_progress.dart @@ -40,44 +40,44 @@ class TransactionInProgress extends StatelessWidget { switch (transType) { case 'pay': { - _actionName = 'Transaction'; + _actionName = 'transaction'.tr(); } break; case 'cert': { - _actionName = 'Certification'; + _actionName = 'certification'.tr(); } break; case 'comfirmIdty': { - _actionName = "Confirmation d'identité"; + _actionName = "identityConfirm".tr(); } break; case 'revokeIdty': { - _actionName = "Révocation d'adhésion"; + _actionName = "revokeAdhesion".tr(); } break; default: { - _actionName = 'Transaction étrange'; + _actionName = 'strangeTransaction'.tr(); } } switch (_result) { case '': { - _resultText = 'Envoi en cours ...'; + _resultText = 'sending'.tr(); } break; case 'Ready': { - _resultText = 'En cours de propagation...'; + _resultText = 'propagating'.tr(); } break; case 'Broadcast': { - _resultText = 'En cours de validation ...'; + _resultText = 'validating'.tr(); } break; default: @@ -90,7 +90,7 @@ class TransactionInProgress extends StatelessWidget { _resultText = '$_actionName validé !'; } else { isValid = false; - _resultText = "Une erreur s'est produite:\n"; + _resultText = "anErrorOccured".tr() + ":\n"; final List _exceptionSplit = _result.split('Exception: '); String _exception; if (_exceptionSplit.length > 1) { @@ -103,37 +103,33 @@ class TransactionInProgress extends StatelessWidget { case 'cert.NotRespectCertPeriod': case 'identity.CreatorNotAllowedToCreateIdty': { - _resultText = - "Vous devez attendre 24h entre chaque certification"; + _resultText = "24hbetweenCerts".tr(); } break; case 'cert.CannotCertifySelf': { - _resultText = - "Vous ne pouvez pas vous certifier\nvous même ..."; + _resultText = "canNotCertifySelf".tr(); } break; case 'identity.IdtyNameAlreadyExist': { - _resultText = "Ce nom est déjà pris"; + _resultText = "nameAlreadyExist".tr(); } break; case 'balances.KeepAlive': { - _resultText = - "Vous devez garder au moins 2ĞD sur votre compte pour le garder actif"; + _resultText = "2GDtoKeepAlive".tr(); } break; case '1010: Invalid Transaction: Inability to pay some fees , e.g. account balance too low': { - _resultText = - "Vous devez alimenter ce compte avant\nde pouvoir l'utiliser"; + _resultText = "youHaveToFeedThisAccountBeforeUsing".tr(); } break; case 'timeout': { - _resultText += "Le délais d'éxecution est dépassé"; + _resultText += "execTimeoutOver".tr(); } break; default: diff --git a/lib/screens/wallet_view.dart b/lib/screens/wallet_view.dart index 2c9cfe0..c3eec23 100644 --- a/lib/screens/wallet_view.dart +++ b/lib/screens/wallet_view.dart @@ -70,9 +70,9 @@ class WalletViewScreen extends StatelessWidget { ), ), ], - title: const SizedBox( + title: SizedBox( height: 22, - child: Text('Voir un portefeuille'), + child: Text('seeAWallet'.tr()), ), ), bottomNavigationBar: _homeProvider.bottomAppBar(context), @@ -137,6 +137,7 @@ class WalletViewScreen extends StatelessWidget { final int _seconds = _durationSeconds.inSeconds; final int _minutes = _durationSeconds.inMinutes; + // TODO translate timing if (_seconds <= 0) { _duration = '0 secondes'; } else if (_seconds <= 60) { @@ -260,7 +261,8 @@ class WalletViewScreen extends StatelessWidget { ), ), Text( - "Vous devez attendre\n$_duration avant\nde pouvoir certifier", + "mustWaitXBeforeCertify" + .tr(args: [_duration.toString()]), textAlign: TextAlign.center, style: TextStyle( fontSize: buttonFontSize - 4, @@ -290,7 +292,8 @@ class WalletViewScreen extends StatelessWidget { ), ), Text( - "Vous pourrez renouveller\ncette certification\ndans $_duration", + "canRenewCertInX" + .tr(args: [_duration.toString()]), textAlign: TextAlign.center, style: TextStyle( fontSize: buttonFontSize - 4, @@ -471,9 +474,9 @@ class WalletViewScreen extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - const Text( - 'Effectuer un virement', - style: TextStyle( + Text( + 'executeATransfer'.tr(), + style: const TextStyle( fontSize: 26, fontWeight: FontWeight.w700), ), IconButton( @@ -681,9 +684,9 @@ class WalletViewScreen extends StatelessWidget { } } : null, - child: const Text( - 'Effectuer le virement', - style: TextStyle( + child: Text( + 'executeTheTransfer'.tr(), + style: const TextStyle( fontSize: 20, fontWeight: FontWeight.w600), ), ),