返回 CodeWhale
types.ts
根目录 / web / lib / i18n / dictionaries / types.ts
1 /**
2 * Dictionary shapes for the website localization layer (#3091, #4934).
3 *
4 * `ChromeDict` covers shared chrome: the newspaper masthead, nav, mobile
5 * menu, theme toggle, live ticker, footer, and the locale switcher with its
6 * visible partial-pack badge. `HomeDict` covers the landing page
7 * (`app/[locale]/page.tsx`). Templates use `{name}` tokens interpolated
8 * with `fill()` from dictionaries/index.ts — never concatenate translated
9 * sentences around variables in JSX.
10 *
11 * English (`dictionaries/en/`) is the reference shape; every routed locale —
12 * including Chinese — must define exactly the same keys. Parity is enforced
13 * by `web/scripts/check-locales.mjs` and `web/lib/i18n/dictionaries.test.ts`.
14 * A locale without a dictionary falls back to the English one at lookup
15 * time, so an untranslated string renders English copy — never a key.
16 *
17 * Code-owned strings stay out of these dictionaries per docs/VOICE.md:
18 * "Plan · Work · Operate", "Ask · Auto-Review · Full Access",
19 * "TUI · exec · web · API", "Codewhale", "GitHub", "Issues",
20 * `npm install -g codewhale`, `cargo test --locked`, `codewhale exec`,
21 * package-manager proper nouns, mirror names, and captured media paths.
22 */
23
24 import type { PluralForms } from "../plural";
25
26 export interface ChromeDict {
27 // --- primary nav labels (components/nav.tsx via lib/i18n/links.ts) ---
28 navDocs: string;
29 navContribute: string;
30 navSignIn: string;
31 navDesktop: string;
32
33 navFeatures: string;
34 navModels: string;
35 navPlugins: string;
36
37 /**
38 * Skip-to-content link rendered before the nav in app/[locale]/layout.tsx.
39 * It sits on EVERY page of EVERY locale, so it belongs to shared chrome —
40 * leaving it hardcoded is what kept an EN/ZH branch alive in the layout.
41 */
42 skipToContent: string;
43
44 /** aria-label for the primary <nav> landmark (components/nav-links.tsx). */
45 navPrimaryAria: string;
46 /** aria-label for the wordmark link back to the locale home. */
47 navHomeAria: string;
48
49 /** Mobile-menu and masthead call to action, e.g. "Install →". */
50 installCta: string;
51
52 /**
53 * BCP 47 tag used for the masthead weekday via `toLocaleDateString` — not
54 * rendered copy, but per-locale, so it belongs beside it. Without this the
55 * masthead date renders in English for every non-Chinese locale.
56 */
57 dateLocale: string;
58
59 /** Mobile-menu toggle labels. */
60 menuOpen: string;
61 menuClose: string;
62 translationMachineDraft: string;
63
64 /** Docs theme toggle: the three cycle states. */
65 themeAuto: string;
66 themeLight: string;
67 themeDark: string;
68 /** Theme toggle aria-label, e.g. "Docs theme: {mode} (click to cycle)". */
69 themeAria: string;
70 /** Theme toggle title attribute. */
71 themeTitle: string;
72
73 // --- footer ---
74 footerProduct: string;
75 footerProject: string;
76 footerDocs: string;
77 footerGuide: string;
78 footerInstall: string;
79 footerModels: string;
80 footerFaq: string;
81 footerContribute: string;
82 footerRoadmap: string;
83 footerLicense: string;
84 footerMerch: string;
85 /** Footer link to the terms route, e.g. "Terms". */
86 footerTerms: string;
87 /** Footer link to the privacy route, e.g. "Privacy". */
88 footerPrivacy: string;
89 /** Footer Product-column link to the release record, e.g. "Changelog". */
90 footerChangelog: string;
91 /** Prefix before the canonical-source link, e.g. "Canonical source: ". */
92 footerCanonicalSource: string;
93 /** Separator + label before the releases link, e.g. " · Releases: ". */
94 footerReleases: string;
95 /** Link text for the GitHub releases page. */
96 footerReleasesLink: string;
97 /** Link text for the security-contact mailto. */
98 footerSecurity: string;
99 footerLegal: string;
100
101 /** aria-label for the locale switcher control. */
102 switcherLabel: string;
103 /** Two-locale toggle aria-label, e.g. "Switch to {label}". */
104 switcherSwitchTo: string;
105 /**
106 * Visible badge marking a partial locale pack in the switcher, e.g.
107 * "(partial)" — honest scope signal, per the localization quality
108 * contract. Keep it short. The switcher shows it, brackets stripped, as
109 * the heading of the group that lists partial packs.
110 */
111 partialBadge: string;
112
113 stateReleased: string;
114 stateAvailable: string;
115 stateBeta: string;
116 stateDev: string;
117 stateOpen: string;
118 stateInviteOnly: string;
119 stateNotOpen: string;
120 stateNotPublic: string;
121 stateInSource: string;
122 numbersAsOf: string;
123 downloadMacos: string;
124 downloadVersion: string;
125 downloadSize: string;
126 downloadChecksum: string;
127 downloadSigned: string;
128 downloadLinux: string;
129 downloadAptTitle: string;
130 downloadAptTrust: string;
131 downloadAppImage: string;
132 downloadAppImageTrust: string;
133 downloadAptFingerprint: string;
134 }
135
136 export interface FeaturesDict {
137 title: string;
138 description: string;
139 notice: string;
140 stable: string;
141 flagged: string;
142 experimental: string;
143 partial: string;
144 preview: string;
145 none: string;
146 docs: string;
147 source: string;
148 exportJson: string;
149 }
150
151 export interface HomeDict {
152 /**
153 * `<title>` and meta description for the locale home route, consumed by
154 * `generateMetadata` in app/[locale]/layout.tsx.
155 */
156 metaTitle: string;
157 metaDescription: string;
158
159 /** A complete headline that wraps naturally in each locale. */
160 heroTitle: string;
161 heroTitleLead: string;
162 /**
163 * Hero lede. Carries a `{brand}` token so the brand can be typeset in its
164 * own span wherever the sentence needs it — the page splits on the token
165 * instead of concatenating fragments around it.
166 */
167 heroIntro: string;
168 readTheCode: string;
169 installNote: string;
170 captionReleased: string;
171 captureFrameNoPosture: string;
172 frameLabelPrompt: string;
173 frameLabelEdit: string;
174 frameLabelApproval: string;
175 frameLabelResult: string;
176 /** One accessible summary for each terminal frame the home shows. */
177 frameSummaryPrompt: string;
178 frameSummaryEdit: string;
179 frameSummaryApproval: string;
180 frameSummaryResult: string;
181 frameSummaryProvider: string;
182 frameSummaryReceipt: string;
183 /** Primary action → /install, e.g. "Get Codewhale". */
184 getCodewhale: string;
185 /** Accessible name for the hero install command and its platform choice. */
186 heroInstallAria: string;
187 /** Accessible name for a terminal capture's region and for the frame tabs. */
188 shotPreview: string;
189
190 copy: string;
191 copied: string;
192
193 /** `{n}` is the contributor count; pick the form with `pluralText`. */
194 contributorsCount: PluralForms;
195 /** Accessible name for the home's short list of facts. */
196 factsLabel: string;
197 factRust: string;
198 /** `{license}` is the licence name from the generated facts. */
199 factLicense: string;
200 /** `{n}` is the provider route count of the published release. */
201 factProviders: PluralForms;
202 /** `{n}` is the catalog model count of the published release. */
203 factModels: PluralForms;
204
205 sectionModelHeading: string;
206 sectionModelBody: string;
207 sectionControlHeading: string;
208 sectionControlBody: string;
209 sectionAgentsHeading: string;
210 sectionAgentsBody: string;
211 agentsRolesLabel: string;
212 agentRoleExplore: string;
213 agentRoleImplement: string;
214 agentRoleReviewer: string;
215 agentsLink: string;
216 directionShotAlt: string;
217 directionShotCaption: string;
218 directionShotLink: string;
219 sectionDirectionHeading: string;
220 sectionDirectionBody: string;
221 sectionOpenHeading: string;
222 sectionOpenBody: string;
223 sectionStartHeading: string;
224 sectionStartBody: string;
225
226 mapHeading: string;
227 mapStateReleased: string;
228 mapStateDeveloping: string;
229 mapStateInviteOnly: string;
230 mapStateBeingBuilt: string;
231 mapTerminal: string;
232 mapTerminalSentence: string;
233 mapLocalBrowser: string;
234 mapLocalBrowserSentence: string;
235 mapManyAgents: string;
236 mapManyAgentsSentence: string;
237 mapDesktop: string;
238 mapDesktopSentence: string;
239 mapCloud: string;
240 mapCloudSentence: string;
241 mapOneSession: string;
242 mapOneSessionSentence: string;
243 }
244
245 /**
246 * Docs "Getting started" page (`app/[locale]/docs/guide/page.tsx`).
247 *
248 * First of the per-page dictionaries that retire the page-body `isZh`
249 * branches left after #4934. Page dictionaries are optional per locale:
250 * English is the required reference, any other locale that ships the file
251 * is held to exact key parity (`check-locales.mjs` OPTIONAL_FILES), and a
252 * locale without it falls back to English at lookup time — matching how
253 * page bodies already behave for partial locales.
254 */
255 export interface DocsGuideDict {
256 metaTitle: string;
257 metaDescription: string;
258 /** Body-copy typography for this locale (CJK needs looser leading). */
259 bodyClassName: string;
260 overviewTitle: string;
261 overviewLead: string;
262 sessionTitle: string;
263 sessionLead: string;
264 nextTitle: string;
265 sourceNote: string;
266 }
267
268 /**
269 * The docs shell: the portal hero in `app/[locale]/docs/layout.tsx` that
270 * wraps every docs page, plus the metadata of the hub page it frames
271 * (`app/[locale]/docs/page.tsx`, whose body is the `DocsSearch` component).
272 *
273 * No `bodyClassName` here: the hero typesets through `portal-*` classes,
274 * which never varied by locale.
275 */
276 export interface DocsShellDict {
277 metaTitle: string;
278 metaDescription: string;
279 heroTitle: string;
280 heroLead: string;
281 installCta: string;
282
283 // --- release truth band (docs layout; facts + CHANGELOG.md) ---
284 /** Eyebrow over the band, e.g. "Release". */
285 releaseLabel: string;
286 /** "Latest release {tag} · {date}" — date already formatted per locale. */
287 releasePublished: string;
288 releaseDescribes: string;
289 sourceLead: string;
290 /** Link to the /changelog route. */
291 releaseChangelog: string;
292
293 // --- task/topic search (components/docs-search.tsx) ---
294 searchLabel: string;
295 searchPlaceholder: string;
296 searchLoading: string;
297 searchUnavailable: string;
298 searchRetry: string;
299 searchClear: string;
300 /** "{matched} of {total} entries match “{query}”". */
301 searchMatches: string;
302 /** "Nothing matches “{query}”". */
303 searchNoMatches: string;
304 tasksHeading: string;
305 tasksLead: string;
306 topicsHeading: string;
307 /** Row tag for a first-party page. */
308 webGuideTag: string;
309 /** Row tag for a GitHub source document. */
310 sourceDocTag: string;
311 /** Per-row disclosure that reveals the repository files a topic comes from. */
312 sourceDetails: string;
313 emptyTitle: string;
314 emptyBody: string;
315 emptyCta: string;
316 indexNote: string;
317
318 // --- sidebar and breadcrumb (components/docs-sidebar.tsx, docs-breadcrumb.tsx) ---
319 sidebarHeading: string;
320 sidebarAria: string;
321 breadcrumbAria: string;
322 breadcrumbHome: string;
323 breadcrumbDocs: string;
324
325 // --- contextual help band under every docs page ---
326 helpTitle: string;
327 helpLead: string;
328 /** "Source: {name}" — the topic's repository document(s). */
329 helpSource: string;
330 helpTroubleshooting: string;
331 helpFaq: string;
332 helpDiscord: string;
333 helpIssue: string;
334
335 // --- docs page bodies (app/[locale]/docs/_components/doc-article.tsx) ---
336 /** Heading over each page's closing "where to go next" links. */
337 nextHeading: string;
338 /** Word (with its punctuation) that marks an aside, so it reads without color. */
339 noteLabel: string;
340 /** Accessible name of a page's table of contents. */
341 onThisPage: string;
342
343 // --- session recording panel (components/session-media.tsx) ---
344 /** Shown in place of a recording that has not been made yet. */
345 mediaPendingNote: string;
346 mediaPlanLink: string;
347 mediaGifFallback: string;
348 mediaTranscript: string;
349 }
350
351 /**
352 * Shared surface states (`components/surface-state.tsx`,
353 * `components/connection-banner.tsx`, the `loading.tsx` / `error.tsx` /
354 * `not-found.tsx` boundaries). One dictionary for every empty, loading,
355 * error, retry, recovery, and connection state so no page invents its own.
356 */
357 export interface StatesDict {
358 loadingLabel: string;
359 emptyTitle: string;
360 emptyBody: string;
361 errorTitle: string;
362 errorBody: string;
363 retry: string;
364 reload: string;
365 homeLink: string;
366 /** Documentation recovery link on the 404 page. */
367 docsIndexLink: string;
368 notFoundTitle: string;
369 notFoundBody: string;
370 notFoundHomeLink: string;
371 /** Alt text for the 404 poster (public/codwhale-404.webp). */
372 notFoundPosterAlt: string;
373 /**
374 * A data-bearing page whose source was not asked (build-time prerender)
375 * or refused (rate limit, outage). Distinct from `empty`, which asserts
376 * that nothing exists, and from `error`, which means the render threw.
377 */
378 unavailableTitle: string;
379 unavailableBody: string;
380 /** Connection banner (typed state in lib/connection-state.ts). */
381 offlineTitle: string;
382 offlineBody: string;
383 reconnectingTitle: string;
384 /** "Checking the connection (attempt {attempt})." */
385 reconnectingBody: string;
386 degradedTitle: string;
387 degradedBody: string;
388 onlineTitle: string;
389 onlineBody: string;
390 retryNow: string;
391 dismiss: string;
392 /** "Last checked {time}". */
393 lastChecked: string;
394 }
395
396 /* ------------------------------------------------------------------ */
397 /* Docs page bodies */
398 /* ------------------------------------------------------------------ */
399
400 /**
401 * One content block on a docs page. Strings are prose: `code` in backticks
402 * is typeset as inline code and `[label](/docs/x)` becomes a locale-aware
403 * link (see `app/[locale]/docs/_components/doc-article.tsx`). Commands in
404 * `code` blocks are shown verbatim and must match the engine source.
405 */
406 export type DocsBlock =
407 | { p: string }
408 /** A copyable command or config block; `lang` labels it (e.g. "Terminal"). */
409 | { code: string; lang?: string }
410 /** A `[term, detail]` table; `codeTerms` sets the term column as code. */
411 | { rows: readonly (readonly [string, string])[]; codeTerms?: boolean }
412 /** Numbered steps, in order. */
413 | { steps: readonly string[] }
414 /** An unordered list. */
415 | { list: readonly string[] }
416 /** A short aside: a limit, a caution, or something not built yet. */
417 | { note: string };
418
419 export interface DocsSection {
420 /** Stable anchor id. */
421 id: string;
422 title: string;
423 blocks: readonly DocsBlock[];
424 until?: { feature: string; describesCurrentRow?: boolean };
425 }
426
427 export interface DocsSourceGroup {
428 claim: { feature: string; describesCurrentRow?: boolean };
429 sections: readonly DocsSection[];
430 }
431
432 /**
433 * The one shape every task page in `/docs` uses: what this page helps you
434 * do (title + lede), how (sections), and where to go next.
435 */
436 export interface DocsPageDict {
437 metaTitle: string;
438 metaDescription: string;
439 /** Body-copy typography for this locale (CJK needs looser leading). */
440 bodyClassName: string;
441 title: string;
442 /** What the reader can do here and why — two sentences at most. */
443 lede: string;
444 sections: readonly DocsSection[];
445 /** Where to go next; `href` is locale-relative. */
446 next: readonly { href: string; label: string; note: string }[];
447 /** Maintainer pointer, kept out of the rendered copy. */
448 sourceNote: string;
449 sourceGroups?: readonly DocsSourceGroup[];
450 }
451
452 export type DocsReviewDict = DocsPageDict;
453
454 export type DocsAuthDict = DocsPageDict;
455
456 export type DocsTrustDict = DocsPageDict;
457
458 export type DocsFirstTimeDict = DocsPageDict;
459
460 /** `app/[locale]/changelog/page.tsx` — version-aware release record. */
461 export interface ChangelogDict {
462 metaTitle: string;
463 metaDescription: string;
464 kicker: string;
465 title: string;
466 lead: string;
467 publishedLabel: string;
468 /** "{tag} · published {date}" */
469 publishedValue: string;
470 candidateLabel: string;
471 /** "{version} · unreleased" */
472 candidateValue: string;
473 /** Shown when the candidate equals the published release. */
474 candidateMatches: string;
475 releasesLink: string;
476 unreleasedHeading: string;
477 unreleasedNote: string;
478 compareLink: string;
479 releasePageLink: string;
480 /** "{shown} of {total} entries" */
481 moreEntries: string;
482 fullNotes: string;
483 /** "Full notes for {version}" — links /changelog/<version>, or CHANGELOG.md for Unreleased. */
484 releaseNotesLink: string;
485 emptyTitle: string;
486 emptyBody: string;
487 /** `/changelog/[version]` — every entry for one release. */
488 versionMetaTitle: string;
489 versionMetaDescription: string;
490 versionKicker: string;
491 /** "Released {date}. …" */
492 versionLead: string;
493 versionLeadUndated: string;
494 allReleasesLink: string;
495 }
496
497 export interface LegalTermsDict {
498 metaTitle: string;
499 metaDescription: string;
500 kicker: string;
501 title: string;
502 /** "Effective and last updated {date}." — zh also says the English text binds. */
503 updated: string;
504 privacyLink: string;
505 homeLink: string;
506 }
507
508 export interface LegalPrivacyDict {
509 metaTitle: string;
510 metaDescription: string;
511 kicker: string;
512 title: string;
513 /** Same template as `LegalTermsDict.updated`. */
514 updated: string;
515 termsLink: string;
516 homeLink: string;
517 }
518
519 /** `app/[locale]/faq/page.tsx` and its `components/faq-search.tsx`. */
520 export interface FaqDict {
521 metaTitle: string;
522 metaDescription: string;
523 eyebrow: string;
524 /** Page H1. */
525 title: string;
526 /** The H1 again in the other script, set beside it (the bilingual Han title). */
527 titleAside: string;
528 /** BCP 47 language of `titleAside`. */
529 titleAsideLang: string;
530 lead: string;
531 notCovered: string;
532 openIssue: string;
533 searchPlaceholder: string;
534 searchLabel: string;
535 searchClear: string;
536 /** `{matched}`, `{total}` and `{query}` are filled at render time. */
537 searchMatches: string;
538 /** `{query}` is filled at render time. */
539 searchNoMatches: string;
540 /** Extra classes on each answer. Empty in both locales today: CJK leading lives in `.prose` (primitives.css). */
541 answerClassName: string;
542 sourcesLabel: string;
543 noResultsTitle: string;
544 noResultsBody: string;
545 }
546
547 /** `app/[locale]/docs/vocabulary/page.tsx`. */
548 export interface DocsVocabularyDict {
549 metaTitle: string;
550 metaDescription: string;
551 /** Classes on every body paragraph; zh loosens leading and tracking. */
552 bodyClassName: string;
553 /** Page H1. */
554 title: string;
555 lead: string;
556 executionHeading: string;
557 controlHeading: string;
558 controlLead: string;
559 sourceControlHeading: string;
560 routeHeading: string;
561 advisoryHeading: string;
562 measurementHeading: string;
563 leaderboardNote: string;
564 /** Maintainer pointer, carried in a hidden `data-source-note`. */
565 sourceNote: string;
566 }
567
568 /** `app/[locale]/contribute/page.tsx`. */
569 export interface ContributeDict {
570 metaTitle: string;
571 metaDescription: string;
572 kicker: string;
573 /** Page H1. */
574 title: string;
575 lede: string;
576 fileIssue: string;
577 browsePulls: string;
578 fullGuide: string;
579 pathsTitle: string;
580 workflowTitle: string;
581 reviewTitle: string;
582 reviewScope: string;
583 devTitle: string;
584 devScope: string;
585 /** `{n}` is the number of GitHub accounts; pick the form with `pluralText`. */
586 mergedAccountsCount: PluralForms;
587 /** `{n}` is the number of people; used once the exclusion list is confirmed. */
588 mergedPeopleCount: PluralForms;
589 }
590
591 /** `app/[locale]/constitution/page.tsx` and its `components/thinking-trace.tsx`. */
592 export interface ConstitutionDict {
593 metaTitle: string;
594 metaDescription: string;
595 kicker: string;
596 /** Page H1. */
597 title: string;
598 /** The H1 again in the other script, set beside it (the bilingual Han title). */
599 titleAside: string;
600 /** BCP 47 language of `titleAside`. */
601 titleAsideLang: string;
602 lede: string;
603 /** Status label on the setup callout. */
604 since: string;
605 sinceBody: string;
606 rankTitle: string;
607 rankScope: string;
608 boundaryTitle: string;
609 boundaryBody: string;
610 traceTitle: string;
611 traceScope: string;
612 /** The label every traced scene carries: these are illustrations, not transcripts. */
613 illustration: string;
614 install: string;
615 configuration: string;
616 }
617
618 export type DocsHooksDict = DocsPageDict;
619
620 export type DocsTroubleshootingDict = DocsPageDict;
621
622 export type DocsConfigurationDict = DocsPageDict;
623
624 export type DocsFleetDict = DocsPageDict;
625
626 export type DocsMcpDict = DocsPageDict;
627
628 export type DocsModesDict = DocsPageDict;
629
630 export type DocsRuntimeApiDict = DocsPageDict;
631
632 export type DocsSandboxDict = DocsPageDict;
633
634 export type DocsSubagentsDict = DocsPageDict;
635
636 export type DocsWebDict = DocsPageDict;
637
638 export type DocsWorkDict = DocsPageDict;
639
640 export type DocsPetDict = DocsPageDict;
641
642 /** Copy for `app/[locale]/computer-use/page.tsx` and the install page's Computer Use section. */
643 export interface ComputerUseDict {
644 metaTitle: string;
645 metaDescription: string;
646 title: string;
647 lead: string;
648 publisher: string;
649 /** Primary button: the notarized disk image when the release carries one, else the archive. */
650 download: string;
651 /** Secondary link to the archive the in-app updater consumes. */
652 downloadZip: string;
653 requirements: string;
654 included: string;
655 pendingTitle: string;
656 pendingBody: string;
657 unavailableTitle: string;
658 unavailableBody: string;
659 releases: string;
660 receipt: string;
661 setup: string;
662 /** Four numbered setup steps, rendered in order. */
663 steps: { title: string; body: string }[];
664 controlsTitle: string;
665 controlsBody: string;
666 updateTitle: string;
667 updateBody: string;
668 help: string;
669 notes: string;
670 demo: string;
671 source: string;
672 platforms: string;
673 connectTitle: string;
674 connectVersion: string;
675 connectLimit: string;
676 connectRuntime: string;
677 connectReload: string;
678 connectPrompt: string;
679 connectExpected: string;
680 connectGuide: string;
681 contributeTitle: string;
682 contributeBody: string;
683 contributeGuide: string;
684 contributeIssue: string;
685 }
686
687 export type ProjectDict = typeof import("./en/project").project;
688
688 lines TYPESCRIPT