From 8ca3f2d53d4d43ed0d21bb5953c3ea09a23ad734 Mon Sep 17 00:00:00 2001 From: DarkSky <25152247+darkskygit@users.noreply.github.com> Date: Fri, 3 Apr 2026 03:37:49 +0800 Subject: [PATCH] fix(core): settings i18n refresh (#14760) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit replace #14758 #### PR Dependency Tree * **PR #14760** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) ## Summary by CodeRabbit * **Bug Fixes** * Enhanced language switching to ensure the settings dialog properly reflects language changes when users update their language preference. --- packages/frontend/core/src/desktop/dialogs/setting/index.tsx | 4 +++- packages/frontend/i18n/src/react.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/frontend/core/src/desktop/dialogs/setting/index.tsx b/packages/frontend/core/src/desktop/dialogs/setting/index.tsx index 419ac312e6..661835333e 100644 --- a/packages/frontend/core/src/desktop/dialogs/setting/index.tsx +++ b/packages/frontend/core/src/desktop/dialogs/setting/index.tsx @@ -15,7 +15,7 @@ import type { import { GlobalContextService } from '@affine/core/modules/global-context'; import { createIsland, type Island } from '@affine/core/utils/island'; import { ServerDeploymentType } from '@affine/graphql'; -import { Trans } from '@affine/i18n'; +import { Trans, useTranslation } from '@affine/i18n'; import { ContactWithUsIcon } from '@blocksuite/icons/rc'; import { FrameworkScope, useLiveData, useService } from '@toeverything/infra'; import { debounce } from 'lodash-es'; @@ -72,10 +72,12 @@ const SettingModalInner = ({ scrollAnchor: initialScrollAnchor, }); const globalContextService = useService(GlobalContextService); + const { i18n } = useTranslation('translation'); const currentServerId = useLiveData( globalContextService.globalContext.serverId.$ ); + const currentLanguageKey = i18n.resolvedLanguage ?? i18n.language; const serversService = useService(ServersService); const defaultServerService = useService(DefaultServerService); const currentServer = diff --git a/packages/frontend/i18n/src/react.ts b/packages/frontend/i18n/src/react.ts index 3cfe628f31..2408443279 100644 --- a/packages/frontend/i18n/src/react.ts +++ b/packages/frontend/i18n/src/react.ts @@ -9,4 +9,4 @@ export const useI18n = () => { return useMemo(() => createI18nWrapper(() => i18n), [i18n]); }; -export { I18nextProvider, Trans } from 'react-i18next'; +export { I18nextProvider, Trans, useTranslation } from 'react-i18next';