From fee34039170eed17f528d18b126debf646d5ee38 Mon Sep 17 00:00:00 2001 From: antoine Date: Mon, 22 Jan 2024 15:46:11 +0100 Subject: [PATCH] Allow i18n with "-" --- packages/formoj/src/util/i18n.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/formoj/src/util/i18n.js b/packages/formoj/src/util/i18n.js index f64aa46..ac452ed 100644 --- a/packages/formoj/src/util/i18n.js +++ b/packages/formoj/src/util/i18n.js @@ -17,6 +17,11 @@ export function createI18nConfig(customs = {}) { export function getDefaultLocale() { const langAttribute = document.documentElement.getAttribute('lang'); + + if(langAttribute in i18n) { + return langAttribute; + } + return langAttribute ? langAttribute.split('-')[0] : 'en';