返回 CodeWhale
native-terminal.ts
根目录 / web / lib / content / native-terminal.ts
1 import type { LocalizedText } from "./vocabulary";
2 import { pickText } from "@/lib/i18n/dictionaries";
3
4 /** Labels describe the captured application views; terminal contents stay verbatim. */
5 export const NATIVE_TERMINAL_VIEWS = {
6 home: {
7 label: { en: "Home", zh: "首页" },
8 description: {
9 en: "A new session, with the composer and status line.",
10 zh: "新会话界面,包含输入框与状态栏。",
11 },
12 },
13 composer: {
14 label: { en: "Composer", zh: "输入框" },
15 description: {
16 en: "A message in the composer, before it is sent.",
17 zh: "输入框中的消息,尚未发送。",
18 },
19 },
20 workbar: {
21 label: { en: "Workbar", zh: "工作栏" },
22 description: {
23 en: "The session dock, with tasks and other work views.",
24 zh: "会话工作栏,包含任务与其他工作视图。",
25 },
26 },
27 "workbar-fleet": {
28 label: { en: "Fleet", zh: "智能体团队" },
29 description: {
30 en: "The Fleet workbar in a new session.",
31 zh: "新会话中的智能体团队工作栏。",
32 },
33 },
34 "provider-picker": {
35 label: { en: "Providers", zh: "提供商" },
36 description: {
37 en: "Choose a provider for your model connection.",
38 zh: "为模型连接选择提供商。",
39 },
40 },
41 help: {
42 label: { en: "Help", zh: "帮助" },
43 description: {
44 en: "Commands and keyboard shortcuts in the help view.",
45 zh: "帮助视图中的命令与快捷键。",
46 },
47 },
48 } satisfies Record<string, { label: LocalizedText; description: LocalizedText }>;
49
50 export const NATIVE_TERMINAL_COPY = {
51 title: { en: "Inside the terminal", zh: "走进终端" },
52 description: {
53 en: "Explore Codewhale’s composer, workbar, provider picker and help.",
54 zh: "探索 Codewhale 的输入框、工作栏、提供商选择与帮助视图。",
55 },
56 viewsLabel: { en: "Terminal views", zh: "终端视图" },
57 scrollHint: { en: "Scroll sideways to see the full terminal.", zh: "左右滚动,查看完整终端。" },
58 componentsLink: { en: "Build with these components", zh: "使用这些组件构建应用" },
59 } satisfies Record<string, LocalizedText>;
60
61 export function getNativeTerminalCopy(locale: string) {
62 return {
63 title: pickText(NATIVE_TERMINAL_COPY.title, locale),
64 description: pickText(NATIVE_TERMINAL_COPY.description, locale),
65 viewsLabel: pickText(NATIVE_TERMINAL_COPY.viewsLabel, locale),
66 scrollHint: pickText(NATIVE_TERMINAL_COPY.scrollHint, locale),
67 componentsLink: pickText(NATIVE_TERMINAL_COPY.componentsLink, locale),
68 views: Object.fromEntries(Object.entries(NATIVE_TERMINAL_VIEWS).map(([id, view]) => [id, {
69 label: pickText(view.label, locale),
70 description: pickText(view.description, locale),
71 }])),
72 };
73 }
74
74 lines TYPESCRIPT