mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-11 14:08:55 +08:00
fix(core): settings i18n refresh (#14760)
replace #14758 #### PR Dependency Tree * **PR #14760** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Enhanced language switching to ensure the settings dialog properly reflects language changes when users update their language preference. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -15,7 +15,7 @@ import type {
|
|||||||
import { GlobalContextService } from '@affine/core/modules/global-context';
|
import { GlobalContextService } from '@affine/core/modules/global-context';
|
||||||
import { createIsland, type Island } from '@affine/core/utils/island';
|
import { createIsland, type Island } from '@affine/core/utils/island';
|
||||||
import { ServerDeploymentType } from '@affine/graphql';
|
import { ServerDeploymentType } from '@affine/graphql';
|
||||||
import { Trans } from '@affine/i18n';
|
import { Trans, useTranslation } from '@affine/i18n';
|
||||||
import { ContactWithUsIcon } from '@blocksuite/icons/rc';
|
import { ContactWithUsIcon } from '@blocksuite/icons/rc';
|
||||||
import { FrameworkScope, useLiveData, useService } from '@toeverything/infra';
|
import { FrameworkScope, useLiveData, useService } from '@toeverything/infra';
|
||||||
import { debounce } from 'lodash-es';
|
import { debounce } from 'lodash-es';
|
||||||
@@ -72,10 +72,12 @@ const SettingModalInner = ({
|
|||||||
scrollAnchor: initialScrollAnchor,
|
scrollAnchor: initialScrollAnchor,
|
||||||
});
|
});
|
||||||
const globalContextService = useService(GlobalContextService);
|
const globalContextService = useService(GlobalContextService);
|
||||||
|
const { i18n } = useTranslation('translation');
|
||||||
|
|
||||||
const currentServerId = useLiveData(
|
const currentServerId = useLiveData(
|
||||||
globalContextService.globalContext.serverId.$
|
globalContextService.globalContext.serverId.$
|
||||||
);
|
);
|
||||||
|
const currentLanguageKey = i18n.resolvedLanguage ?? i18n.language;
|
||||||
const serversService = useService(ServersService);
|
const serversService = useService(ServersService);
|
||||||
const defaultServerService = useService(DefaultServerService);
|
const defaultServerService = useService(DefaultServerService);
|
||||||
const currentServer =
|
const currentServer =
|
||||||
|
|||||||
@@ -9,4 +9,4 @@ export const useI18n = () => {
|
|||||||
return useMemo(() => createI18nWrapper(() => i18n), [i18n]);
|
return useMemo(() => createI18nWrapper(() => i18n), [i18n]);
|
||||||
};
|
};
|
||||||
|
|
||||||
export { I18nextProvider, Trans } from 'react-i18next';
|
export { I18nextProvider, Trans, useTranslation } from 'react-i18next';
|
||||||
|
|||||||
Reference in New Issue
Block a user