diff --git a/src/app/components/dialog-generate-pab/dialog-generate-pab.component.html b/src/app/components/dialog-generate-pab/dialog-generate-pab.component.html index 14202deecd17f1de7c5a8bc248dcdc84c93ddfc9..c1161f20c451d272622d87db4d7f3b5d795b9a02 100644 --- a/src/app/components/dialog-generate-pab/dialog-generate-pab.component.html +++ b/src/app/components/dialog-generate-pab/dialog-generate-pab.component.html @@ -25,12 +25,12 @@ </mat-error> <mat-form-field> - <input matInput required [placeholder]="uitextNBBassins" pattern="^[1-9][0-9]*$" + <input matInput required [placeholder]="uitextNBBassins" pattern="^([2-9]|[1-9][0-9]+)$" [(ngModel)]="nbBassins" name="nbBassins" #inputNbBassins="ngModel" id="generatePabNbBassins"> </mat-form-field> <mat-error *ngIf="inputNbBassins.invalid && (inputNbBassins.dirty || inputNbBassins.touched)"> <div *ngIf="inputNbBassins.errors.required || inputNbBassins.errors.pattern"> - {{ uitextMustBePositive }} + {{ uitextMustBeAtLeastTwo }} </div> </mat-error> diff --git a/src/app/components/dialog-generate-pab/dialog-generate-pab.component.ts b/src/app/components/dialog-generate-pab/dialog-generate-pab.component.ts index a0f55835b40c16228e8704fc973fda828f809267..48c7c79726a82e01bc8027fc2da25b129ca422a8 100644 --- a/src/app/components/dialog-generate-pab/dialog-generate-pab.component.ts +++ b/src/app/components/dialog-generate-pab/dialog-generate-pab.component.ts @@ -4,6 +4,8 @@ import { Inject, Component } from "@angular/core"; import { I18nService } from "../../services/internationalisation/internationalisation.service"; import { FormBuilder } from "@angular/forms"; +import { sprintf } from "sprintf-js"; + @Component({ selector: "dialog-generate-pab", templateUrl: "dialog-generate-pab.component.html", @@ -67,6 +69,10 @@ export class DialogGeneratePABComponent { return this.intlService.localizeText("ERROR_PARAM_MUST_BE_POSITIVE"); } + public get uitextMustBeAtLeastTwo() { + return sprintf(this.intlService.localizeText("ERROR_PARAM_MUST_BE_AT_LEAST"), 2); + } + public get uitextGeneratePAB() { return this.intlService.localizeText("INFO_CALCULATOR_RESULTS_GENERATE_PAB"); } diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json index f51fe31826ea884a845f4ee388173a1113c01144..f685685d71c09cbe4846bd130c98101e9beb0ba7 100644 --- a/src/locale/messages.en.json +++ b/src/locale/messages.en.json @@ -17,6 +17,7 @@ "ERROR_MINMAXSTEP_STEP": "Value is not in %s", "ERROR_NEWTON_DERIVEE_NULLE": "Null function derivative in Newton computation", "ERROR_PARAM_MUST_BE_A_NUMBER": "Please type a numeric value", + "ERROR_PARAM_MUST_BE_AT_LEAST": "Value must be >= %s", "ERROR_PARAM_MUST_BE_POSITIVE": "Please type a positive numeric value", "ERROR_PARAM_NULL": "Parameter value must not be NULL", "ERROR_PARAMDEF_CALC_UNDEFINED": "calculability of '%symbol%' parameter is undefined", diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index baf4af6ee5835e0d67f08d54f4444a91d7048ad1..03e07508e218a449144ce5e953a3fd9ef2f92555 100644 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -17,6 +17,7 @@ "ERROR_MINMAXSTEP_STEP": "La valeur n'est pas dans %s", "ERROR_NEWTON_DERIVEE_NULLE": "Dérivée nulle dans un calcul par la méthode de Newton", "ERROR_PARAM_MUST_BE_A_NUMBER": "Veuillez entrer une valeur numérique", + "ERROR_PARAM_MUST_BE_AT_LEAST": "La valeur doit être >= %s", "ERROR_PARAM_MUST_BE_POSITIVE": "Veuillez entrer une valeur numérique positive", "ERROR_PARAM_NULL": "La valeur du paramètre ne peut pas être NULL", "ERROR_PARAMDEF_CALC_UNDEFINED": "La calculabilité du paramètre %symbol% n'est pas définie",