From 7a737493dc70c09a2fcf50ef49899f1286aefc29 Mon Sep 17 00:00:00 2001 From: Sparkle <1284531+baurine@users.noreply.github.com> Date: Mon, 21 Sep 2020 18:00:31 +0800 Subject: [PATCH] ui: fix dayjs i18n (#755) --- ui/lib/utils/i18n.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ui/lib/utils/i18n.ts b/ui/lib/utils/i18n.ts index 001504d06b..0da831e337 100644 --- a/ui/lib/utils/i18n.ts +++ b/ui/lib/utils/i18n.ts @@ -1,5 +1,4 @@ -import 'dayjs/locale/en' -import 'dayjs/locale/zh-cn' +import 'dayjs/locale/zh' import dayjs from 'dayjs' import i18next from 'i18next' @@ -7,7 +6,6 @@ import LanguageDetector from 'i18next-browser-languagedetector' import { initReactI18next } from 'react-i18next' i18next.on('languageChanged', function (lng) { - console.log('Language', lng) dayjs.locale(lng.toLowerCase()) }) @@ -46,8 +44,8 @@ i18next .use(initReactI18next) .init({ resources: {}, // oh! this line is a big pitfall, we can't remove it, else it will cause strange crash! - fallbackLng: 'en', - whitelist: ['zh', 'en'], + fallbackLng: 'en', // fallbackLng won't change the detected language + whitelist: ['zh', 'en'], // whitelist will change the detected lanuage interpolation: { escapeValue: false, },