fix: resolve hydration mismatch error for i18n

This commit is contained in:
yozuru 2025-04-19 20:15:35 +08:00
parent 0ab31a16f6
commit c8273371e0
No known key found for this signature in database

View file

@ -27,13 +27,10 @@ interface AppProps {
}
export function App({ locale }: AppProps) {
const { t } = useTranslation(); // 获取 t 函数,以便翻译 "Favorites"
useEffect(() => {
if (locale && i18n.language !== locale) {
i18n.changeLanguage(locale);
}
}, [locale]);
if (locale && i18n.language !== locale) {
i18n.changeLanguage(locale);
}
const { t } = useTranslation();
const categoriesData = useMemo(() => sounds.categories, []);
const categories = categoriesData; // 暂时不翻译