@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 03:37 UTC

main
ts 37 lines 1.04 KB
Raw
1 import { EDITORS, type EditorId } from "@t3tools/contracts";
2
3 import { getLocalFileManagerName } from "~/lib/utils";
4 import { msg } from "gt-react";
5
6 import { m, type MessageResolver } from "./i18n/messages";
7
8 const editorLabels = new Map<EditorId, string>(EDITORS.map((editor) => [editor.id, editor.label]));
9
10 export function editorLabelForPlatform(
11 editorId: EditorId,
12 platform: string,
13 resolve: MessageResolver = m,
14 ): string {
15 if (editorId === "file-manager") {
16 return getLocalFileManagerName(platform, resolve);
17 }
18
19 return (
20 editorLabels.get(editorId) ?? resolve(msg("Editor", { $context: "noun, a code editor app" }))
21 );
22 }
23
24 export function openInEditorMenuLabel(
25 editorId: EditorId | null,
26 resolve: MessageResolver = m,
27 ): string {
28 return editorId === null || editorId === "file-manager"
29 ? resolve(msg("Open in editor"))
30 : resolve(
31 msg("Open in {editor}", {
32 editor:
33 editorLabels.get(editorId) ??
34 resolve(msg("Editor", { $context: "noun, a code editor app" })),
35 }),
36 );
37 }