diff --git a/src/app/services/internationalisation.service.ts b/src/app/services/internationalisation.service.ts index bac781614673a23df658b4a1c8adff572c705af2..6a1a79e7e5ae9a63cb5673fb56e4a6c44c1d0ad8 100644 --- a/src/app/services/internationalisation.service.ts +++ b/src/app/services/internationalisation.service.ts @@ -55,11 +55,12 @@ export class I18nService extends Observable implements Observer { /** * Defines the current language code from its ISO 639-1 code (2 characters) or locale code * (ex: "fr", "en", "fr_FR", "en-US") - * @see this.languageCodeFromLocaleCode() * * @param code ISO 639-1 language code */ public async setLanguage(code: string) { + // 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}"`);