-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Fix homepage localization for chip labels and translations #2275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2d24e22
d25005c
8ac09d3
fa2f11d
7cb77c4
ca8bf06
a6bfd6f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,6 +22,7 @@ | |
| import type { ProjectKind } from '@open-design/contracts'; | ||
| import type { DefaultScenarioPluginId } from '@open-design/contracts'; | ||
| import type { IconName } from '../Icon'; | ||
| import type { Dict } from '../../i18n/types'; | ||
|
|
||
| // Plugin ids the chip rail can dispatch to. Most chips route to a | ||
| // `DefaultScenarioPluginId` so the same fallback table the daemon | ||
|
|
@@ -59,19 +60,28 @@ export type ChipAction = | |
| // narrow viewports without horizontal scrolling. | ||
| export type ChipGroup = 'create' | 'migrate'; | ||
|
|
||
| export interface HomeHeroChip { | ||
| export interface CreateChip { | ||
| id: string; | ||
| label: string; | ||
| labelKey: keyof Dict; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| icon: IconName; | ||
| group: ChipGroup; | ||
| hint?: string; | ||
| group: 'create'; | ||
| action: ChipAction; | ||
| } | ||
|
|
||
| export interface MigrateChip { | ||
| id: string; | ||
| icon: IconName; | ||
| group: 'migrate'; | ||
| hint: string; | ||
| action: ChipAction; | ||
| } | ||
|
|
||
| export type HomeHeroChip = CreateChip | MigrateChip; | ||
|
|
||
| export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [ | ||
| { | ||
| id: 'prototype', | ||
| label: 'Prototype', | ||
| labelKey: 'homeHero.chip.prototype', | ||
| icon: 'palette', | ||
| group: 'create', | ||
| // Prototype now binds to the bundled `example-web-prototype` plugin, | ||
|
|
@@ -91,7 +101,7 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [ | |
| }, | ||
| { | ||
| id: 'deck', | ||
| label: 'Slide deck', | ||
| labelKey: 'homeHero.chip.deck', | ||
| icon: 'present', | ||
| group: 'create', | ||
| // Slide deck binds to `example-simple-deck`, which ships a 353-line | ||
|
|
@@ -112,7 +122,7 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [ | |
| }, | ||
| { | ||
| id: 'image', | ||
| label: 'Image', | ||
| labelKey: 'homeHero.chip.image', | ||
| icon: 'image', | ||
| group: 'create', | ||
| action: { | ||
|
|
@@ -129,7 +139,7 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [ | |
| }, | ||
| { | ||
| id: 'video', | ||
| label: 'Video', | ||
| labelKey: 'homeHero.chip.video', | ||
| icon: 'play', | ||
| group: 'create', | ||
| action: { | ||
|
|
@@ -146,7 +156,7 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [ | |
| }, | ||
| { | ||
| id: 'hyperframes', | ||
| label: 'HyperFrames', | ||
| labelKey: 'homeHero.chip.hyperframes', | ||
| icon: 'orbit', | ||
| group: 'create', | ||
| hint: 'Author HTML-based motion: captions, audio-reactive visuals, scene transitions.', | ||
|
|
@@ -158,7 +168,7 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [ | |
| }, | ||
| { | ||
| id: 'audio', | ||
| label: 'Audio', | ||
| labelKey: 'homeHero.chip.audio', | ||
| icon: 'mic', | ||
| group: 'create', | ||
| action: { | ||
|
|
@@ -175,15 +185,13 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [ | |
| }, | ||
| { | ||
| id: 'create-plugin', | ||
| label: 'Create plugin', | ||
| icon: 'edit', | ||
| group: 'migrate', | ||
| hint: 'Author a reusable Open Design plugin and add it to My plugins.', | ||
| action: { kind: 'create-plugin' }, | ||
| }, | ||
| { | ||
| id: 'figma', | ||
| label: 'From Figma', | ||
| icon: 'import', | ||
| group: 'migrate', | ||
| hint: 'Migrate a Figma frame into the active design system.', | ||
|
|
@@ -199,15 +207,13 @@ export const HOME_HERO_CHIPS: ReadonlyArray<HomeHeroChip> = [ | |
| }, | ||
| { | ||
| id: 'folder', | ||
| label: 'From folder', | ||
| icon: 'folder', | ||
| group: 'migrate', | ||
| hint: 'Import an existing local folder and continue editing.', | ||
| action: { kind: 'import-folder' }, | ||
| }, | ||
| { | ||
| id: 'template', | ||
| label: 'From template', | ||
| icon: 'file-code', | ||
| group: 'migrate', | ||
| hint: 'Start from a bundled template.', | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔁 Powered by Looper · runner=reviewer · agent=opencode · An autonomous AI dev team for your GitHub repos.apps/web/src/components/HomeHero.tsx:1534-1536adds the localized label/title path, but there still is no regression test covering that zh-CN behavior.apps/web/tests/components/HomeHero.rail.test.tsxcurrently only checks that each chip renders, routes clicks, and toggles state; it never asserts translated text or tooltips, so the earlierlabelKeytypo and English HyperFrames tooltip both would have passed the suite. Because this PR's goal is to eliminate mixed-language homepage UI, please extend that rail test to render underzh-CNand assert at least one translated create-chip label plus the localized HyperFrames tooltip.