From d8bc4d2ff422abaa566af0ca88504fff01b41ca7 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Wed, 5 Jun 2024 13:49:19 +0800 Subject: [PATCH] =?UTF-8?q?perf(i18n):=20=E6=A3=80=E6=B5=8B=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E8=AE=BE=E5=A4=87=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/i18n/index.js b/src/i18n/index.js index 7611f57..10e586c 100644 --- a/src/i18n/index.js +++ b/src/i18n/index.js @@ -19,10 +19,14 @@ i18n }, ns: ['common', 'group'], defaultNS: 'common', - // detection: { - // convertDetectedLanguage: 'Iso15897', - // convertDetectedLanguage: (lng) => lng.replace('-', '_') - // }, + detection: { + // convertDetectedLanguage: 'Iso15897', + convertDetectedLanguage: (lng) => { + const langPart = lng.split('-')[0]; + return langPart; + // return lng.replace('-', '_'); + }, + }, supportedLngs: ['en', 'zh'], // resources: { // en: { translation: en },