Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/website/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ as the application's `src/locales/` at the repository root:
`t('workshop.search.show', { n }, { locale })`.
- Plural forms separated by `|`: `"{count} node | {count} nodes"`, picked with
`t('cloudNodesLaunch.models.nodeCount', { count }, { locale, plural: count })`.
- Styled words inside a sentence are a named placeholder, never a message
split around them: `"Built for {highlight} who need quality."`, rendered with
`<I18nT keypath="…" :i18n="translationsFor(locale)">` and a `#highlight`
slot, so each locale decides where the styled word sits.
Comment on lines +49 to +52

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Nit: the convention covers styled words, but not the rule that fixed the careers title: an inline image or a line break is its own placeholder too, never part of another slot. Without it, the next author can bake a <br> into a slot again and lock the break for every locale. One clause and the whyJoinTitle example cover it.

Suggested change
- Styled words inside a sentence are a named placeholder, never a message
split around them: `"Built for {highlight} who need quality."`, rendered with
`<I18nT keypath="…" :i18n="translationsFor(locale)">` and a `#highlight`
slot, so each locale decides where the styled word sits.
- Styled words, inline images and line breaks inside a sentence are named
placeholders, never a message split around them: `"Built for {highlight} who
need quality."` or `"Why join{br}{logo}?"`, rendered with
`<I18nT keypath="…" :i18n="translationsFor(locale)">` and one slot per
placeholder, so each locale decides where each one sits.

- The characters `{`, `}`, `@` and `|` are message syntax, so literal ones are
written as `{'{'}`, `{'}'}`, `{'@'}` and `{'|'}`.

Expand Down
23 changes: 13 additions & 10 deletions apps/website/src/components/about/OurValuesSection.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<script setup lang="ts">
import type { Locale } from '@/i18n/translations'
import type { Locale, TranslationKey } from '@/i18n/translations'

import { I18nT } from 'vue-i18n'

import { translationsFor } from '@/i18n/translations'
import NodeBadge from '@/components/common/NodeBadge.vue'
Expand All @@ -8,8 +10,6 @@ import SectionLabel from '@/components/common/SectionLabel.vue'
const { locale = 'en' } = defineProps<{ locale?: Locale }>()
const { t } = translationsFor(locale)

type TranslationKey = Parameters<typeof t>[0]

