Author SHA1 Message Date
ahp 1219089a3c docs(contributing): add a Persian translation of the contribution guide
- CONTRIBUTING.fa.md follows the original section by section, in the
  same order, with the terminology README.fa.md already uses (رونویسی،
  ورکر، سلف‌هاست، داشبورد، فاین‌تیون)
- commands, code blocks, paths and commit prefixes stay in English so
  they remain copy-pasteable; no command or number was changed
- both files get a language switcher line, like the READMEs

Closes #31
2026-11-26 18:02:10 +03:30
10 changed files with 73 additions and 165 deletions

No files matched your search

+3 -5
View File
@@ -37,11 +37,6 @@ The format follows [Keep a Changelog](https://keepachangelog.com/) and the proje
fine-tuned 0.75 / medium 0.5625); the weekly benchmark workflow now
guards `small` **and** `medium`; regression-gate test updated to the
committed baseline.
- Dashboard dark mode: a sun/moon toggle in the header, defaulting to the OS
preference until the user picks one (saved in localStorage, applied before
first paint so there is no flash). Implemented by remapping the Tailwind
palette under `html.dark` in `globals.css`, so existing pages needed no
per-class changes.
- Brand refresh: a hero banner in both READMEs (`docs/assets/banner.png`),
a redesigned 1280x640 social preview (`docs/assets/social-preview.png` —
upload it once in Settings → General → Social preview) and a 512px app
@@ -57,6 +52,9 @@ The format follows [Keep a Changelog](https://keepachangelog.com/) and the proje
and duration caps: 30 min on WebGPU, 10 min on WASM, 60 MB per file —
no input can wedge the demo at an eternal "processing" state anymore.
- `CONTRIBUTING.fa.md`: a Persian translation of the contribution guide,
with a language switcher in both files like the READMEs (#31).
### Changed
- **Demo hang fix**: audio was decoded inside an `AudioContext` forced to
+64
View File
@@ -0,0 +1,64 @@
# مشارکت در سخن
[English](CONTRIBUTING.md) | **فارسی**
ممنون که به سخن سر زدید. این مخزن یک کیت گفتار به متنِ فارسی است که
می‌شود سلف‌هاستش کرد: یک بک‌اند FastAPI با موتور faster-whisper، یک ورکر
Celery، یک داشبورد Next.js (فارسی‌محور و راست‌به‌چپ)، یک ربات تلگرام
اختیاری، یک پایپ‌لاین فاین‌تیونِ LoRA با نتایجِ اندازه‌گیری‌شده، و یک دموی
عمومیِ مرورگری روی Hugging Face.
## راه‌اندازی محیط توسعه
برای بک‌اند و ربات Python 3.12 و برای داشبورد وب Node 22 لازم است:
pip install -e "backend[dev]" -e "bot[dev]"
cd web && npm ci
وابستگی‌های سنگین (torch / faster-whisper) فقط برای ابزارهای آموزش و
بنچمارک لازم‌اند:
pip install -r training/requirements.txt -r benchmarks/requirements.txt
pip install -r space/gradio/requirements.txt # self-hostable Gradio demo
## تست‌ها، لینت و نظم کامیت‌ها
CI روی هر push و pull request همین دستورها را اجرا می‌کند:
ruff check backend bot training benchmarks space deploy
mypy --config-file backend/pyproject.toml backend/sokhan
pytest backend/tests bot/tests
cd web && npm ci && npm run build
هوک‌های pre-commit (ruff به‌علاوهٔ چند بررسی پایه) را برای هر کلون یک بار
فعال کنید:
pip install pre-commit && pre-commit install
پیام کامیت‌ها از Conventional Commits پیروی می‌کنند (`feat:`، `fix:`،
`docs:`، ...) و نسخه‌گذاری پروژه بر اساس Semantic Versioning است؛ هر
تغییری که کاربر می‌بیند یک خط در CHANGELOG.md می‌گیرد.
## دموی مرورگری و ورک‌فلوی sync-space
`space/` دموی استاتیکی است که Whisper در آن کاملاً سمتِ مرورگر اجرا
می‌شود (transformers.js). ورک‌فلوی `Sync demo Space` با هر push‌ای که به
`space/` دست بزند، آن را با سکرتِ `HF_TOKEN` در Actions مخزن روی
hf.co/spaces/Abol0pati/sokhan-fa-demo منتشر می‌کند - برای همین دموی
عمومی هیچ‌وقت از `main` عقب نمی‌ماند. `space/gradio/` یک اپ جدا و
سلف‌هاست‌شدنی است که چک‌پوینتِ فاین‌تیون‌شده را با همان تنظیمات موتورِ
محیط production سرو می‌کند؛ این اپ عمداً روی Space عمومی آپلود نمی‌شود
(قیمت‌گذاری ۲۰۲۶ هاگینگ‌فیس، Spaceهای میزبانی‌شدهٔ Gradio/Docker را پشت
اشتراک PRO قفل کرده است).
## قاعدهٔ «اول اندازه‌گیری»
هر ادعایی دربارهٔ دقت (WER، CER، سرعت) که در README، کارت مدل یا
changelog می‌آید باید از `benchmarks/benchmark_wer.py` (یا ارزیابیِ
نوت‌بوک) آمده باشد و فیکسچر و سخت‌افزارش ذکر شده باشد. هیچ عددِ ساختگی
پذیرفته نیست.
## امنیت
گزارش‌های امنیتی را به‌صورت issue عمومی باز نکنید - برای افشای خصوصی
SECURITY.md را ببینید.
+2
View File
@@ -1,5 +1,7 @@
# Contributing to Sokhan
**English** | [فارسی](CONTRIBUTING.fa.md)
Thanks for looking into Sokhan. This repo is a self-hostable Persian
speech-to-text kit: a FastAPI backend with a faster-whisper engine, a
Celery worker, a Next.js (Persian-first, RTL) dashboard, an optional
+1 -3
View File
@@ -15,9 +15,7 @@
"new": "New transcription",
"archive": "Archive",
"switchToEn": "English",
"switchToFa": "فارسی",
"themeToDark": "Switch to dark theme",
"themeToLight": "Switch to light theme"
"switchToFa": "فارسی"
},
"landing": {
"headline": "From speech to text, in moments",
+1 -3
View File
@@ -15,9 +15,7 @@
"new": "رونویسی تازه",
"archive": "آرشیو",
"switchToEn": "English",
"switchToFa": "فارسی",
"themeToDark": "تم تیره",
"themeToLight": "تم روشن"
"switchToFa": "فارسی"
},
"landing": {
"headline": "از گفتار به متن، در چند لحظه",
+2 -9
View File
@@ -5,7 +5,6 @@ import { getTranslations, setRequestLocale } from "next-intl/server";
import localFont from "next/font/local";
import { routing } from "@/i18n/routing";
import { SiteHeader } from "@/components/site-header";
import { themeInitScript } from "@/lib/theme";
import "../globals.css";
// Fonts are self-hosted (see src/fonts/README.txt): builds must never depend
@@ -48,10 +47,7 @@ export async function generateMetadata({
}
export const viewport: Viewport = {
themeColor: [
{ media: "(prefers-color-scheme: light)", color: "#0f766e" },
{ media: "(prefers-color-scheme: dark)", color: "#134e4a" },
],
themeColor: "#0f766e",
};
export default async function LocaleLayout({
@@ -68,10 +64,7 @@ export default async function LocaleLayout({
const t = await getTranslations("common");
return (
<html lang={locale} dir={locale === "fa" ? "rtl" : "ltr"} suppressHydrationWarning>
<head>
<script dangerouslySetInnerHTML={{ __html: themeInitScript }} />
</head>
<html lang={locale} dir={locale === "fa" ? "rtl" : "ltr"}>
<body
className={`${vazirmatn.variable} ${inter.variable} flex min-h-screen flex-col bg-stone-50 text-stone-900 antialiased`}
>
-74
View File
@@ -1,7 +1,5 @@
@import "tailwindcss";
@custom-variant dark (&:where(.dark, .dark *));
@theme {
--font-vazir: var(--font-vazirmatn, Vazirmatn), var(--font-inter, Inter), ui-sans-serif,
system-ui, sans-serif;
@@ -23,75 +21,3 @@ html[lang="en"] body {
background-color: #99f6e4;
color: #134e4a;
}
html.dark {
color-scheme: dark;
--color-stone-50: oklch(14.7% 0.004 49.25);
--color-stone-100: oklch(26.8% 0.007 34.298);
--color-stone-200: oklch(30% 0.007 34.298);
--color-stone-300: oklch(40% 0.01 67.558);
--color-stone-400: oklch(55.3% 0.013 58.071);
--color-stone-500: oklch(70.9% 0.01 56.259);
--color-stone-600: oklch(80% 0.005 56.366);
--color-stone-700: oklch(86.9% 0.005 56.366);
--color-stone-800: oklch(92.3% 0.003 48.717);
--color-stone-900: oklch(97% 0.001 106.424);
--color-stone-950: oklch(98.5% 0.001 106.423);
--color-teal-50: oklch(27.7% 0.046 192.524);
--color-teal-100: oklch(32% 0.055 190);
--color-teal-200: oklch(38.6% 0.063 188.416);
--color-teal-800: oklch(85.5% 0.138 181.071);
--color-teal-900: oklch(91% 0.096 180.426);
--color-teal-950: oklch(95.3% 0.051 180.801);
--color-red-50: oklch(25.8% 0.092 26.042);
--color-red-100: oklch(30% 0.11 26);
--color-red-200: oklch(39.6% 0.141 25.723);
--color-red-700: oklch(80.8% 0.114 19.571);
--color-red-800: oklch(88.5% 0.062 18.334);
--color-red-900: oklch(93.6% 0.032 17.717);
--color-amber-100: oklch(27.9% 0.077 45.635);
--color-amber-800: oklch(92.4% 0.12 95.746);
--color-emerald-100: oklch(26.2% 0.051 172.552);
--color-emerald-800: oklch(90.5% 0.093 164.15);
--sokhan-surface: oklch(19% 0.005 56);
}
html.dark body {
background-color: var(--color-stone-50);
color: var(--color-stone-900);
}
html.dark ::selection {
background-color: #115e59;
color: #f0fdfa;
}
html.dark .bg-white {
background-color: var(--sokhan-surface);
}
html.dark .bg-white\/90 {
background-color: color-mix(in oklab, var(--sokhan-surface) 90%, transparent);
}
html.dark .supports-\[backdrop-filter\]\:bg-white\/75 {
@supports (backdrop-filter: var(--tw)) {
background-color: color-mix(in oklab, var(--sokhan-surface) 75%, transparent);
}
}
html.dark .text-teal-600,
html.dark .text-teal-700 {
color: oklch(77.7% 0.152 181.912);
}
html.dark .text-teal-700\/60 {
color: color-mix(in oklab, oklch(77.7% 0.152 181.912) 60%, transparent);
}
html.dark * {
--tw-ring-offset-color: var(--sokhan-surface);
}
-2
View File
@@ -3,7 +3,6 @@
import { useLocale, useTranslations } from "next-intl";
import { AudioLines } from "lucide-react";
import { Link, usePathname, useRouter } from "@/i18n/navigation";
import { ThemeToggle } from "@/components/theme-toggle";
export function SiteHeader() {
const t = useTranslations("nav");
@@ -61,7 +60,6 @@ export function SiteHeader() {
>
{otherLocale === "en" ? "EN" : "فا"}
</button>
<ThemeToggle />
</nav>
</div>
</header>
-64
View File
@@ -1,64 +0,0 @@
"use client";
import { useEffect, useState } from "react";
import { useTranslations } from "next-intl";
import { Moon, Sun } from "lucide-react";
import { THEME_STORAGE_KEY, type Theme } from "@/lib/theme";
function applyTheme(theme: Theme) {
document.documentElement.classList.toggle("dark", theme === "dark");
}
export function ThemeToggle() {
const t = useTranslations("nav");
const [theme, setTheme] = useState<Theme | null>(null);
useEffect(() => {
setTheme(document.documentElement.classList.contains("dark") ? "dark" : "light");
const media = window.matchMedia("(prefers-color-scheme: dark)");
const onChange = (event: MediaQueryListEvent) => {
let saved: string | null = null;
try {
saved = window.localStorage.getItem(THEME_STORAGE_KEY);
} catch {
}
if (saved === "light" || saved === "dark") return;
const next: Theme = event.matches ? "dark" : "light";
applyTheme(next);
setTheme(next);
};
media.addEventListener("change", onChange);
return () => media.removeEventListener("change", onChange);
}, []);
const isDark = theme === "dark";
function toggle() {
const next: Theme = isDark ? "light" : "dark";
applyTheme(next);
setTheme(next);
try {
window.localStorage.setItem(THEME_STORAGE_KEY, next);
} catch {
}
}
const label = isDark ? t("themeToLight") : t("themeToDark");
return (
<button
type="button"
onClick={toggle}
aria-label={label}
title={label}
className="flex h-9 w-9 items-center justify-center rounded-lg border border-stone-300 text-stone-700 transition-colors hover:border-teal-700 hover:text-teal-800 focus-visible:ring-2 focus-visible:ring-teal-700"
>
{isDark ? (
<Sun className="h-4 w-4" aria-hidden="true" />
) : (
<Moon className="h-4 w-4" aria-hidden="true" />
)}
</button>
);
}
-5
View File
@@ -1,5 +0,0 @@
export const THEME_STORAGE_KEY = "sokhan-theme";
export type Theme = "light" | "dark";
export const themeInitScript = `(function(){try{var t=localStorage.getItem("${THEME_STORAGE_KEY}");if(t!=="light"&&t!=="dark"){t=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}document.documentElement.classList.toggle("dark",t==="dark")}catch(e){}})();`;