Open History to see the last commit
1import type { ExecutionEnvironmentPlatformOs, FileManagerRevealKind } from "@t3tools/contracts";
2import { msg } from "gt-react";
3
4import { m, type MessageResolver } from "~/i18n/messages";
5
6/** Components pass `useMessages()` so labels follow a language switch. */
7export 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
14export 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
23export 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}