Skip to content
Snippets Groups Projects
Commit c48acac3 authored by AUBRY JEAN-PASCAL's avatar AUBRY JEAN-PASCAL
Browse files

fix: set english to default langague

Refs #667
parent 8ed2bcfc
No related branches found
No related tags found
2 merge requests!275Release v4.19.0,!264Resolve "Cassiopée doesn't work for languages other than French and English"
Pipeline #196581 failed
......@@ -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;
......
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