diff --git a/src/composables/useExternalLink.ts b/src/composables/useExternalLink.ts index 59cb9f6895..2758e2cedf 100644 --- a/src/composables/useExternalLink.ts +++ b/src/composables/useExternalLink.ts @@ -1,7 +1,7 @@ import { computed } from 'vue' import { electronAPI, isElectron } from '@/utils/envUtil' -import { useI18n } from 'vue-i18n' +import { i18n } from '@/i18n' /** * Composable for building docs.comfy.org URLs with automatic locale and platform detection @@ -23,7 +23,7 @@ import { useI18n } from 'vue-i18n' * ``` */ export function useExternalLink() { - const { locale } = useI18n() + const locale = computed(() => String(i18n.global.locale.value)) const isChinese = computed(() => { return locale.value === 'zh' || locale.value === 'zh-TW' diff --git a/tests-ui/tests/composables/useExternalLink.test.ts b/tests-ui/tests/composables/useExternalLink.test.ts index 986322cba4..9bba00d7df 100644 --- a/tests-ui/tests/composables/useExternalLink.test.ts +++ b/tests-ui/tests/composables/useExternalLink.test.ts @@ -9,12 +9,14 @@ vi.mock('@/utils/envUtil', () => ({ electronAPI: vi.fn() })) -// Mock vue-i18n +// Mock global i18n locale ref const mockLocale = ref('en') -vi.mock('vue-i18n', () => ({ - useI18n: vi.fn(() => ({ - locale: mockLocale - })) +vi.mock('@/i18n', () => ({ + i18n: { + global: { + locale: mockLocale + } + } })) // Import after mocking to get the mocked versions