mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-14 09:42:16 +00:00
## Summary
Fix all i18n `no-restricted-imports` lint warnings and upgrade rules
from `warn` to `error`.
## Changes
- **What**: Migrate Vue components from `import { t/d } from '@/i18n'`
to `const { t } = useI18n()`. Migrate non-component `.ts` files from
`useI18n()` to `import { t/d } from '@/i18n'`. Allow `st` import from
`@/i18n` in Vue components (it wraps `te`/`t` for safe fallback
translation). Remove `@deprecated` tag from `i18n.ts` global exports
(still used by `st` and non-component code). Upgrade both lint rules
from `warn` to `error`.
## Review Focus
- The `st` helper is intentionally excluded from the Vue component
restriction since it provides safe fallback translation needed for
custom node definitions.
Fixes #8701
┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-8704-fix-resolve-i18n-no-restricted-imports-lint-warnings-2ff6d73d365081ae84d8eb0dfef24323)
by [Unito](https://www.unito.io)
---------
Co-authored-by: Amp <amp@ampcode.com>
72 lines
1.9 KiB
Vue
72 lines
1.9 KiB
Vue
<template>
|
|
<div v-if="shouldShow" class="flex justify-end">
|
|
<div
|
|
class="flex items-center whitespace-nowrap text-[0.75rem] leading-[normal] drop-shadow-[1px_1px_8px_rgba(0,0,0,0.4)]"
|
|
role="status"
|
|
aria-live="polite"
|
|
aria-atomic="true"
|
|
>
|
|
<div class="flex items-center text-base-foreground">
|
|
<span class="font-normal">
|
|
{{ t('sideToolbar.queueProgressOverlay.inlineTotalLabel') }}:
|
|
</span>
|
|
<span class="w-[5ch] shrink-0 text-right font-bold tabular-nums">
|
|
{{ totalPercentFormatted }}
|
|
</span>
|
|
</div>
|
|
|
|
<div class="flex items-center text-muted-foreground">
|
|
<span
|
|
class="w-[16ch] shrink-0 truncate text-right"
|
|
:title="currentNodeName"
|
|
>
|
|
{{ currentNodeName }}:
|
|
</span>
|
|
<span class="w-[5ch] shrink-0 text-right tabular-nums">
|
|
{{ currentNodePercentFormatted }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
import { st } from '@/i18n'
|
|
import { useQueueProgress } from '@/composables/queue/useQueueProgress'
|
|
import { useExecutionStore } from '@/stores/executionStore'
|
|
import { resolveNodeDisplayName } from '@/utils/nodeTitleUtil'
|
|
|
|
const props = defineProps<{
|
|
hidden?: boolean
|
|
}>()
|
|
|
|
const { t } = useI18n()
|
|
|
|
const executionStore = useExecutionStore()
|
|
const {
|
|
totalPercent,
|
|
totalPercentFormatted,
|
|
currentNodePercent,
|
|
currentNodePercentFormatted
|
|
} = useQueueProgress()
|
|
|
|
const currentNodeName = computed(() => {
|
|
return resolveNodeDisplayName(executionStore.executingNode, {
|
|
emptyLabel: t('g.emDash'),
|
|
untitledLabel: t('g.untitled'),
|
|
st
|
|
})
|
|
})
|
|
|
|
const shouldShow = computed(
|
|
() =>
|
|
!props.hidden &&
|
|
(!executionStore.isIdle ||
|
|
totalPercent.value > 0 ||
|
|
currentNodePercent.value > 0)
|
|
)
|
|
</script>
|