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