mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-27 18:24:11 +00:00
fix: resolve missing i18n key warnings (#9064)
## Summary Fix multiple i18n missing key console warnings by correcting key paths and adding missing translations. ## Changes - **What**: - `ScrubableNumberInput`: Fixed references to non-existent `g.ariaLabel.decrement`/`g.ariaLabel.increment` keys → use `g.decrement`/`g.increment` - `SidebarIcon`: Replaced `t()` with `st()` (safe translate) to prevent double-translation when parent components pass pre-translated strings - `en/main.json`: Added missing `menuLabels.Copy`, `menuLabels.Paste`, `menuLabels.Select All` keys ## Review Focus The `SidebarIcon` change from `t()` to `st()` is the key design decision. `SidebarIcon` receives both i18n keys (from sidebar tabs via `SideToolbar`) and pre-translated strings (from dedicated sidebar button components). Using `st()` (which checks `te()` before translating) handles both cases without warnings. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-9064-fix-resolve-missing-i18n-key-warnings-30e6d73d3650816eaad3ce030f9c1d3f) by [Unito](https://www.unito.io) --------- Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<slot name="background" />
|
||||
<Button
|
||||
v-if="!hideButtons"
|
||||
:aria-label="t('g.ariaLabel.decrement')"
|
||||
:aria-label="t('g.decrement')"
|
||||
data-testid="decrement"
|
||||
class="h-full w-8 rounded-r-none hover:bg-base-foreground/20 disabled:opacity-30"
|
||||
variant="muted-textonly"
|
||||
@@ -51,7 +51,7 @@
|
||||
<slot />
|
||||
<Button
|
||||
v-if="!hideButtons"
|
||||
:aria-label="t('g.ariaLabel.increment')"
|
||||
:aria-label="t('g.increment')"
|
||||
data-testid="increment"
|
||||
class="h-full w-8 rounded-l-none hover:bg-base-foreground/20 disabled:opacity-30"
|
||||
variant="muted-textonly"
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</div>
|
||||
</slot>
|
||||
<span v-if="label && !isSmall" class="side-bar-button-label">{{
|
||||
t(label)
|
||||
st(label, label)
|
||||
}}</span>
|
||||
</div>
|
||||
</Button>
|
||||
@@ -50,12 +50,10 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import type { Component } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
import Button from '@/components/ui/button/Button.vue'
|
||||
import { st } from '@/i18n'
|
||||
import { cn } from '@/utils/tailwindUtil'
|
||||
|
||||
const { t } = useI18n()
|
||||
const {
|
||||
icon = '',
|
||||
selected = false,
|
||||
@@ -83,7 +81,7 @@ const overlayValue = computed(() =>
|
||||
typeof iconBadge === 'function' ? (iconBadge() ?? '') : iconBadge
|
||||
)
|
||||
const shouldShowBadge = computed(() => !!overlayValue.value)
|
||||
const computedTooltip = computed(() => t(tooltip) + tooltipSuffix)
|
||||
const computedTooltip = computed(() => st(tooltip, tooltip) + tooltipSuffix)
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
Reference in New Issue
Block a user