Skip to content

Commit d729dc4

Browse files
Merge pull request #1 from hamdymohamedak/dev
Add Arabic translations for React documentation and components
2 parents 0d91aa8 + 7a8fbfd commit d729dc4

179 files changed

Lines changed: 9221 additions & 9207 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

scripts/list-untranslated-md.mjs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env node
2+
/**
3+
* Lists Markdown files under src/content with few Arabic letters (likely English).
4+
* Threshold is heuristic; raise ARABIC_MIN after more pages are translated.
5+
*
6+
* Usage: node scripts/list-untranslated-md.mjs
7+
*/
8+
import fs from 'node:fs';
9+
import path from 'node:path';
10+
11+
const ROOT = path.join(process.cwd(), 'src/content');
12+
const ARABIC = /[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/g;
13+
const ARABIC_MIN = 80;
14+
15+
function walk(dir, out = []) {
16+
for (const ent of fs.readdirSync(dir, {withFileTypes: true})) {
17+
const p = path.join(dir, ent.name);
18+
if (ent.isDirectory()) walk(p, out);
19+
else if (ent.name.endsWith('.md')) out.push(p);
20+
}
21+
return out;
22+
}
23+
24+
const files = walk(ROOT);
25+
const low = [];
26+
for (const f of files) {
27+
const text = fs.readFileSync(f, 'utf8');
28+
const n = (text.match(ARABIC) || []).length;
29+
if (n < ARABIC_MIN) low.push({f: path.relative(process.cwd(), f), n});
30+
}
31+
low.sort((a, b) => a.n - b.n || a.f.localeCompare(b.f));
32+
console.log(
33+
`Files with <${ARABIC_MIN} Arabic chars: ${low.length} / ${files.length}\n`
34+
);
35+
for (const {f, n} of low) console.log(`${String(n).padStart(5)} ${f}`);

src/components/Layout/Feedback.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ function SendFeedback({onSubmit}: {onSubmit: () => void}) {
7474
{exit: isSubmitted}
7575
)}>
7676
<p className="w-full text-lg font-bold text-primary dark:text-primary-dark me-4">
77-
{isSubmitted ? 'Thank you for your feedback!' : 'Is this page useful?'}
77+
{isSubmitted ? 'شكراً لملاحظاتك!' : 'هل كانت هذه الصفحة مفيدة؟'}
7878
</p>
7979
{!isSubmitted && (
8080
<button
81-
aria-label="Yes"
81+
aria-label="نعم"
8282
className="px-3 rounded-lg bg-secondary-button dark:bg-secondary-button-dark text-primary dark:text-primary-dark me-2"
8383
onClick={() => {
8484
setIsSubmitted(true);
@@ -90,7 +90,7 @@ function SendFeedback({onSubmit}: {onSubmit: () => void}) {
9090
)}
9191
{!isSubmitted && (
9292
<button
93-
aria-label="No"
93+
aria-label="لا"
9494
className="px-3 rounded-lg bg-secondary-button dark:bg-secondary-button-dark text-primary dark:text-primary-dark"
9595
onClick={() => {
9696
setIsSubmitted(true);

src/components/Layout/Footer.tsx

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function Footer() {
2626
<div className="col-span-2 md:col-span-1 justify-items-start mt-3.5">
2727
<ExternalLink
2828
href="https://opensource.fb.com/"
29-
aria-label="Meta Open Source">
29+
aria-label="ميتا للمصدر المفتوح">
3030
<div>
3131
<svg
3232
width="160"
@@ -291,26 +291,26 @@ export function Footer() {
291291
<div
292292
className="text-xs text-left rtl:text-right mt-2 pe-0.5"
293293
dir="ltr">
294-
Copyright &copy; Meta Platforms, Inc
294+
حقوق النشر © Meta Platforms, Inc
295295
</div>
296296
<div
297297
className="uwu-visible text-xs cursor-pointer hover:text-link hover:dark:text-link-dark hover:underline"
298298
onClick={() => {
299299
// @ts-ignore
300300
window.__setUwu(false);
301301
}}>
302-
no uwu plz
302+
بدون uwu من فضلك
303303
</div>
304304
<div
305305
className="uwu-hidden text-xs cursor-pointer hover:text-link hover:dark:text-link-dark hover:underline"
306306
onClick={() => {
307307
// @ts-ignore
308308
window.__setUwu(true);
309309
}}>
310-
uwu?
310+
uwu؟
311311
</div>
312312
<div className="uwu-visible text-xs">
313-
Logo by
313+
شعار من تصميم
314314
<ExternalLink
315315
className="ms-1"
316316
href="https://twitter.com/sawaratsuki1004">
@@ -320,72 +320,72 @@ export function Footer() {
320320
</div>
321321
<div className="flex flex-col">
322322
<FooterLink href="/learn" isHeader={true}>
323-
Learn React
323+
تعلّم React
324324
</FooterLink>
325-
<FooterLink href="/learn/">Quick Start</FooterLink>
326-
<FooterLink href="/learn/installation">Installation</FooterLink>
325+
<FooterLink href="/learn/">بدء سريع</FooterLink>
326+
<FooterLink href="/learn/installation">التثبيت</FooterLink>
327327
<FooterLink href="/learn/describing-the-ui">
328-
Describing the UI
328+
وصف واجهة المستخدم
329329
</FooterLink>
330330
<FooterLink href="/learn/adding-interactivity">
331-
Adding Interactivity
331+
إضافة التفاعلية
332332
</FooterLink>
333-
<FooterLink href="/learn/managing-state">Managing State</FooterLink>
334-
<FooterLink href="/learn/escape-hatches">Escape Hatches</FooterLink>
333+
<FooterLink href="/learn/managing-state">إدارة الحالة</FooterLink>
334+
<FooterLink href="/learn/escape-hatches">منافذ استثنائية</FooterLink>
335335
</div>
336336
<div className="flex flex-col">
337337
<FooterLink href="/reference/react" isHeader={true}>
338-
API Reference
338+
مرجع API
339+
</FooterLink>
340+
<FooterLink href="/reference/react">واجهات برمجة React</FooterLink>
341+
<FooterLink href="/reference/react-dom">
342+
واجهات برمجة React DOM
339343
</FooterLink>
340-
<FooterLink href="/reference/react">React APIs</FooterLink>
341-
<FooterLink href="/reference/react-dom">React DOM APIs</FooterLink>
342344
</div>
343345
<div className="md:col-start-2 xl:col-start-4 flex flex-col">
344346
<FooterLink href="/community" isHeader={true}>
345-
Community
347+
المجتمع
346348
</FooterLink>
347349
<FooterLink href="https://github.com/facebook/react/blob/main/CODE_OF_CONDUCT.md">
348-
Code of Conduct
350+
مدونة السلوك
349351
</FooterLink>
350-
<FooterLink href="/community/team">Meet the Team</FooterLink>
352+
<FooterLink href="/community/team">تعرّف على الفريق</FooterLink>
351353
<FooterLink href="/community/docs-contributors">
352-
Docs Contributors
353-
</FooterLink>
354-
<FooterLink href="/community/acknowledgements">
355-
Acknowledgements
354+
مساهمو الوثائق
356355
</FooterLink>
356+
<FooterLink href="/community/acknowledgements">شكر وتقدير</FooterLink>
357357
</div>
358358
<div className="flex flex-col">
359-
<FooterLink isHeader={true}>More</FooterLink>
360-
<FooterLink href="/blog">Blog</FooterLink>
359+
<FooterLink isHeader={true}>المزيد</FooterLink>
360+
<FooterLink href="/blog">المدوّنة</FooterLink>
361361
<FooterLink href="https://reactnative.dev/">React Native</FooterLink>
362362
<FooterLink href="https://opensource.facebook.com/legal/privacy">
363-
Privacy
363+
الخصوصية
364364
</FooterLink>
365365
<FooterLink href="https://opensource.fb.com/legal/terms/">
366-
Terms
366+
الشروط
367367
</FooterLink>
368368
<div className="flex flex-row items-center mt-8 gap-x-2">
369369
<ExternalLink
370-
aria-label="React on Facebook"
370+
aria-label="React على Facebook"
371371
href="https://www.facebook.com/react"
372372
className={socialLinkClasses}>
373373
<IconFacebookCircle />
374374
</ExternalLink>
375375
<ExternalLink
376-
aria-label="React on Twitter"
376+
aria-label="React على X"
377377
href="https://twitter.com/reactjs"
378378
className={socialLinkClasses}>
379379
<IconTwitter />
380380
</ExternalLink>
381381
<ExternalLink
382-
aria-label="React on Bluesky"
382+
aria-label="React على Bluesky"
383383
href="https://bsky.app/profile/react.dev"
384384
className={socialLinkClasses}>
385385
<IconBsky />
386386
</ExternalLink>
387387
<ExternalLink
388-
aria-label="React on Github"
388+
aria-label="React على GitHub"
389389
href="https://github.com/facebook/react"
390390
className={socialLinkClasses}>
391391
<IconGitHub />

0 commit comments

Comments
 (0)