import i18n from "i18next" ; import { initReactI18next } from "react-i18next" ; import moment from "moment" ; import LanguageDetector from "i18next-browser-languagedetector" ; import { initI18n } from "@next-core/brick-kit" ; import { NS_BRICK_CONTAINER } from "./constants" ; import en from "./locales/en" ; import zh from "./locales/zh" ; i18n . use ( LanguageDetector ) . use ( initReactI18next ) . init ( { fallbackLng : "zh" , debug : process . env . NODE_ENV === "development" , supportedLngs : [ "zh" , "en" ] , nonExplicitSupportedLngs : true , interpolation : { escapeValue : false , } , react : { useSuspense : false , } , compatibilityJSON : "v3" , resources : { en : { [ NS_BRICK_CONTAINER ] : en , } , zh : { [ NS_BRICK_CONTAINER ] : zh , } , } , } ) ; initI18n ( ) ; i18n . on ( "languageChanged" , function ( lng ) { moment . locale ( lng ) ; } ) ; export default i18n ;