import { useLocale as useDumiLocale } from 'dumi'; export interface LocaleMap { cn: Record; en: Record; } function useLocale( localeMap?: LocaleMap, ): [Record, 'cn' | 'en'] { const { id } = useDumiLocale(); const localeType = id === 'zh-CN' ? ('cn' as const) : ('en' as const); return [localeMap?.[localeType]!, localeType]; } export default useLocale;