import * as React from 'react'; 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' as const); return [localeMap?.[localeType]!, localeType]; }