Skip to content

Commit fc7a000

Browse files
authored
chore: fix dumi useLocale type error (#1036)
* chore: changelog * docs: changelog of 1.4.0 * docs: changelog of 1.4.0 * docs: changelog of 1.4.0 * chore: test * chore: test * chore: test * chore: test * docs: changelog of 1.4.1 * docs: changelog of 1.5.0 * chore: dumi locale
1 parent b89b28c commit fc7a000

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.dumi/hooks/useLocale.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useLocale as useDumiLocale } from 'dumi';
1+
import { useIntl } from 'dumi';
22

33
export interface LocaleMap<
44
K extends PropertyKey = PropertyKey,
@@ -14,8 +14,8 @@ const useLocale = <
1414
>(
1515
localeMap?: LocaleMap<K, V>,
1616
): [Record<K, V>, 'cn' | 'en'] => {
17-
const { id } = useDumiLocale();
18-
const localeType = id === 'zh-CN' ? 'cn' : 'en';
17+
const { locale } = useIntl();
18+
const localeType = locale === 'zh-CN' ? 'cn' : 'en';
1919
return [localeMap?.[localeType]!, localeType] as const;
2020
};
2121

0 commit comments

Comments
 (0)