Skip to content
Snippets Groups Projects
Commit 5ee4d3ae authored by mathias.chouet's avatar mathias.chouet
Browse files

Réparé: traduction des ouvrages en parallèle

parent 4acb2ba8
No related branches found
No related tags found
No related merge requests found
......@@ -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()}`)
+ "" + (+match[2] + 1) + ": "
+ this.expandVariableName(calcType, `${match[1].toUpperCase()}_${match[3].toUpperCase()}`);
} else {
s = this.intlService.localizeText("INFO_LIB_" + symbol.toLocaleUpperCase());
}
}
return s;
}
......
......@@ -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_]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment