mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-11 08:20:53 +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>
74 lines
1.7 KiB
Vue
74 lines
1.7 KiB
Vue
<template>
|
|
<div class="space-y-4">
|
|
<div>
|
|
<label>{{ $t('load3d.upDirection') }}</label>
|
|
<Select
|
|
v-model="upDirection"
|
|
:options="upDirectionOptions"
|
|
option-label="label"
|
|
option-value="value"
|
|
/>
|
|
</div>
|
|
|
|
<div v-if="!hideMaterialMode">
|
|
<label>{{ $t('load3d.materialMode') }}</label>
|
|
<Select
|
|
v-model="materialMode"
|
|
:options="materialModeOptions"
|
|
option-label="label"
|
|
option-value="value"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import Select from 'primevue/select'
|
|
import { computed } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
import type {
|
|
MaterialMode,
|
|
UpDirection
|
|
} from '@/extensions/core/load3d/interfaces'
|
|
|
|
const { t } = useI18n()
|
|
const { hideMaterialMode = false, isPlyModel = false } = defineProps<{
|
|
hideMaterialMode?: boolean
|
|
isPlyModel?: boolean
|
|
}>()
|
|
|
|
const upDirection = defineModel<UpDirection>('upDirection')
|
|
const materialMode = defineModel<MaterialMode>('materialMode')
|
|
|
|
const upDirectionOptions = [
|
|
{ label: t('load3d.upDirections.original'), value: 'original' },
|
|
{ label: '-X', value: '-x' },
|
|
{ label: '+X', value: '+x' },
|
|
{ label: '-Y', value: '-y' },
|
|
{ label: '+Y', value: '+y' },
|
|
{ label: '-Z', value: '-z' },
|
|
{ label: '+Z', value: '+z' }
|
|
]
|
|
|
|
const materialModeOptions = computed(() => {
|
|
const options = [
|
|
{ label: t('load3d.materialModes.original'), value: 'original' }
|
|
]
|
|
|
|
if (isPlyModel) {
|
|
options.push({
|
|
label: t('load3d.materialModes.pointCloud'),
|
|
value: 'pointCloud'
|
|
})
|
|
}
|
|
|
|
options.push(
|
|
{ label: t('load3d.materialModes.normal'), value: 'normal' },
|
|
{ label: t('load3d.materialModes.wireframe'), value: 'wireframe' }
|
|
)
|
|
|
|
return options
|
|
})
|
|
</script>
|