From c48acac3b581a811010d198984899482abd98623 Mon Sep 17 00:00:00 2001 From: Jean-Pascal <jean-pascal.aubry@inrae.fr> Date: Mon, 6 May 2024 15:46:06 +0000 Subject: [PATCH 1/2] fix: set english to default langague Refs #667 --- src/app/services/internationalisation.service.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/services/internationalisation.service.ts b/src/app/services/internationalisation.service.ts index deee494fe..99b6a8fd0 100644 --- a/src/app/services/internationalisation.service.ts +++ b/src/app/services/internationalisation.service.ts @@ -19,6 +19,7 @@ export class I18nService extends Observable implements Observer { private _availableLanguages: any; /** localized messages */ + // eslint-disable-next-line @typescript-eslint/naming-convention private _Messages: StringMap; /** to avoid loading language files multiple times */ @@ -60,19 +61,20 @@ export class I18nService extends Observable implements Observer { * @param code ISO 639-1 language code */ public async setLanguage(code: string) { - /** excluded calculators */ const childCalculatorType: CalculatorType[] = [ CalculatorType.Section, CalculatorType.Structure, CalculatorType.CloisonAval, CalculatorType.YAXN, CalculatorType.LechaptCalmon, CalculatorType.PressureLossLaw ]; - + // ensure 2-letter language code code = code.substring(0, 2); - // is language supported ? - if (! Object.keys(this._availableLanguages).includes(code)) { - throw new Error(`LANGUAGE_UNSUPPORTED "${code}"`); + + // Check if the language is supported, default to English if not + if (!Object.keys(this._availableLanguages).includes(code)) { + code = "en"; // Default to English if the detected language is not supported } - // did language change ? + + // did language change? if (this._currentLanguage !== code) { this._currentLanguage = code; this._Messages = undefined; -- GitLab From 185272cd0ee67d9563fa535578c622a968a6b0f3 Mon Sep 17 00:00:00 2001 From: Jean-Pascal <jean-pascal.aubry@inrae.fr> Date: Tue, 7 May 2024 09:51:59 +0000 Subject: [PATCH 2/2] fix: remove warning on element not yet clickable in calc-all-examples spec Refs #667 --- e2e/calc-all-examples.e2e-spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e/calc-all-examples.e2e-spec.ts b/e2e/calc-all-examples.e2e-spec.ts index 04a64a3e3..880b9aafd 100644 --- a/e2e/calc-all-examples.e2e-spec.ts +++ b/e2e/calc-all-examples.e2e-spec.ts @@ -49,6 +49,7 @@ describe("ngHyd − example sessions −", () => { await browser.pause(200); if (examples.length > i) { // click example #i + await examples[i].waitForClickable(); await examples[i].click(); await browser.pause(200); -- GitLab