From cfb7417a2f3ac84ffa0222e8809e3e259339977e Mon Sep 17 00:00:00 2001 From: hamdymohamedak Date: Fri, 24 Apr 2026 06:38:38 +0300 Subject: [PATCH 01/10] feat(translations more pages at the React docs like Hero section and the Home page --- scripts/list-untranslated-md.mjs | 35 +++ src/components/Layout/Feedback.tsx | 6 +- src/components/Layout/Footer.tsx | 60 ++--- src/components/Layout/HomeContent.js | 243 ++++++++---------- src/components/Layout/TopNav/BrandMenu.tsx | 22 +- src/components/Layout/TopNav/TopNav.tsx | 34 +-- src/components/Seo.tsx | 4 +- .../learn/build-a-react-app-from-scratch.md | 102 ++++---- src/content/learn/creating-a-react-app.md | 62 ++--- src/content/learn/setup.md | 20 +- src/content/versions.md | 80 +++--- src/pages/404.js | 13 +- 12 files changed, 349 insertions(+), 332 deletions(-) create mode 100644 scripts/list-untranslated-md.mjs diff --git a/scripts/list-untranslated-md.mjs b/scripts/list-untranslated-md.mjs new file mode 100644 index 000000000..0133644ca --- /dev/null +++ b/scripts/list-untranslated-md.mjs @@ -0,0 +1,35 @@ +#!/usr/bin/env node +/** + * Lists Markdown files under src/content with few Arabic letters (likely English). + * Threshold is heuristic; raise ARABIC_MIN after more pages are translated. + * + * Usage: node scripts/list-untranslated-md.mjs + */ +import fs from 'node:fs'; +import path from 'node:path'; + +const ROOT = path.join(process.cwd(), 'src/content'); +const ARABIC = /[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/g; +const ARABIC_MIN = 80; + +function walk(dir, out = []) { + for (const ent of fs.readdirSync(dir, {withFileTypes: true})) { + const p = path.join(dir, ent.name); + if (ent.isDirectory()) walk(p, out); + else if (ent.name.endsWith('.md')) out.push(p); + } + return out; +} + +const files = walk(ROOT); +const low = []; +for (const f of files) { + const text = fs.readFileSync(f, 'utf8'); + const n = (text.match(ARABIC) || []).length; + if (n < ARABIC_MIN) low.push({f: path.relative(process.cwd(), f), n}); +} +low.sort((a, b) => a.n - b.n || a.f.localeCompare(b.f)); +console.log( + `Files with <${ARABIC_MIN} Arabic chars: ${low.length} / ${files.length}\n` +); +for (const {f, n} of low) console.log(`${String(n).padStart(5)} ${f}`); diff --git a/src/components/Layout/Feedback.tsx b/src/components/Layout/Feedback.tsx index fe9272517..e681d9a83 100644 --- a/src/components/Layout/Feedback.tsx +++ b/src/components/Layout/Feedback.tsx @@ -74,11 +74,11 @@ function SendFeedback({onSubmit}: {onSubmit: () => void}) { {exit: isSubmitted} )}>

- {isSubmitted ? 'Thank you for your feedback!' : 'Is this page useful?'} + {isSubmitted ? 'شكراً لملاحظاتك!' : 'هل كانت هذه الصفحة مفيدة؟'}

{!isSubmitted && (