The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import type { ExecutionEnvironmentPlatformOs, FileManagerRevealKind } from "@t3tools/contracts"; |
| 2 | import { msg } from "gt-react"; |
| 3 | |
| 4 | import { m, type MessageResolver } from "~/i18n/messages"; |
| 5 | |
| 6 | /** Components pass `useMessages()` so labels follow a language switch. */ |
| 7 | export function revealInFileExplorerLabel(platform: string, resolve: MessageResolver = m): string { |
| 8 | const normalized = platform.toLowerCase(); |
| 9 | if (normalized.includes("mac")) return resolve(msg("Reveal in Finder")); |
| 10 | if (normalized.includes("win")) return resolve(msg("Reveal in File Explorer")); |
| 11 | return resolve(msg("Reveal in Files")); |
| 12 | } |
| 13 | |
| 14 | export function revealInFileExplorerLabelForOs( |
| 15 | os: ExecutionEnvironmentPlatformOs, |
| 16 | resolve: MessageResolver = m, |
| 17 | ): string { |
| 18 | if (os === "darwin") return resolve(msg("Reveal in Finder")); |
| 19 | if (os === "windows") return resolve(msg("Reveal in File Explorer")); |
| 20 | return resolve(msg("Reveal in Files")); |
| 21 | } |
| 22 | |
| 23 | export function revealInFileExplorerLabelForKind( |
| 24 | kind: FileManagerRevealKind, |
| 25 | resolve: MessageResolver = m, |
| 26 | ): string { |
| 27 | if (kind === "finder") return resolve(msg("Reveal in Finder")); |
| 28 | if (kind === "file-explorer") return resolve(msg("Reveal in File Explorer")); |
| 29 | return resolve(msg("Reveal in Files")); |
| 30 | } |