From 2bbe11e2708e0b3a8c30eb84ea510af5f2072279 Mon Sep 17 00:00:00 2001 From: "francois.grand" <francois.grand@irstea.fr> Date: Thu, 4 Jan 2018 17:16:37 +0100 Subject: [PATCH] Internationalisation du dialogue de confirmation de fermeture d'une calculette --- .../generic/calculator.component.html | 11 ++++------- .../calculators/generic/calculator.component.ts | 16 ++++++++++++++++ src/locale/error_messages.en.json | 6 +++++- src/locale/error_messages.fr.json | 6 +++++- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/src/app/calculators/generic/calculator.component.html b/src/app/calculators/generic/calculator.component.html index cc1b98522..d8fd7b9a8 100644 --- a/src/app/calculators/generic/calculator.component.html +++ b/src/app/calculators/generic/calculator.component.html @@ -35,17 +35,14 @@ <button type="button" class="close pull-right" aria-label="Close" (click)="confirmModal.hide()"> <span aria-hidden="true">×</span> </button> - <h4 class="modal-title w-100" id="myModalLabel">Confirmer la fermeture</h4> + <h4 class="modal-title w-100" id="myModalLabel">{{uitextCloseDialogTitle}}</h4> </div> <div class="modal-body"> - <h4> - Attention ! Les paramètres et résultats de la calculette seront perdus. - <br/> Vraiment fermer ? - </h4> + <h4> {{uitextCloseDialogText}} </h4> </div> <div class="modal-footer"> - <button type="button" class="btn btn-danger relative waves-light" (click)="onCloseForm()" mdbRippleRadius>Oui</button> - <button type="button" class="btn btn-success waves-light" aria-label="Close" (click)="confirmModal.hide()" mdbRippleRadius>Non</button> + <button type="button" class="btn btn-danger relative waves-light" (click)="onCloseForm()" mdbRippleRadius>{{uitextCloseDialogYes}}</button> + <button type="button" class="btn btn-success waves-light" aria-label="Close" (click)="confirmModal.hide()" mdbRippleRadius>{{uitextCloseDialogNo}}</button> </div> </div> </div> diff --git a/src/app/calculators/generic/calculator.component.ts b/src/app/calculators/generic/calculator.component.ts index c308fc8e1..84a3cd6fb 100644 --- a/src/app/calculators/generic/calculator.component.ts +++ b/src/app/calculators/generic/calculator.component.ts @@ -77,6 +77,22 @@ export class GenericCalculatorComponent implements OnInit, DoCheck, OnDestroy, O return this.intlService.localizeText("INFO_CALCULATOR_CALCULER"); } + private get uitextCloseDialogTitle() { + return this.intlService.localizeText("INFO_CLOSE_DIALOGUE_TITRE"); + } + + private get uitextCloseDialogText() { + return this.intlService.localizeText("INFO_CLOSE_DIALOGUE_TEXT"); + } + + private get uitextCloseDialogYes() { + return this.intlService.localizeText("INFO_OPTION_YES"); + } + + private get uitextCloseDialogNo() { + return this.intlService.localizeText("INFO_OPTION_NO"); + } + ngOnInit() { this.intlService.addObserver(this); this.formulaireService.addObserver(this); diff --git a/src/locale/error_messages.en.json b/src/locale/error_messages.en.json index 6ee038e8f..9fb41a837 100644 --- a/src/locale/error_messages.en.json +++ b/src/locale/error_messages.en.json @@ -71,5 +71,9 @@ "INFO_SETUP_TITLE": "Application setup", "INFO_SETUP_PRECISION_AFFICHAGE": "Display accuracy", "INFO_SETUP_PRECISION_CALCUL": "Computation accuracy", - "INFO_MENU_NOUVELLE_CALC": "New calculator" + "INFO_MENU_NOUVELLE_CALC": "New calculator", + "INFO_CLOSE_DIALOGUE_TITRE": "Please confirm", + "INFO_CLOSE_DIALOGUE_TEXT": "Warning ! Parameters and results will be lost. Really close ?", + "INFO_OPTION_YES": "Yes", + "INFO_OPTION_NO": "No" } \ No newline at end of file diff --git a/src/locale/error_messages.fr.json b/src/locale/error_messages.fr.json index 70ef5433a..95bc46592 100644 --- a/src/locale/error_messages.fr.json +++ b/src/locale/error_messages.fr.json @@ -77,5 +77,9 @@ "INFO_SETUP_TITLE": "Paramètres de l'application", "INFO_SETUP_PRECISION_AFFICHAGE": "Précision d'affichage", "INFO_SETUP_PRECISION_CALCUL": "Précision de calcul", - "INFO_MENU_NOUVELLE_CALC": "Nouvelle calculette" + "INFO_MENU_NOUVELLE_CALC": "Nouvelle calculette", + "INFO_CLOSE_DIALOGUE_TITRE": "Confirmer la fermeture", + "INFO_CLOSE_DIALOGUE_TEXT": "Attention ! Les paramètres et résultats de la calculette seront perdus. Vraiment fermer ?", + "INFO_OPTION_YES": "Oui", + "INFO_OPTION_NO": "Non" } \ No newline at end of file -- GitLab