From d6e4046c8f1aa0c26606435ff9bdd883b6b9df78 Mon Sep 17 00:00:00 2001 From: Guyot Date: Thu, 30 Apr 2020 23:33:25 +0200 Subject: [PATCH] Traduction de chaines en anglais --- locale/fr/LC_MESSAGES/base.po | 24 ++++++++++++++ weight-cli.py | 61 +++++++++++++++++------------------ 2 files changed, 54 insertions(+), 31 deletions(-) diff --git a/locale/fr/LC_MESSAGES/base.po b/locale/fr/LC_MESSAGES/base.po index e67f874..0724c67 100644 --- a/locale/fr/LC_MESSAGES/base.po +++ b/locale/fr/LC_MESSAGES/base.po @@ -55,3 +55,27 @@ msgstr "trace le graphe : optionnel" msgid "optional : undo remove the last line removed" msgstr "annule la suppression de la dernière ligne effacée : optionnel" + +msgid "Your measure has been recorded : " +msgstr "Votre mesure a été enregistrée : " + +msgid "-your weight : {weight} kg" +msgstr "-votre poids : {weight} kg" + +msgid "-its type : {typ}" +msgstr "-son type : {typ}" + +msgid "-the date : {dat}" +msgstr "-la date : {dat}" + +msgid "-the metric : {metric}" +msgstr "-la métrique : {metric}" + +msgid "-the identifier : {ide}" +msgstr "-l'identifiant : {ide}" + +msgid "-your comment : {comment}" +msgstr "-votre commentaire : {comment}" + +msgid "-other : {other}" +msgstr "-autre : {other}" diff --git a/weight-cli.py b/weight-cli.py index 7bf2508..20e163e 100644 --- a/weight-cli.py +++ b/weight-cli.py @@ -40,18 +40,18 @@ _ = en.gettext # english # Voir : https://medium.com/i18n-and-l10n-resources-for-developers/how-to-translate-python-applications-with-the-gnu-gettext-module-5c1c085041 """ -Une mesure est caractérisée par : - - sa valeur - - son type - - sa date - - sa métrique - - son identifiant - - un commentaire - - autre +A measurement is characterized by : + - its value + - its type + - its date + - its metrics + - its identifier + - one comment + - other """ def save_file_data(): - """ Enregistrement du nom du fichier de données """ + """ Saving the data file name """ f = open("Fonctionnel.txt", "r") contents = f.readlines() f.close() @@ -68,16 +68,16 @@ def save_file_data(): def save_mesure(): - """ Affichage et enregistrement d'une mesure """ - print("Votre mesure a été enregistrée : ") + """ Displaying and recording a measure """ + print(_("Your measure has been recorded")) with indent(4, quote=colored.blue('')): - puts(colored.green("-votre poids : {weight} kg").format(weight=args.weight)) - puts("-son type : {typ}".format(typ=args.type)) - puts("-la date : {dat}".format(dat=args.date)) - puts("-la métrique : {metric}".format(metric=args.metric)) - puts("-l'identifiant : {ide}".format(ide=args.id)) - puts("-votre commentaire : {comment}".format(comment=args.comment)) - puts("-autre : {other}".format(other=args.other)) + puts(colored.green("-your weight : {weight} kg").format(weight=args.weight)) + puts("-its type : {typ}".format(typ=args.type)) + puts("-the date : {dat}".format(dat=args.date)) + puts("-the metric : {metric}".format(metric=args.metric)) + puts("-the identifier : {ide}".format(ide=args.id)) + puts("-your comment : {comment}".format(comment=args.comment)) + puts("-other : {other}".format(other=args.other)) with open(str(args.data), 'a', newline='\n') as csvfile: weightwriter = csv.writer(csvfile, delimiter='|', quotechar='"', quoting=csv.QUOTE_MINIMAL) weightwriter.writerow([str(args.weight), \ @@ -88,7 +88,7 @@ def save_mesure(): str(args.other)]) def read_measures(): - """ Affichage de l'ensemble des mesures """ + """ Display of all measures """ data_file = open(str(args.data), 'r') data = csv.reader(data_file, delimiter='|') linenum = 0 @@ -138,8 +138,8 @@ def undo_remove(): f.write(contents) f.close() -def trace_graph(): - """ Trace le graphe de l'évolution du poids avec Gnuplot """ +def plot_graph(): + """ Plot the graph of the weight evolution with Gnuplot """ if args.dates != None: print(args.dates) # set xrange [*:*] @@ -185,23 +185,22 @@ def trace_graph(): def tests_subproc(): - """ Test du module subprocess """ + """ Test of the subprocess module """ process = Popen(['cat', 'data2.csv'], stdout=PIPE, stderr=PIPE) stdout, stderr = process.communicate() print(stdout) ### Main ### -""" Programme de relevé de poids - Attention, le fichier data.csv à une ligne d'entête à laquelle - il manque un séparateur | final pour que le nombre de champs soit - correct. +""" Weight Recording Program + Be careful, the data.csv file has a header line that lacks + a final | separator for the number of fields to be correct. """ -# Création du parseur pour les arguments +# Creating the parser for arguments parser = argparse.ArgumentParser() texte = _('A script to manage your weight in command line.') parser.description=texte -# Création des arguments +# Creating arguments parser.add_argument('-da', '--data', default='data2.csv', help=_('optional : file data') @@ -264,9 +263,9 @@ parser.add_argument('-v', '--version', version='0.0.5', action='version' ) -# Récupération des arguments +# Argument retrieval args = parser.parse_args() -# Lancement des actions +# Launching of actions if args.data != 'data2.csv': save_file_data() if args.weight != -1: @@ -276,7 +275,7 @@ if args.read: if args.remove >= 0: remove_measure() if args.graph: - trace_graph() + plot_graph() if args.tests: tests_subproc() if args.undoremove: