Fix desktop menu docs links regression (#7181)

## Summary
- make `useExternalLink` rely on the global i18n locale so it can be
used safely outside setup
- restore `electronAdapter` to use the shared `useExternalLink` helper
for docs URLs and static links

## Motivation
Desktop menu items disappeared because a top-level call to
`useExternalLink` in `electronAdapter` triggered `useI18n` at
module-eval time, throwing and blocking extension registration. By
making the composable global-locale-only and using it in
`electronAdapter`, the module can load without setup context while
preserving link behavior.

## Testing
- pnpm typecheck
- pnpm lint:fix

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7181-Fix-desktop-menu-docs-links-regression-2c06d73d36508157ae48cff078b9173e)
by [Unito](https://www.unito.io)
This commit is contained in:
Benjamin Lu
2025-12-08 21:20:07 -08:00
committed by GitHub
parent f0a99a0a75
commit 41eb45754b
2 changed files with 22 additions and 20 deletions

View File

@@ -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'