Create polished demo videos without editing skills. Mac/Windows/Linux
feat: scaffold language selection UI (no locale translations)
webadderall366cdbb9f90f
diff --git a/src/components/launch/LaunchWindow.tsx b/src/components/launch/LaunchWindow.tsxindex 24f26a43..0aa8ff5e 100644--- a/src/components/launch/LaunchWindow.tsx+++ b/src/components/launch/LaunchWindow.tsx@@ -4,6 +4,7 @@ import { FaRegStopCircle } from "react-icons/fa";import { FaFolderOpen } from "react-icons/fa6";import { FiMinus, FiX } from "react-icons/fi";import { MdMic, MdMicOff, MdMonitor, MdVideoFile, MdVolumeOff, MdVolumeUp } from "react-icons/md";+import { Languages } from "lucide-react";import { RxDragHandleDots2 } from "react-icons/rx";import { useAudioLevelMeter } from "../../hooks/useAudioLevelMeter";import { useMicrophoneDevices } from "../../hooks/useMicrophoneDevices";@@ -11,9 +12,21 @@ import { useScreenRecorder } from "../../hooks/useScreenRecorder";import { Button } from "../ui/button";import { AudioLevelMeter } from "../ui/audio-level-meter";import { ContentClamp } from "../ui/content-clamp";+import {+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuItem,+ DropdownMenuTrigger,+} from "../ui/dropdown-menu";+import { useI18n } from "@/contexts/I18nContext";+import { SUPPORTED_LOCALES } from "@/i18n/config";+import type { AppLocale } from "@/i18n/config";import styles from "./LaunchWindow.module.css";export function LaunchWindow() {+ const { locale, setLocale } = useI18n();++ const LOCALE_LABELS: Record<string, string> = { en: "EN", es: "ES", "zh-CN": "中文" };const {recording,toggleRecording,@@ -283,6 +296,35 @@ export function LaunchWindow() {><FaFolderOpen size={14} /></Button>+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <Button+ variant="link"+ size="icon"+ title="Language"+ className={`text-white/70 hover:bg-transparent ${styles.electronNoDrag}`}+ >+ <Languages size={14} />+ </Button>+ </DropdownMenuTrigger>+ <DropdownMenuContent+ side="top"+ align="end"+ className="min-w-[90px] bg-[rgba(28,28,36,0.97)] border-white/15 text-white/90 backdrop-blur-xl"+ >+ {SUPPORTED_LOCALES.map((code) => (+ <DropdownMenuItem+ key={code}+ onSelect={() => setLocale(code as AppLocale)}+ className={`text-xs cursor-pointer ${+ locale === code ? "text-white font-medium" : "text-white/60"+ }`}+ >+ {LOCALE_LABELS[code] ?? code}+ </DropdownMenuItem>+ ))}+ </DropdownMenuContent>+ </DropdownMenu><div className={dividerClass} /><Buttonvariant="link"diff --git a/src/components/video-editor/VideoEditor.tsx b/src/components/video-editor/VideoEditor.tsxindex 8927f9cd..aee7ae37 100644--- a/src/components/video-editor/VideoEditor.tsx+++ b/src/components/video-editor/VideoEditor.tsx@@ -4,7 +4,10 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";import { Toaster } from "@/components/ui/sonner";import { toast } from "sonner";import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";-import { FolderOpen } from "lucide-react";+import { FolderOpen, Languages } from "lucide-react";+import { useI18n } from "@/contexts/I18nContext";+import { SUPPORTED_LOCALES } from "@/i18n/config";+import type { AppLocale } from "@/i18n/config";import VideoPlayback, { VideoPlaybackRef } from "./VideoPlayback";import PlaybackControls from "./PlaybackControls";@@ -74,7 +77,27 @@ type PendingExportSave = {arrayBuffer: ArrayBuffer;};+function LanguageSwitcher() {+ const { locale, setLocale, t } = useI18n();+ const idx = SUPPORTED_LOCALES.indexOf(locale as typeof SUPPORTED_LOCALES[number]);+ const next = SUPPORTED_LOCALES[(idx + 1) % SUPPORTED_LOCALES.length] as AppLocale;+ const labels: Record<string, string> = { en: "EN", es: "ES", "zh-CN": "中文" };+ return (+ <button+ type="button"+ onClick={() => setLocale(next)}+ className="inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-white/90 transition hover:bg-white/8 hover:text-white cursor-pointer"+ title={t("common.app.language", "Language")}+ aria-label={t("common.app.language", "Language")}+ >+ <Languages className="h-4 w-4" />+ <span className="text-xs font-normal">{labels[locale] ?? locale.toUpperCase()}</span>+ </button>+ );+}+export default function VideoEditor() {+ const { t } = useI18n();const [videoPath, setVideoPath] = useState<string | null>(null);const [videoSourcePath, setVideoSourcePath] = useState<string | null>(null);const [currentProjectPath, setCurrentProjectPath] = useState<string | null>(null);@@ -1590,17 +1613,22 @@ export default function VideoEditor() {style={{ WebkitAppRegion: 'drag' } as React.CSSProperties}><span className="text-sm font-semibold tracking-tight text-white/90">Recordly</span>- <button- type="button"- onClick={() => void openRecordingsFolder()}- className="absolute right-4 inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-white/90 transition hover:bg-white/8 hover:text-white cursor-pointer"+ <div+ className="absolute right-4 flex items-center gap-1"style={{ WebkitAppRegion: 'no-drag' } as React.CSSProperties}- title="Open recordings folder"- aria-label="Open recordings folder">- <FolderOpen className="h-4 w-4" />- <span className="text-xs font-normal">Manage recordings</span>- </button>+ <LanguageSwitcher />+ <button+ type="button"+ onClick={() => void openRecordingsFolder()}+ className="inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-white/90 transition hover:bg-white/8 hover:text-white cursor-pointer"+ title={t("common.app.manageRecordings", "Open recordings folder")}+ aria-label={t("common.app.manageRecordings", "Open recordings folder")}+ >+ <FolderOpen className="h-4 w-4" />+ <span className="text-xs font-normal">{t("common.app.manageRecordings", "Manage recordings")}</span>+ </button>+ </div></div><div className="flex-1 p-5 gap-4 flex min-h-0 relative">diff --git a/src/contexts/I18nContext.tsx b/src/contexts/I18nContext.tsxindex bfe50fe3..de9d139b 100644--- a/src/contexts/I18nContext.tsx+++ b/src/contexts/I18nContext.tsx@@ -28,6 +28,13 @@ import esLaunch from '@/i18n/locales/es/launch.json'import esSettings from '@/i18n/locales/es/settings.json'import esShortcuts from '@/i18n/locales/es/shortcuts.json'import esTimeline from '@/i18n/locales/es/timeline.json'+import zhCNCommon from '@/i18n/locales/zh-CN/common.json'+import zhCNDialogs from '@/i18n/locales/zh-CN/dialogs.json'+import zhCNEditor from '@/i18n/locales/zh-CN/editor.json'+import zhCNLaunch from '@/i18n/locales/zh-CN/launch.json'+import zhCNSettings from '@/i18n/locales/zh-CN/settings.json'+import zhCNShortcuts from '@/i18n/locales/zh-CN/shortcuts.json'+import zhCNTimeline from '@/i18n/locales/zh-CN/timeline.json'const LOCALE_STORAGE_KEY = 'recordly.locale'@@ -52,6 +59,15 @@ const messages: Record<AppLocale, LocaleBundle> = {dialogs: esDialogs,shortcuts: esShortcuts,},+ 'zh-CN': {+ common: zhCNCommon,+ launch: zhCNLaunch,+ editor: zhCNEditor,+ timeline: zhCNTimeline,+ settings: zhCNSettings,+ dialogs: zhCNDialogs,+ shortcuts: zhCNShortcuts,+ },} as constinterface I18nContextValue {@@ -71,8 +87,21 @@ function normalizeLocale(locale: string | null | undefined): AppLocale {return DEFAULT_LOCALE}- const normalized = locale.toLowerCase().split('-')[0]- return isSupportedLocale(normalized) ? normalized : DEFAULT_LOCALE+ // Exact match first (e.g. "zh-CN")+ if (isSupportedLocale(locale)) return locale++ // Canonicalize case (e.g. "zh-cn" → "zh-CN")+ const canonical = SUPPORTED_LOCALES.find(+ (l) => l.toLowerCase() === locale.toLowerCase(),+ )+ if (canonical) return canonical++ // Language-only fallback (e.g. "zh" matches "zh-CN")+ const lang = locale.split('-')[0].toLowerCase()+ const byLang = SUPPORTED_LOCALES.find((l) => l.split('-')[0].toLowerCase() === lang)+ if (byLang) return byLang++ return DEFAULT_LOCALE}function getInitialLocale(): AppLocale {diff --git a/src/i18n/config.ts b/src/i18n/config.tsindex b01deaaa..ce23fd41 100644--- a/src/i18n/config.ts+++ b/src/i18n/config.ts@@ -1,6 +1,6 @@export const DEFAULT_LOCALE = 'en' as const-export const SUPPORTED_LOCALES = ['en', 'es'] as const+export const SUPPORTED_LOCALES = ['en', 'es', 'zh-CN'] as constexport const I18N_NAMESPACES = ['common',diff --git a/src/i18n/locales/zh-CN/common.json b/src/i18n/locales/zh-CN/common.jsonnew file mode 100644index 00000000..0967ef42--- /dev/null+++ b/src/i18n/locales/zh-CN/common.json@@ -0,0 +1 @@+{}diff --git a/src/i18n/locales/zh-CN/dialogs.json b/src/i18n/locales/zh-CN/dialogs.jsonnew file mode 100644index 00000000..0967ef42--- /dev/null+++ b/src/i18n/locales/zh-CN/dialogs.json@@ -0,0 +1 @@+{}diff --git a/src/i18n/locales/zh-CN/editor.json b/src/i18n/locales/zh-CN/editor.jsonnew file mode 100644index 00000000..0967ef42--- /dev/null+++ b/src/i18n/locales/zh-CN/editor.json@@ -0,0 +1 @@+{}diff --git a/src/i18n/locales/zh-CN/launch.json b/src/i18n/locales/zh-CN/launch.jsonnew file mode 100644index 00000000..0967ef42--- /dev/null+++ b/src/i18n/locales/zh-CN/launch.json@@ -0,0 +1 @@+{}diff --git a/src/i18n/locales/zh-CN/settings.json b/src/i18n/locales/zh-CN/settings.jsonnew file mode 100644index 00000000..0967ef42--- /dev/null+++ b/src/i18n/locales/zh-CN/settings.json@@ -0,0 +1 @@+{}diff --git a/src/i18n/locales/zh-CN/shortcuts.json b/src/i18n/locales/zh-CN/shortcuts.jsonnew file mode 100644index 00000000..0967ef42--- /dev/null+++ b/src/i18n/locales/zh-CN/shortcuts.json@@ -0,0 +1 @@+{}diff --git a/src/i18n/locales/zh-CN/timeline.json b/src/i18n/locales/zh-CN/timeline.jsonnew file mode 100644index 00000000..0967ef42--- /dev/null+++ b/src/i18n/locales/zh-CN/timeline.json@@ -0,0 +1 @@+{}