Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
chore: format codebase and update i18n locale files
Justice Entsie545c35d4cdf7
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex f2bbbe292..651c80f3d 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -1,4 +1,4 @@-# Contribution Guidelines+ # Contribution GuidelinesThank you for considering contributing to this project! By contributing, you help make this project better for everyone. Please take a moment to review these guidelines to ensure a smooth contribution process.diff --git a/src/components/video-editor/AnnotationSettingsPanel.tsx b/src/components/video-editor/AnnotationSettingsPanel.tsxindex 300bd663d..de6b627ed 100644--- a/src/components/video-editor/AnnotationSettingsPanel.tsx+++ b/src/components/video-editor/AnnotationSettingsPanel.tsx@@ -309,7 +309,7 @@ export function AnnotationSettingsPanel({<div><label className="mb-2 block text-xs font-medium text-slate-200">- Text Animation+ {t("annotation.textAnimation")}</label><Selectvalue={normalizeTextAnimation(annotation.style.textAnimation)}@@ -318,7 +318,7 @@ export function AnnotationSettingsPanel({}><SelectTrigger className="h-9 w-full border-white/10 bg-white/5 text-xs text-slate-200">- <SelectValue placeholder="Select animation" />+ <SelectValue placeholder={t("annotation.selectAnimation")} /></SelectTrigger><SelectContent className="max-h-[240px] border-white/10 bg-[#1a1a1c] text-slate-200">{TEXT_ANIMATION_OPTIONS.map((option) => (diff --git a/src/i18n/locales/ar/settings.json b/src/i18n/locales/ar/settings.jsonindex 6cd90b6a2..14dc38863 100644--- a/src/i18n/locales/ar/settings.json+++ b/src/i18n/locales/ar/settings.json@@ -128,6 +128,8 @@"textPlaceholder": "أدخل النص هنا...","fontStyle": "نمط الخط","selectStyle": "حدد النمط",+ "textAnimation": "تحريك النص",+ "selectAnimation": "حدد الحركة","size": "الحجم","customFonts": "خطوط مخصصة","textColor": "لون النص",diff --git a/src/i18n/locales/en/settings.json b/src/i18n/locales/en/settings.jsonindex 3e2541aa1..8ab21dc4a 100644--- a/src/i18n/locales/en/settings.json+++ b/src/i18n/locales/en/settings.json@@ -128,6 +128,8 @@"textPlaceholder": "Enter your text...","fontStyle": "Font Style","selectStyle": "Select style",+ "textAnimation": "Text Animation",+ "selectAnimation": "Select animation","size": "Size","customFonts": "Custom Fonts","textColor": "Text Color",diff --git a/src/i18n/locales/es/settings.json b/src/i18n/locales/es/settings.jsonindex 99cff77e5..53ee894dd 100644--- a/src/i18n/locales/es/settings.json+++ b/src/i18n/locales/es/settings.json@@ -128,6 +128,8 @@"textPlaceholder": "Escribe tu texto...","fontStyle": "Estilo de fuente","selectStyle": "Seleccionar estilo",+ "textAnimation": "Animación de texto",+ "selectAnimation": "Seleccionar animación","size": "Tamaño","customFonts": "Fuentes personalizadas","textColor": "Color de texto",diff --git a/src/i18n/locales/fr/settings.json b/src/i18n/locales/fr/settings.jsonindex c968c68db..9dc162796 100644--- a/src/i18n/locales/fr/settings.json+++ b/src/i18n/locales/fr/settings.json@@ -129,6 +129,8 @@"textPlaceholder": "Saisissez votre texte...","fontStyle": "Style de police","selectStyle": "Choisir un style",+ "textAnimation": "Animation du texte",+ "selectAnimation": "Choisir une animation","size": "Taille","customFonts": "Polices personnalisées","textColor": "Couleur du texte",diff --git a/src/i18n/locales/it/settings.json b/src/i18n/locales/it/settings.jsonindex 912fc0ce5..20689dae1 100644--- a/src/i18n/locales/it/settings.json+++ b/src/i18n/locales/it/settings.json@@ -128,6 +128,8 @@"textPlaceholder": "Inserisci il tuo testo...","fontStyle": "Stile carattere","selectStyle": "Seleziona stile",+ "textAnimation": "Animazione testo",+ "selectAnimation": "Seleziona animazione","size": "Dimensione","customFonts": "Caratteri personalizzati","textColor": "Colore testo",diff --git a/src/i18n/locales/ja-JP/settings.json b/src/i18n/locales/ja-JP/settings.jsonindex 697e1ac5e..326fb80ea 100644--- a/src/i18n/locales/ja-JP/settings.json+++ b/src/i18n/locales/ja-JP/settings.json@@ -128,6 +128,8 @@"textPlaceholder": "テキストを入力してください...","fontStyle": "フォントスタイル","selectStyle": "スタイルを選択",+ "textAnimation": "テキストアニメーション",+ "selectAnimation": "アニメーションを選択","size": "サイズ","customFonts": "カスタムフォント","textColor": "文字色",diff --git a/src/i18n/locales/ko-KR/settings.json b/src/i18n/locales/ko-KR/settings.jsonindex df4c6a273..1cd8fb6c9 100644--- a/src/i18n/locales/ko-KR/settings.json+++ b/src/i18n/locales/ko-KR/settings.json@@ -127,6 +127,8 @@"textPlaceholder": "텍스트를 입력하세요...","fontStyle": "폰트 스타일","selectStyle": "스타일 선택",+ "textAnimation": "텍스트 애니메이션",+ "selectAnimation": "애니메이션 선택","size": "크기","customFonts": "커스텀 폰트","textColor": "텍스트 색상",diff --git a/src/i18n/locales/ru/settings.json b/src/i18n/locales/ru/settings.jsonindex c0dbba8f0..401d9dcfb 100644--- a/src/i18n/locales/ru/settings.json+++ b/src/i18n/locales/ru/settings.json@@ -128,6 +128,8 @@"textPlaceholder": "Введите ваш текст...","fontStyle": "Стиль шрифта","selectStyle": "Выбрать стиль",+ "textAnimation": "Анимация текста",+ "selectAnimation": "Выберите анимацию","size": "Размер","customFonts": "Пользовательские шрифты","textColor": "Цвет текста",diff --git a/src/i18n/locales/tr/settings.json b/src/i18n/locales/tr/settings.jsonindex 587f26688..63d8a5b73 100644--- a/src/i18n/locales/tr/settings.json+++ b/src/i18n/locales/tr/settings.json@@ -128,6 +128,8 @@"textPlaceholder": "Metninizi girin...","fontStyle": "Yazı Tipi Stili","selectStyle": "Stil seçin",+ "textAnimation": "Metin Animasyonu",+ "selectAnimation": "Animasyon seçin","size": "Boyut","customFonts": "Özel Yazı Tipleri","textColor": "Metin Rengi",diff --git a/src/i18n/locales/vi/settings.json b/src/i18n/locales/vi/settings.jsonindex e83c799d8..379f84546 100644--- a/src/i18n/locales/vi/settings.json+++ b/src/i18n/locales/vi/settings.json@@ -128,6 +128,8 @@"textPlaceholder": "Nhập văn bản của bạn...","fontStyle": "Kiểu phông chữ","selectStyle": "Chọn kiểu",+ "textAnimation": "Hoạt ảnh văn bản",+ "selectAnimation": "Chọn hoạt ảnh","size": "Kích thước","customFonts": "Phông chữ tùy chỉnh","textColor": "Màu văn bản",diff --git a/src/i18n/locales/zh-CN/settings.json b/src/i18n/locales/zh-CN/settings.jsonindex b9b516a04..9184689e3 100644--- a/src/i18n/locales/zh-CN/settings.json+++ b/src/i18n/locales/zh-CN/settings.json@@ -128,6 +128,8 @@"textPlaceholder": "输入您的文本...","fontStyle": "字体样式","selectStyle": "选择样式",+ "textAnimation": "文本动画",+ "selectAnimation": "选择动画","size": "大小","customFonts": "自定义字体","textColor": "文本颜色",diff --git a/src/i18n/locales/zh-TW/settings.json b/src/i18n/locales/zh-TW/settings.jsonindex ee56459e7..f7e6deff8 100644--- a/src/i18n/locales/zh-TW/settings.json+++ b/src/i18n/locales/zh-TW/settings.json@@ -129,6 +129,8 @@"textPlaceholder": "輸入您的文字...","fontStyle": "字體樣式","selectStyle": "選擇樣式",+ "textAnimation": "文字動畫",+ "selectAnimation": "選擇動畫","size": "大小","customFonts": "自訂字體","textColor": "文字顏色",diff --git a/src/lib/exporter/annotationRenderer.ts b/src/lib/exporter/annotationRenderer.tsindex 31cd836ff..a2ac08a19 100644--- a/src/lib/exporter/annotationRenderer.ts+++ b/src/lib/exporter/annotationRenderer.ts@@ -18,6 +18,26 @@ let blurScratchCtx: CanvasRenderingContext2D | null = null;// property escapes require ES2018+; tsconfig target is ES2020.const CJK_CHAR = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u;+type GraphemeSegmenter = {+ segment(value: string): Iterable<{ segment: string }>;+};++type IntlWithSegmenter = typeof Intl & {+ Segmenter?: new (+ locales?: string | string[],+ options?: { granularity?: "grapheme" },+ ) => GraphemeSegmenter;+};++const Segmenter = (Intl as IntlWithSegmenter).Segmenter;+const graphemeSegmenter =+ typeof Segmenter === "function" ? new Segmenter(undefined, { granularity: "grapheme" }) : null;++function splitGraphemes(value: string): string[] {+ if (!graphemeSegmenter) return Array.from(value);+ return Array.from(graphemeSegmenter.segment(value), ({ segment }) => segment);+}+function tokenizeForWrap(line: string): string[] {// Split Latin text on whitespace (preserving the whitespace as its own token,// matching the original behavior), and split CJK runs into individual@@ -313,27 +333,38 @@ function renderText(lines.forEach((line, index) => {const currentY = startY + index * lineHeight;const revealProgress = animationState.revealProgress;- const visibleLine =- revealProgress >= 1 ? line : line.slice(0, Math.ceil(line.length * revealProgress));+ const graphemes = splitGraphemes(line);+ const visibleCount = Math.ceil(graphemes.length * revealProgress);+ const visibleLine = revealProgress >= 1 ? line : graphemes.slice(0, visibleCount).join("");if (!visibleLine && revealProgress < 1) return;+ const previousAlign = ctx.textAlign;+ const fullMetrics = ctx.measureText(line);+ let startX = textX;++ if (ctx.textAlign === "center") {+ startX = textX - fullMetrics.width / 2;+ ctx.textAlign = "left";+ } else if (ctx.textAlign === "right" || ctx.textAlign === "end") {+ startX = textX - fullMetrics.width;+ ctx.textAlign = "left";+ }+if (style.backgroundColor && style.backgroundColor !== "transparent") {const metrics = ctx.measureText(visibleLine);const verticalPadding = scaledFontSize * 0.1;const horizontalPadding = scaledFontSize * 0.2;const borderRadius = 4 * scaleFactor;- let bgX = textX - horizontalPadding;+ let bgX = startX - horizontalPadding;const bgWidth = metrics.width + horizontalPadding * 2;const contentHeight = scaledFontSize * 1.4;const bgHeight = contentHeight + verticalPadding * 2;const bgY = currentY - bgHeight / 2;- if (style.textAlign === "center") {- bgX = textX - bgWidth / 2;- } else if (style.textAlign === "right") {- bgX = textX - bgWidth;+ if (previousAlign === "left" || previousAlign === "start") {+ bgX = textX - horizontalPadding;}ctx.fillStyle = style.backgroundColor;@@ -343,17 +374,15 @@ function renderText(}ctx.fillStyle = style.color;- ctx.fillText(visibleLine, textX, currentY);+ ctx.fillText(visibleLine, startX, currentY);if (style.textDecoration === "underline") {const metrics = ctx.measureText(visibleLine);- let underlineX = textX;+ let underlineX = startX;const underlineY = currentY + scaledFontSize * 0.15;- if (style.textAlign === "center") {- underlineX = textX - metrics.width / 2;- } else if (style.textAlign === "right") {- underlineX = textX - metrics.width;+ if (previousAlign === "left" || previousAlign === "start") {+ underlineX = textX;}ctx.strokeStyle = style.color;@@ -363,6 +392,8 @@ function renderText(ctx.lineTo(underlineX + metrics.width, underlineY);ctx.stroke();}++ ctx.textAlign = previousAlign;});ctx.restore();