diff --git a/src/app/services/formulaire/formulaire.service.ts b/src/app/services/formulaire/formulaire.service.ts index a93424c56a3618d446cd31d556069756c216d71d..642f163ad3cbdc98f6e60bf69d8047e9f25fda31 100644 --- a/src/app/services/formulaire/formulaire.service.ts +++ b/src/app/services/formulaire/formulaire.service.ts @@ -161,7 +161,8 @@ export class FormulaireService extends Observable { */ public expandVariableName(calcType: CalculatorType, symbol: string): string { let s = ""; - let langCache = this.languageCache; // language cache… + // language cache… + let langCache = this.languageCache; if (langCache && langCache[calcType]) { langCache = langCache[calcType]; // …for target Nub type } @@ -171,7 +172,17 @@ export class FormulaireService extends Observable { if (langCache && langCache[symbol] !== undefined) { s = this.intlService.localizeText(symbol, langCache); } else { - s = this.intlService.localizeText("INFO_LIB_" + symbol.toLocaleUpperCase()); + // is symbol of the form ouvrages[i]… ? + const re = /([A-Z,a-z]+)\[(\d+)\]\.(.+)/; + const match = re.exec(symbol); + if (match) { + // Les libellés correspondants sont INFO OUVRAGE et INFO_EXTRARES_LIB_OUVRAGE_XXX + s = this.intlService.localizeText(`INFO_${match[1].toUpperCase()}`) + + " n°" + (+match[2] + 1) + ": " + + this.expandVariableName(calcType, `${match[1].toUpperCase()}_${match[3].toUpperCase()}`); + } else { + s = this.intlService.localizeText("INFO_LIB_" + symbol.toLocaleUpperCase()); + } } return s; } diff --git a/src/app/services/internationalisation/internationalisation.service.ts b/src/app/services/internationalisation/internationalisation.service.ts index 73e54b5518a32c593912c57d4147c9a16cc817ff..bd560fae2a17b65ead3d8a281f61c04dc3a0e958 100644 --- a/src/app/services/internationalisation/internationalisation.service.ts +++ b/src/app/services/internationalisation/internationalisation.service.ts @@ -177,14 +177,6 @@ export class I18nService extends Observable implements Observer { return str.replace(new RegExp(find, "g"), replace); } - /** - * analyse un libellé du type ouvrage[n].XX - */ - private parseLabel(lbl: string) { - const re = /([A-Z,a-z]+)\[(\d+)\]\.(.+)/; - return re.exec(lbl); - } - /** * Met en forme un extraResult en fonction du libellé qui l'accompagne * Les extraResult avec le terme "ENUM_" sont traduit avec le message INFO_EXTRARES_ENUM_[Nom de la variable après ENUM_]