const values: {
segments: Array<{ text: string }>
bodyKey: TranslationKey
Expand Down Expand Up @@ -39,15 +39,18 @@ const values: {
<SectionLabel>
{{ t('about.values.label') }}
</SectionLabel>
<h2
<I18nT
keypath="about.values.heading"
Comment on lines +42 to +43

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: three of the five converted headings have no test. keypath is typed string in vue-i18n 11.4.10, so typecheck can't catch a typo here. I renamed this slot to #hl, changed StorySection's keypath to about.story.headng, and changed WireNodeLayout's to about.careers.whyTitl. The heading then rendered "We believe , own their process…", the raw key about.story.headng, and the raw key twice in the careers card. The full website suite (11,805 tests) still passed, and no e2e spec asserts these headings.

One table covering every heading component catches all three. Each row would be { component, locale, heading, highlight } with the exact-text and highlight-element assertions AudienceSection.test.ts already makes, and AudienceSection can become a row in it. FE-3069's acceptance criteria ask for this component-level coverage too. Prose because the fix is a new test file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added interpolatedHeadings.test.ts in a85eef5: one table over OurValuesSection, StorySection and AudienceSection in en and zh-CN (exact text plus the highlight as its own element), and a WireNodeLayout title-card case. Your three mutations, plus an Audience keypath typo, now each fail two rows. AudienceSection.test.ts folded into it.

tag="h2"
:i18n="translationsFor(locale)"
class="mt-6 text-3xl font-light text-primary-comfy-canvas lg:text-5xl"
>
{{ t('about.values.headingBefore')
}}<span class="text-primary-comfy-yellow">{{
t('about.values.headingHighlight')
}}</span
>{{ t('about.values.headingAfter') }}
</h2>
<template #highlight>
<span class="text-primary-comfy-yellow">{{
t('about.values.headingHighlight')
}}</span>
</template>
</I18nT>
</div>

<div class="mx-auto mt-16 max-w-5xl">
Expand Down
19 changes: 12 additions & 7 deletions apps/website/src/components/about/StorySection.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script setup lang="ts">
import type { Locale } from '@/i18n/translations'

import { I18nT } from 'vue-i18n'

import { translationsFor } from '@/i18n/translations'

const { locale = 'en' } = defineProps<{ locale?: Locale }>()
Expand All @@ -24,15 +26,18 @@ const investors = [
>
{{ t('about.story.label') }}
</span>
<h2
<I18nT
keypath="about.story.heading"
tag="h2"
:i18n="translationsFor(locale)"
class="mt-6 text-3xl font-light text-primary-comfy-canvas lg:text-5xl"
>
{{ t('about.story.headingBefore')
}}<span class="text-primary-comfy-yellow">{{
t('about.story.headingHighlight')
}}</span
>{{ t('about.story.headingAfter') }}
</h2>
<template #highlight>
<span class="text-primary-comfy-yellow">{{
t('about.story.headingHighlight')
}}</span>
</template>
</I18nT>
<p class="mt-8 text-base/relaxed text-primary-warm-white lg:text-lg">
{{ t('about.story.body') }}
</p>
Expand Down
68 changes: 31 additions & 37 deletions apps/website/src/components/common/WireNodeLayout.vue
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
<script setup lang="ts">
import type { Locale } from '@/i18n/translations'
import type { Locale, TranslationKey } from '@/i18n/translations'

import type { Ref } from 'vue'

import { cn } from '@comfyorg/tailwind-utils'
import { useResizeObserver, useTemplateRefsList } from '@vueuse/core'
import {
createReusableTemplate,
useResizeObserver,
useTemplateRefsList
} from '@vueuse/core'
import { computed, onMounted, ref, useSlots } from 'vue'

import { I18nT } from 'vue-i18n'

import { translationsFor } from '@/i18n/translations'

type TranslationKey = Parameters<typeof t>[0]
type Point = { x: number; y: number }

const {
reasons,
rightCardPadding = 'p-6',
titleBeforeKey = 'about.careers.whyTitleBefore',
titleAfterKey = 'about.careers.whyTitleAfter',
labelKey = 'about.careers.whyLabel',
variant = 'split',
locale = 'en'
} = defineProps<{
reasons: TranslationKey[]
rightCardPadding?: string
titleBeforeKey?: TranslationKey
titleAfterKey?: TranslationKey
labelKey?: TranslationKey
/**
* 'split' — title card + label pill on the left, wired to the reasons and
* on to the right card (/careers, /about). 'node' — a single label card
* wired to the reasons only (/forward-deployed-creatives).
*/
/** 'split' shows the title card above the label pill; 'node' shows the label as one card. */
variant?: 'split' | 'node'
locale?: Locale
}>()
const { t } = translationsFor(locale)
const [DefineWhyJoinTitle, WhyJoinTitle] = createReusableTemplate()

const slots = useSlots()
const hasRightCard = computed(() => !!slots['right-card'])
Expand Down Expand Up @@ -143,7 +141,25 @@ onMounted(() => {
</script>

<template>
<!-- Desktop layout -->
<DefineWhyJoinTitle>
<div class="rounded-2xl border border-white/10 bg-white/5 px-6 py-5">
<I18nT
keypath="about.careers.whyJoinTitle"
tag="p"
:i18n="translationsFor(locale)"
class="text-2xl font-light text-primary-comfy-canvas"
>
<template #br><br /></template>
<template #logo>
<span
class="mb-0.5 inline-block h-5 w-16 bg-primary-comfy-yellow align-middle"
style="mask: url(/icons/logo.svg) no-repeat center / contain"
/>
</template>
</I18nT>
</div>
</DefineWhyJoinTitle>

<div ref="containerRef" class="relative mx-auto hidden max-w-6xl lg:block">
<svg
class="pointer-events-none absolute inset-0 z-10 size-full overflow-visible"
Expand Down Expand Up @@ -173,18 +189,8 @@ onMounted(() => {
)
"
>
<!-- Left column: title + label (split) or single node card (node) -->
<div v-if="variant === 'split'" class="flex w-64 shrink-0 flex-col gap-3">
<div class="rounded-2xl border border-white/10 bg-white/5 px-6 py-5">
<p class="text-2xl font-light text-primary-comfy-canvas">
{{ t(titleBeforeKey) }}
<br />
<span
class="mb-0.5 inline-block h-5 w-16 bg-primary-comfy-yellow align-middle"
style="mask: url(/icons/logo.svg) no-repeat center / contain"
/>{{ t(titleAfterKey) }}
</p>
</div>
<WhyJoinTitle />
<div
class="flex items-center justify-end rounded-xl bg-white/5 px-5 py-3"
>
Expand Down Expand Up @@ -212,7 +218,6 @@ onMounted(() => {
/>
</div>

<!-- Center column: Reasons card -->
<div class="relative flex-1">
<span
v-if="hasRightCard"
Expand Down Expand Up @@ -249,7 +254,6 @@ onMounted(() => {
</div>
</div>

<!-- Right column: slot for card content -->
<div
v-if="hasRightCard"
:class="
Expand All @@ -276,7 +280,6 @@ onMounted(() => {
</div>
</div>

<!-- Mobile layout -->
<div
ref="mobileContainerRef"
class="relative mx-auto max-w-6xl overflow-x-clip lg:hidden"
Expand All @@ -302,16 +305,7 @@ onMounted(() => {
</svg>

<template v-if="variant === 'split'">
<div class="rounded-2xl border border-white/10 bg-white/5 px-6 py-5">
<p class="text-2xl font-light text-primary-comfy-canvas">
{{ t(titleBeforeKey) }}
<br />
<span
class="mb-0.5 inline-block h-5 w-16 bg-primary-comfy-yellow align-middle"
style="mask: url(/icons/logo.svg) no-repeat center / contain"
/>{{ t(titleAfterKey) }}
</p>
</div>
<WhyJoinTitle />

<div
class="mt-3 flex items-center justify-end rounded-xl bg-white/5 px-5 py-3"
Expand Down
93 changes: 93 additions & 0 deletions apps/website/src/components/interpolatedHeadings.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import type { Component } from 'vue'

import type { Locale } from '@/i18n/translations'

import { render, screen, within } from '@testing-library/vue'
import { describe, expect, it } from 'vitest'

import OurValuesSection from './about/OurValuesSection.vue'
import StorySection from './about/StorySection.vue'
import WireNodeLayout from './common/WireNodeLayout.vue'
import AudienceSection from './product/cloud/AudienceSection.vue'

type HighlightedHeadingCase = {
name: string
component: Component
locale: Locale
heading: string
highlight: string
}

const highlightedHeadings: HighlightedHeadingCase[] = [
{
name: 'OurValuesSection',
component: OurValuesSection,
locale: 'en',
heading:
'We believe everyone deserves to design exactly what they dream, own their process, and never compromise because of their software.',
highlight: 'everyone deserves to design exactly what they dream'
},
{
name: 'OurValuesSection',
component: OurValuesSection,
locale: 'zh-CN',
heading:
'我们相信每个人都值得设计出自己梦想中的作品,掌握自己的流程,永远不因软件而妥协。',
highlight: '每个人都值得设计出自己梦想中的作品'
},
{
name: 'StorySection',
component: StorySection,
locale: 'en',
heading:
'An open-source project that became the professional standard for visual AI.',
highlight: 'professional standard'
},
{
name: 'StorySection',
component: StorySection,
locale: 'zh-CN',
heading: '一个开源项目成为了视觉 AI 的行业标准。',
highlight: '行业标准'
},
{
name: 'AudienceSection',
component: AudienceSection,
locale: 'en',
heading: 'Built for creators who need quality, control, and simplicity.',
highlight: 'creators'
},
{
name: 'AudienceSection',
component: AudienceSection,
locale: 'zh-CN',
heading: '为追求质量、控制与简约的创作者而生。',
highlight: '创作者'
}
]

describe('interpolated headings', () => {
it.for(highlightedHeadings)(
'$name keeps the highlight inside the $locale heading',
({ component, locale, heading, highlight }) => {
render(component, { props: { locale } })

const title = screen.getByRole('heading', { level: 2 })
expect(title.textContent).toBe(heading)
expect(within(title).getByText(highlight)).toBeInTheDocument()
}
)

it.for([
{ locale: 'en', title: 'Why join?' },
{ locale: 'zh-CN', title: '为什么加入?' }
] as const)(
'WireNodeLayout renders the $locale title card as one message',
({ locale, title }) => {
render(WireNodeLayout, { props: { locale, reasons: [] } })

const cards = screen.getAllByText(title)
expect(cards.map((card) => card.textContent)).toEqual([title, title])
}
)
Comment on lines +81 to +92

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: this case passes when the card loses its logo or its line break. The logo span and the <br> contribute no text, so getAllByText('Why join?') and the textContent check match either way. Each of these mutations still passes all 11 tests at this head: renaming #logo to #logoo, renaming #br to #brr, emptying the #logo slot, and emptying #br. A keypath typo and a dropped mobile card do fail. So the description's "Keypath typos and renamed slots in each component fail it" holds for values, story, audience and models but not here. The case also can't tell the joined message from a split implementation written without whitespace, so "as one message" claims more than it checks.

The logo has no accessible name either (same as main), so screen readers already read this card as "Why join?" with the brand missing. That is also why no semantic query can reach it. Giving the span role="img" and an aria-label from a new key (for example about.careers.logoLabel: "Comfy" in all three catalogs) fixes both. The case can then assert within(card).getByRole('img', { name: 'Comfy' }) for each of the two cards. The {br} slot is presentational. Either drop it from the description's claim or accept that it is untested. Prose because the fix spans WireNodeLayout.vue, three catalogs and this test.

})
4 changes: 3 additions & 1 deletion apps/website/src/components/models/ModelsHeroSection.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import ModelsHeroSection from './ModelsHeroSection.vue'
describe('ModelsHeroSection', () => {
it.for([
{ locale: 'en', title: 'Flux in ComfyUI' },
{ locale: 'zh-CN', title: 'ComfyUI 中的 Flux' }
{ locale: 'zh-CN', title: 'ComfyUI 中的 Flux' },
{ locale: 'ja', title: 'ComfyUIのFlux' }
] as const)(
'places the brand where the $locale title puts it',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: the title says "places the brand", but the body only checks the heading text. I removed the yellow span from the #comfyui slot and all three rows still passed. One more line after the text assertion (L23-26) fails on that mutation 3/3 and passes at this head:

      expect(screen.getByText('ComfyUI')).toBeInTheDocument()

No other element in the section has the exact text "ComfyUI", so screen is enough here and within isn't needed. Prose because L23-26 is outside the diff hunk.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added; removing the span now fails all three rows.

({ locale, title }) => {
Expand All @@ -23,6 +24,7 @@ describe('ModelsHeroSection', () => {
new RegExp(`^${title}$`),
{ normalizeWhitespace: false }
)
expect(screen.getByText('ComfyUI')).toBeInTheDocument()
}
)
})
16 changes: 11 additions & 5 deletions apps/website/src/components/models/ModelsHeroSection.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script setup lang="ts">
import type { Locale } from '@/i18n/translations'

import { I18nT } from 'vue-i18n'

import { translationsFor } from '@/i18n/translations'
import BrandButton from '@/components/common/BrandButton.vue'

Expand All @@ -22,13 +24,17 @@ const { t } = translationsFor(locale)

<template>
<section class="flex flex-col items-center px-6 pt-16 text-center lg:pt-36">
<h1
<I18nT
keypath="models.list.heroTitle"
tag="h1"
:i18n="translationsFor(locale)"
class="max-w-4xl text-4xl font-light tracking-tight text-primary-comfy-canvas lg:text-6xl"
>
{{ t('models.list.heroTitleBefore', { name: modelName })
}}<span class="text-primary-comfy-yellow">ComfyUI</span
>{{ t('models.list.heroTitleAfter', { name: modelName }) }}
</h1>
<template #name>{{ modelName }}</template>
<template #comfyui>
<span class="text-primary-comfy-yellow">ComfyUI</span>
</template>
</I18nT>
<p
class="mt-6 max-w-2xl text-sm text-pretty text-primary-comfy-canvas lg:text-base"
>
Expand Down
Loading
Loading