From 3ad939c43261313b6c95fa1652c47244e7e57bdc Mon Sep 17 00:00:00 2001 From: KaisHasan Date: Mon, 16 Jun 2025 17:55:34 +0300 Subject: [PATCH 1/7] add some arabic docs --- doc/ar/archint.txt | 2 ++ doc/ar/archword.txt | 2 ++ doc/ar/array.txt | 10 ++++++++++ doc/ar/bool.txt | 2 ++ doc/ar/char.txt | 2 ++ doc/ar/def.txt | 31 +++++++++++++++++++++++++++++++ doc/ar/direct_mapping.json | 10 ++++++++++ doc/ar/float.txt | 14 ++++++++++++++ doc/ar/if.txt | 14 ++++++++++++++ doc/ar/int.txt | 20 ++++++++++++++++++++ doc/ar/loops.txt | 32 ++++++++++++++++++++++++++++++++ doc/ar/modifiers.txt | 20 ++++++++++++++++++++ doc/ar/ptr.txt | 10 ++++++++++ doc/ar/semi_colon.txt | 1 + doc/ar/word.txt | 20 ++++++++++++++++++++ 15 files changed, 190 insertions(+) create mode 100644 doc/ar/archint.txt create mode 100644 doc/ar/archword.txt create mode 100644 doc/ar/array.txt create mode 100644 doc/ar/bool.txt create mode 100644 doc/ar/char.txt create mode 100644 doc/ar/def.txt create mode 100644 doc/ar/direct_mapping.json create mode 100644 doc/ar/float.txt create mode 100644 doc/ar/if.txt create mode 100644 doc/ar/int.txt create mode 100644 doc/ar/loops.txt create mode 100644 doc/ar/modifiers.txt create mode 100644 doc/ar/ptr.txt create mode 100644 doc/ar/semi_colon.txt create mode 100644 doc/ar/word.txt diff --git a/doc/ar/archint.txt b/doc/ar/archint.txt new file mode 100644 index 0000000..e1752e0 --- /dev/null +++ b/doc/ar/archint.txt @@ -0,0 +1,2 @@ +صـحيح_متكيف (ArchInt) +عدد صحيح بعدد بتات مطابقة لمعمارية النظام، أي بحجم 32 بت على أنظمة 32 بت وبحجم 64 بت على أنظمة 64 بت. diff --git a/doc/ar/archword.txt b/doc/ar/archword.txt new file mode 100644 index 0000000..5ee4c1a --- /dev/null +++ b/doc/ar/archword.txt @@ -0,0 +1,2 @@ +طـبيعي_متكيف (ArchWord) +عدد صحيح موجب بعدد بتات مطابقة لمعمارية النظام، أي بحجم 32 بت على أنظمة 32 بت وبحجم 64 بت على أنظمة 64 بت. diff --git a/doc/ar/array.txt b/doc/ar/array.txt new file mode 100644 index 0000000..57f7bf3 --- /dev/null +++ b/doc/ar/array.txt @@ -0,0 +1,10 @@ +مصفوفة (array) +مصفوفة من المتغيرات. تُعرف بتحديد صنف المتغيرات وعدد الخانات بين أقواس معقوفة كما يلي: +ar version: +``` +مصفوفة[الصنف، عدد_الخانات] +``` +en version: +``` +array[the_type, element_count] +``` diff --git a/doc/ar/bool.txt b/doc/ar/bool.txt new file mode 100644 index 0000000..69bd793 --- /dev/null +++ b/doc/ar/bool.txt @@ -0,0 +1,2 @@ +ثـنائي (Bool) +قيمية ثنائية، وهو مجرب لقب للصنف `طـبيعي[1]`. diff --git a/doc/ar/char.txt b/doc/ar/char.txt new file mode 100644 index 0000000..8ab9a8c --- /dev/null +++ b/doc/ar/char.txt @@ -0,0 +1,2 @@ +مـحرف (Char) +محرف، وهو مجرد لقب للصنف `طـبيعي[8]`. diff --git a/doc/ar/def.txt b/doc/ar/def.txt new file mode 100644 index 0000000..c3ab219 --- /dev/null +++ b/doc/ar/def.txt @@ -0,0 +1,31 @@ +كل التعريفات تتم باستخدام الأمر "عرّف" (def) ويأخذ الصيغة التالية: +ar version: +``` +عرّف <معرِّف> : <تعريف> +``` +en version: +``` +def : +``` +التعريف يمكن أن يكون اسم أحد الأصناف وينتج عن التعريف متغير من ذلك الصنف، أو يكون أحد الأوامر التعريفية الأخرى مثل الدالات والهياكل. المثال التالي يعرّف متغيراً من صنف الأعداد الصحيحة: +ar version: +``` +عرّف م : العدد_الصحيح +``` +en version: +``` +def i : Int +``` +يمكن أيضاً تعريف الثوابت بنفس الطريقة وذلك بوضع القيمة نفسها بدل الصنف ويمكن هذا مع الأعداد الصحيحة والعائمة بالإضافة إلى سلاسل المحارف، كما في المثال التالي: +ar version: +``` +عرّف البسملة: "بسم الله الرحمن الرحيم"؛ +عرف النسبة_الثابتة: 3.141592؛ +عرف عدد_أيام_الاسبوع: 7؛ +``` +en version: +``` +def hello: "Hello World"; +def pi: 3.141592; +def daysPerWeek: 7; +``` diff --git a/doc/ar/direct_mapping.json b/doc/ar/direct_mapping.json new file mode 100644 index 0000000..c4c8210 --- /dev/null +++ b/doc/ar/direct_mapping.json @@ -0,0 +1,10 @@ +{ + "def": "عرف", + "and": "و", + "or": "أو", + "/n": "/ج", + "/r": "/ر", + "/t": "/ت", + "continue": "أكمل", + "break": "اقطع", +} \ No newline at end of file diff --git a/doc/ar/float.txt b/doc/ar/float.txt new file mode 100644 index 0000000..7bca5f1 --- /dev/null +++ b/doc/ar/float.txt @@ -0,0 +1,14 @@ +عـائم (Float) +عدد عائم. يتم تحديد عدد البتات بين أقواس معقوفة. تحديد عدد البتات اختياري وبدونه يكون العدد الافتراضي للبتات 32. +ar version: +``` +عـائم // 32 بتة +عـائم[32] +عـائم[64] +``` +en version: +``` +Float // 32 bits +Float[32] +Float[64] +``` diff --git a/doc/ar/if.txt b/doc/ar/if.txt new file mode 100644 index 0000000..bba63f8 --- /dev/null +++ b/doc/ar/if.txt @@ -0,0 +1,14 @@ +تكتب الجمل الشرطية بالصيغة التالية: +ar version: +``` +إذا <تركيب شرطي> <جملة> +إذا <تركيب شرطي> { <مجموعة جمل> } +إذا <تركيب شرطي> <جملة_أو_كتلة> وإلا <جملة_أو_كتلة> +``` +en version: +``` +if +if { } +if else +``` +ليس مشروطاً حصر تركيب الشرط بأقواس هلالية لكن ذلك متاح. diff --git a/doc/ar/int.txt b/doc/ar/int.txt new file mode 100644 index 0000000..1acfbcf --- /dev/null +++ b/doc/ar/int.txt @@ -0,0 +1,20 @@ +صـحيح (Int) +عدد صحيح. يتم تحديد عدد البتات بين أقواس معقوفة. تحديد عدد البتات اختياري وبدونه يكون العدد الافتراضي للبتات 32. +ar version: +``` +صـحيح // 32 بتة +صـحيح[1] +صـحيح[8] +صـحيح[16] +صـحيح[32] +صـحيح[64] +``` +en version: +``` +Int // 32 bits +Int[1] +Int[8] +Int[16] +Int[32] +Int[64] +``` diff --git a/doc/ar/loops.txt b/doc/ar/loops.txt new file mode 100644 index 0000000..f86eebf --- /dev/null +++ b/doc/ar/loops.txt @@ -0,0 +1,32 @@ +تكتب الحلقات بالصيغ التالية: +ar version: +``` +بينما <تركيب شرطي> <جملة> +بينما <تركيب شرطي> { <مجموعة جمل> } +لكل <تهيئة عداد>، <تركيب شرطي>، <تحديث عداد> <جملة> +لكل <تهيئة عداد>، <تركيب شرطي>، <تحديث عداد> { <مجموعة جمل> } +``` +en version: +``` +while +while { } +for , , +for , , { } +``` +مثلما هو الحال مع الجمل الشرطية، ليس مشترطاً حصر التركيب الشرطي في "بينما" أو التراكيب الثلاث المتعلقة بالعداد في "لكل" بأقواس هلالية، لكن ذلك متاح. مثال: +ar version: +``` +بينما ن!=0 ن=قم_بعملية()؛ +بينما ن!=0 { ن = قم_بعملية() }؛ +لكل ع=0، ع<10، ع++ اطبع("%d\ج"، ع)؛ +لكل (ع=0، ع<10، ع++) اطبع("%d\ج"، ع)؛ +لكل ع=0، ع<10، ع++ { اطبع("%d\ج"، ع) }؛ +``` +en version: +``` +while r!=0 r=performOperation(); +while r!=0 { r = performOperation() } +for i=0, i<10, i++ print("%d\n", i); +for (i=0, i<10, i++) print("%d\n", i); +for i=0, i<10, i++ { print("%d\n", i) }; +``` diff --git a/doc/ar/modifiers.txt b/doc/ar/modifiers.txt new file mode 100644 index 0000000..e8cd1df --- /dev/null +++ b/doc/ar/modifiers.txt @@ -0,0 +1,20 @@ +يمكن وسم عناصر الشفرة المصدرية بمبدلات تستخدم لاحقا في مجالات مختلفة. المبدل يمكن أن يغير طريقة ترجمة وتنفيذ الشفرة الموسومة ويمكن أن لا يفعل سوى إضافة بيانات وصفية. المبدل له النسق التالي: +ar version: +``` +@<كلمة_تعريفية> <تعريف_العنصر_المراد_وسمه> +@<كلمة_تعريفية>[<معطيات>] <تعريف_العنصر_المراد_وسمه> +``` +en version: +``` +@ +@[] +``` +يعتمد المترجم على مبدلات معرفة مسبقا لإضافة خواص معينة على التعريفات المختلفة كما هو موضح في مواضع عدة من هذه الوثيقة. وبإمكان المستخدم إضافة مبدلات خاصة وقراءتها لاحقا باستخدام `نـبم.مدير_شبم` (`Spp.astMgr`). +ar version: +``` +@مبدلي["معطى1"، "معطى2"] دالة دالتي { ... }؛ +``` +en version: +``` +@mymodifier["arg1", "arg2"] func myFunc { ... }; +``` diff --git a/doc/ar/ptr.txt b/doc/ar/ptr.txt new file mode 100644 index 0000000..a6f5408 --- /dev/null +++ b/doc/ar/ptr.txt @@ -0,0 +1,10 @@ +مؤشر (ptr) +مؤشر إلى متغير. صنف المتغير يحدد بين أقواس معقوفة، كما يلي: +ar version: +``` +مؤشر[الصنف] +``` +en version: +``` +ptr[the_type] +``` diff --git a/doc/ar/semi_colon.txt b/doc/ar/semi_colon.txt new file mode 100644 index 0000000..b2046a7 --- /dev/null +++ b/doc/ar/semi_colon.txt @@ -0,0 +1 @@ +تستخدم الفاصلة المنقوطة "؛" للفصل بين الجمل بطريقة مشابهة للفاصلة الإعتيادية التي تفصل بين الحدود داخل القوائم. بمعنى آخر فإن الفاصلة المنقوطة ليست جزءاً من الجملة ويُمكن إهمالها إن لم يأت بعدها جملة أخرى. \ No newline at end of file diff --git a/doc/ar/word.txt b/doc/ar/word.txt new file mode 100644 index 0000000..d30a2ca --- /dev/null +++ b/doc/ar/word.txt @@ -0,0 +1,20 @@ +طـبيعي (Word) +عدد صحيح موجب. يتم تحديد عدد البتات بين أقواس معقوفة. تحديد عدد البتات اختياري وبدونه يكون العدد الافتراضي للبتات 32. +ar version: +``` +طـبيعي // 32 بتة +طـبيعي[1] +طـبيعي[8] +طـبيعي[16] +طـبيعي[32] +طـبيعي[64] +``` +en version: +``` +Word // 32 bits +Word[1] +Word[8] +Word[16] +Word[32] +Word[64] +``` From ea7dd7c26bf6c64ab11047ac76e5410dd738ca1b Mon Sep 17 00:00:00 2001 From: KaisHasan Date: Tue, 17 Jun 2025 12:30:01 +0300 Subject: [PATCH 2/7] add some arabic docs and mappings --- doc/ar/alias.txt | 11 ++++ doc/ar/cast.txt | 11 ++++ doc/ar/class.txt | 64 +++++++++++++++++++ doc/ar/direct_mapping.json | 30 +++++++++ doc/ar/function.txt | 75 ++++++++++++++++++++++ doc/ar/init.txt | 125 +++++++++++++++++++++++++++++++++++++ doc/ar/methods.txt | 100 +++++++++++++++++++++++++++++ doc/ar/ptr.txt | 28 +++++++++ doc/ar/reference.txt | 26 ++++++++ doc/ar/semi_colon.txt | 1 - doc/ar/string.txt | 42 +++++++++++++ doc/ar/terminate.txt | 9 +++ 12 files changed, 521 insertions(+), 1 deletion(-) create mode 100644 doc/ar/alias.txt create mode 100644 doc/ar/cast.txt create mode 100644 doc/ar/class.txt create mode 100644 doc/ar/function.txt create mode 100644 doc/ar/init.txt create mode 100644 doc/ar/methods.txt create mode 100644 doc/ar/reference.txt delete mode 100644 doc/ar/semi_colon.txt create mode 100644 doc/ar/string.txt create mode 100644 doc/ar/terminate.txt diff --git a/doc/ar/alias.txt b/doc/ar/alias.txt new file mode 100644 index 0000000..fddcc88 --- /dev/null +++ b/doc/ar/alias.txt @@ -0,0 +1,11 @@ +لتيسير استخدام المكتبات المكتوبة بالانجليزية داخل برامج مكتوبة بالعربية (أو العكس) يمكن إنشاء ألقاب للدالّات والأصناف والمتغيرات وذلك باستخدام الأمر "لقب" (alias) كتعريف للأمر "عرّف". بعد ذلك يمكن استخدام الأسم الأصلي أو اللقب كيفما يشاء المستخدم فكلاهما يشيران إلى نفس المعرّف. على سبيل المثال الصنف "العدد_الصحيح" هو لقب للصنف "Int" والدالة "اطبع" هي لقب للدالة "printf" وقد تم تعريف هذه الألقاب مسبقاً في الملف "متم.أسس" كما يلي: +ar version: +``` +عرّف العدد_الصحيح : لقب int؛ +عرّف اطبع : لقب printf؛ +``` +en version: +``` +def int: alias Int[32]; // `int` is now equivalent to `Int[32]` +def MyType: alias صـنفي; // `MyType` is now equivalent to `صـنفي` +``` diff --git a/doc/ar/cast.txt b/doc/ar/cast.txt new file mode 100644 index 0000000..971166a --- /dev/null +++ b/doc/ar/cast.txt @@ -0,0 +1,11 @@ +يمكن تمثيل المتغيرات بصنف غير صنفها الحقيقي باستخدام المؤثر "~مثّل" (~cast) متبوعاً بقوسين معقوفين بينهما الصنف المراد تمثيله، كما في المثال التالي: +ar version: +``` +عرّف ح : عـائم؛ +إطبع_عددا_صحيحا(ح~مثّل[صحيح])؛ +``` +en version: +``` +def f : Float; +printInteger(f~cast[Int]); +``` diff --git a/doc/ar/class.txt b/doc/ar/class.txt new file mode 100644 index 0000000..c5d5029 --- /dev/null +++ b/doc/ar/class.txt @@ -0,0 +1,64 @@ +تعرّف الهياكل باستخدام الأمر "صنف" كتعريف في الأمر "عرّف": +ar version: +``` +عرّف <اسم_الصنف> : صنف { <مجموعة_تعريفات> } +``` +en version: +``` +def : class { } +``` +بعد تعريف الصنف يصبح الصنف متوفراً لتعريف المتغيرات. الولوج إلى عناصر الهيكل يتم باستخدام مؤثر النقطة. مثال: +ar version: +``` +عرّف النقطة : صنف { + عرّف س : العدد_الحقيقي؛ + عرّف ص : العدد_الحقيقي؛ +}؛ + +عرّف ن : النقطة؛ +ن.س = إقرأ_قيمة()؛ +ن.ص = إقرأ_قيمة()؛ +``` +en version: +``` +def Point : class { + def x : Float; + def y : Float; +}; + +def p : Point; +p.x = readValue(); +p.y = readValue(); +``` +يمكن أيضًا استخدام الصيغة المختصرة التي تغنيك عن استعمال الأمر "عرف"، كما يلي: +ar version: +``` +صنف <اسم_الصنف> { <مجموعة_تعريفات> } +``` +en version: +``` +class { } +``` +كما في المثال التالي: +ar version: +``` +صنف النقطة { + عرّف س : العدد_الحقيقي؛ + عرّف ص : العدد_الحقيقي؛ +}؛ + +عرّف ن : النقطة؛ +ن.س = إقرأ_قيمة()؛ +ن.ص = إقرأ_قيمة()؛ +``` +en version: +``` +class Point { + def x : Float; + def y : Float; +}; + +def p : Point; +p.x = readValue(); +p.y = readValue(); +``` diff --git a/doc/ar/direct_mapping.json b/doc/ar/direct_mapping.json index c4c8210..ce01e18 100644 --- a/doc/ar/direct_mapping.json +++ b/doc/ar/direct_mapping.json @@ -7,4 +7,34 @@ "/t": "/ت", "continue": "أكمل", "break": "اقطع", + "import": "اشمل", + ";": "؛", + "buf": "صوان", + "getLength": "هات_الطول", + "alloc": "احجز", + "realloc": "غير_الحجز", + "assign": "عين", + "append": "ألحق", + "concat": "سلسل", + "find": "جد", + "findLast": "جد_آخر", + "compare": "قارن", + "replace": "استبدل", + "trim": "شذب", + "trimStart": "شذب_البداية", + "trimEnd": "شذب_النهاية", + "toUpperCase": "كبر", + "toLowerCase": "صغر", + "slice": "اجتزئ", + "split": "قطع", + "merge": "ادمج", + "copy": "انسخ", + "scan": "امسح", + "isSpace": "أهو_مسافة", + "isEqual": "أمتطابق", + "remove": "أزل", + "format": "املأ", + "parseInt": "اقرأ_صحيح", + "parseFloat": "اقرأ_عائم", + "parseHexDigit": "اقرأ_محرف_هكس" } \ No newline at end of file diff --git a/doc/ar/function.txt b/doc/ar/function.txt new file mode 100644 index 0000000..57b0e28 --- /dev/null +++ b/doc/ar/function.txt @@ -0,0 +1,75 @@ +تعرّف الدالات باستخدام الأمر "دالّة" كتعريف في الأمر "عرّف": +ar version: +``` +عرّف <اسم_الدالة> : دالّة (<معطيات>) => <صنف_النتيجة> { <متن_الدالة> } +``` +en version: +``` +def : function () => { } +``` +وتكون المعطيات بالصيغة التالية: +ar version: +``` +<اسم_المعطى>:<نوع_المعطى>، <اسم_المعطى>:<نوع_المعطى> ... +``` +en version: +``` +:, : ... +``` +كما في المثال التالي: +ar version: +``` +عرف مضروب : دالّة (ع:العدد_الصحيح) => العدد_الصحيح +{ + إذا ع==1 ارجع 1؛ + ارجع ع * مضروب(ع-1)؛ +} +``` +en version: +``` +def factorial : function (i:Int) => Int +{ + if i==1 return 1; + return i*factorial(i-1); +} +``` +يمكن أيضًا استخدام الصيغة المختصرة دون الحاجة للأمر "عرف" كما يلي: +ar version: +``` +دالة <اسم_الدالة> (<معطيات>) => <صنف_النتيجة> { <متن_الدالة> } +``` +en version: +``` +function () => { } +``` +كما في المثال التالي: +ar version: +``` +دالة مضروب (ع:العدد_الصحيح) => العدد_الصحيح +{ + إذا ع==1 أرجع 1؛ + أرجع ع * مضروب(ع-1)؛ +} +``` +en version: +``` +function factorial (i:Int) => Int +{ + if i==1 return 1; + return i*factorial(i-1); +} +``` +استدعاء الدوال يتم باستخدام اسم الدالة يليه قائمة المعطيات بين قوسين هلاليين. إن لم تكن للدالة أي معطيات فيجب إتباع اسمها بقوسين هلاليين فارغين. + +ar version: +``` +س = إقرأ_رقماً()؛ +ص = إقرأ_رقماً()؛ +ارسم_نقطة(س، ص)؛ +``` +en version: +``` +x = readNumber(); +y = readNumber(); +drawPoint(x, y); +``` diff --git a/doc/ar/init.txt b/doc/ar/init.txt new file mode 100644 index 0000000..4bf99a2 --- /dev/null +++ b/doc/ar/init.txt @@ -0,0 +1,125 @@ +يمكن للمستخدم تخصيص عملية تهيئة الكائنات باستخدام الأمر `عملية` (handler) وهذه صيغته: +ar version: +``` +عملية هذا~هيئ (<معطيات>) { <متن_الدالة> }؛ +``` +en version: +``` +handler this~init () { }; +``` +عند تعريف هذه العملية داخل الصنف يقوم المترجم باستدعاء هذه الدالة كلما احتاج لتهيئة كائن جديد. يمكن تعريف معطيات لهذه الدالة إذا أردت تهيئة الكائن من كائن آخر كما هو الحال عند إرجاع هذا الكائن من دالة كقيمة أو استلامه في الدالة كمعطى. فعند تهيئة العنصر في إحدى هذه الحالات يقوم المترجم باستدعاء هذه الدالة وتمرير العنصر الأصلي كي تقوم الدلة بنسخه لـ`هذا`. أما في حالة عدم تخصيص عملية التهيئة فإن المترجم في هذه الحالات يقوم بنسخ ذاكرة الكائن. +ملاحظة: عند تعريف أي عملية لتخصيص التهيئة يمتنع المترجم عن التهيئة الافتراضية في كل الحالات وبالتالي تحتاج لتعريف كل حالات التهيئة، أي حالة التهيئة بدون معطيات وحالة التهيئة من كائن آخر. +المثال التالي يوضح تخصيص التهيئة: +ar version: +``` +صنف نـقطة { + عرف س: صحيح؛ + عرف ص: صحيح؛ + + عملية هذا~هيئ() { + هذا.س = 0؛ + هذا.ص = 0؛ + }؛ + عملية هذا~هيئ(مصدر: سند[نـقطة]) { + هذا.س = مصدر.س؛ + هذا.ص = مصدر.ص؛ + }؛ +}؛ + +عرف ن: نـقطة: // يستدعي عملية التهيئة دون معطيات. +دالة هات_نقطة (): نـقطة { + عرف ن: نقطة؛ + ارجع ن: // يستدعي عملية التهيئة بالمعطى لتهيئة العنصر الذي سيستلم ن +}؛ +``` +en version: +``` +class Point { + def x: int; + def y: int; + + handler this~init() { + this.x = 0; + this.y = 0; + }; + handler this~init(src: ref[Point]) { + this.x = src.x; + this.y = src.y; + }; +}: + +def p: Point; // calls this~init() +func getPoint (): Point { + def p: Point; + return p; // calls this~init(src) +}; +``` +عند وجود عمليات تهيئة بمعطيات فإن تعريف المتغير يحتاج لتمرير هذه المعطيات، ويكون التعريف كالتالي: +ar version: +``` +عرف <اسم_المتغير>: <صنف_المتغير>(<معطيات>)؛ +``` +en version: +``` +def : (); +``` +المثال التالي يوضح تهيئة بمعطيات: +ar version: +``` +صنف نـقطة { + عرف س: صحيح؛ + عرف ص: صحيح؛ + + عملية هذا~هيئ(س: صحيح، ص: صحيح) { + هذا.س = س؛ + هذا.ص = ص؛ + }؛ +}؛ + +عرف ن: نـقطة(5، 10)؛ +``` +en version: +``` +class Point { + def x: int; + def y: int; + + handler this~init(x: int, y: int) { + this.x = x; + this.y = y; + }; +}: + +def p: Point(5, 10); +``` +يمكن أيضا تخصيص التهيئة بدون معطيات بكتابة عمليات تلك التهيئة مباشرة داخل متن الصنف، وهذا مطابق لتعريف `عملية هذا~هيئ()`، كما في المثال التالي: +ar version: +``` +صنف نـقطة { + عرف س: صحيح؛ + عرف ص: صحيح؛ + + هذا.س = 0؛ // مطابق لفعلها داخل عملية هذا~هيئ() + هذا.ص = 0؛ // مطابق لفعلها داخل عملية هذا~هيئ() + + عملية هذا~هيئ(مصدر: سند[نـقطة]) { + هذا.س = مصدر.س؛ + هذا.ص = مصدر.ص؛ + }؛ +}؛ +``` +en version: +``` +class Point { + def x: int; + def y: int; + + this.x = 0; + this.y = 0; + + handler this~init(src: ref[Point]) { + this.x = src.x; + this.y = src.y; + }; +}: +``` diff --git a/doc/ar/methods.txt b/doc/ar/methods.txt new file mode 100644 index 0000000..946fa5b --- /dev/null +++ b/doc/ar/methods.txt @@ -0,0 +1,100 @@ +الوظائف هي دالات تعرف داخل الأصناف ويتم استدعاؤها باستخدام كائن من ذلك الصنف. تُعرف الوظائف بتعريف دالة داخل متن الصنف مع إضافة المبدل `@عضو` (@member) لتلك الدالة وجعل أول معطى لتلك الدالة سندًا لذلك الصنف. +ar version: +``` +صنف <اسم_الصنف> { + @عضو دالة <اسم_الوظيفة> (هذا: سند[هذا_الصنف]، <تعريفات_المعطيات>): <صنف_الإرجاع> { + <متن_الوظيفة> + }؛ +}؛ + +<اسم_الكائن>.<اسم_الوظيفة>(<المعطيات>)؛ +``` +en version: +``` +class { + @member func (this: ref[this_type], ): { + + }; +}; + +.(); +``` +داخل الوظيفة يمكنك الوصول إلى الكائن المرتبط بذلك الاستدعاء باستخدام المعطى الأول للدالة (هذا) كما لو كان المستخدم قد مرر ذلك الكائن إلى الدالة يدويًا. مثال: +ar version: +``` +صنف نـقطة { + عرف س: عائم؛ + عرف ص: عائم؛ + @عضو دالة هات_المسافة (هذا: سند[هذا_الصنف]): عائم { + ارجع ريـاضيات.جذر(هذا.س * هذا.س + هذا.ص * هذا.ص)؛ + }؛ +}؛ +عرف ن: نـقطة؛ +ن.س = 3؛ +ن.ص = 4؛ +اطبع(ن.هات_المسافة())؛ // سيطبع 5 +``` +en version: +``` +class Point { + def x: float; + def y: float; + @member func getDistance (this: ref[this_type]):float { + return Math.sqrt(this.x * this.x + this.y * this.y); + }; +}: +def p: Point; +p.x = 3; +p.y = 4; +print(p.getDistance()); // prints 5 +``` +يمكن أيضًا تعريف الوظائف باستخدام الأمر `عملية` (handler) وهو مجرد تجميل لغوي للطريقة المذكورة أعلاه: +ar version: +``` +صنف <اسم_الصنف> { + عملية هذا.<اسم_الوظيفة> (<تعريفات_المعطيات>): <صنف_الإرجاع> { + <متن_الوظيفة> + }؛ +}؛ + +<اسم_الكائن>.<اسم_الوظيفة>(<المعطيات>)؛ +``` +en version: +``` +class { + handler this. (): { + + }; +}; + +.(); +``` +مثال: +ar version: +``` +صنف نـقطة { + عرف س: عائم؛ + عرف ص: عائم؛ + عملية هذا.هات_المسافة (): عائم { + ارجع ريـاضيات.جذر(هذا.س * هذا.س + هذا.ص * هذا.ص)؛ + }؛ +}؛ +عرف ن: نـقطة؛ +ن.س = 3؛ +ن.ص = 4؛ +اطبع(ن.هات_المسافة())؛ // سيطبع 5 +``` +en version: +``` +class Point { + def x: float; + def y: float; + handler this.getDistance ():float { + return Math.sqrt(this.x * this.x + this.y * this.y); + }; +}: +def p: Point; +p.x = 3; +p.y = 4; +print(p.getDistance()); // prints 5 +``` diff --git a/doc/ar/ptr.txt b/doc/ar/ptr.txt index a6f5408..2b96b0b 100644 --- a/doc/ar/ptr.txt +++ b/doc/ar/ptr.txt @@ -8,3 +8,31 @@ en version: ``` ptr[the_type] ``` +المؤشرات تستخدم للإشارة إلى مواقع في الذاكرة والتحكم بمحتويات تلك المواقع. تُعرّف المؤشرات باستخدام الصنف "مؤشر" (ptr) متبوعاً بقوسين معقوفين بينهما صنف محتوى الذاكرة المشار إليه بالمؤشر: +ar version: +``` +عرّف <اسم_المؤشر> : مؤشر[<صنف_المحتوى>] +``` +en version: +``` +def : ptr[] +``` +يمكن الولوج إلى المحتوى المشار إليه بالمؤشر عن طريق المؤثر "~محتوى" (~cnt) ويمكن الحصول على موقع أي متغير عن طريق المؤثر "~مؤشر" (~ptr) كما في المثال التالي: +ar version: +``` +عرّف م : مؤشر[العدد_الصحيح]؛ +عرّف س : العدد_الصحيح؛ +س = 5؛ +م = س~مؤشر؛ +م~محتوى = 1؛ +// قيمة س الآن 1 وليس 5. +``` +en version: +``` +def p : ptr[Int]; +def x : Int; +x = 5; +p = x~ptr; +p~cnt = 1; +// x is now equal to 1, not 5. +``` diff --git a/doc/ar/reference.txt b/doc/ar/reference.txt new file mode 100644 index 0000000..104575a --- /dev/null +++ b/doc/ar/reference.txt @@ -0,0 +1,26 @@ +السندات مشابهة لعمل المؤشرات إلا أنها أبسط في التعامل من المؤشرات حيث لا تتطلب منك سوى تعريف المتغير على أنه سند ومن ثم التعامل معه بنفس طريقة التعامل مع متغيرات اعتيادية، اي الوصول إلى المحتوى دون الحاجة لاستخدام المؤثر `~محتوى`. +ar version: +``` +عرّف <اسم_السند> : سند[<صنف_المحتوى>] +``` +en version: +``` +def : ref[] +``` +قبل استخدام السند تحتاج لتحديد قيمة المؤشر لذلك السند ويختلف ذلك فيما لو كان السند أحد معطيات دالة أم لا. إذا كان السند معطى لدالة فكل ما تحتاج لفعله تمرير متغير من صنف محتوى السند لتلك الدالة ويتولى المترجم تلقائيا تمرير مؤشر المتغير واستخدامه لذلك السند كما في المثال التالي: +ar version: +``` +دالة ضاعف (سم: سند[صحيح]) { سم *= 2 }؛ + +عرف م: صحيح = 5؛ +افعل(م)؛ +// الآن م == 10 +``` +en version: +``` +func twice (ri: ref[int]) { ri *= 2 }; + +def i: int = 5; +twice(i); +// now i == 10 +``` diff --git a/doc/ar/semi_colon.txt b/doc/ar/semi_colon.txt deleted file mode 100644 index b2046a7..0000000 --- a/doc/ar/semi_colon.txt +++ /dev/null @@ -1 +0,0 @@ -تستخدم الفاصلة المنقوطة "؛" للفصل بين الجمل بطريقة مشابهة للفاصلة الإعتيادية التي تفصل بين الحدود داخل القوائم. بمعنى آخر فإن الفاصلة المنقوطة ليست جزءاً من الجملة ويُمكن إهمالها إن لم يأت بعدها جملة أخرى. \ No newline at end of file diff --git a/doc/ar/string.txt b/doc/ar/string.txt new file mode 100644 index 0000000..c4a1869 --- /dev/null +++ b/doc/ar/string.txt @@ -0,0 +1,42 @@ +نـص (String) +الصنف `نـص` يسهل التعامل مع سلاسل المحارف فهو يتولى مسؤولية حجز وتحرير الذاكرة الخاصة بسلسلة المحارف مع مراعاة الأداء وتجنب عمليات النسخ وحجز الذاكرة غير الضرورية. يوفر الصنف دالات لتسهيل العمليات المختلفة على سلاسل الحارف. المثال التالي يوضح التعامل مع سلاسل المحارف: +ar version: +``` +دالة رئيسي { + عرف نص: نـص = هات_نص()؛ + نص += " والحمد لله"؛ // هنا يتم تمديد حجم الذاكرة المحجوزة + عرف نص2: نـص = نص؛ // هنا لا يتم إنشاء نسخة جديدة من النص + نص += "."؛ // الآن يتم إنشاء نسخة جديدة كي لا يتأثر نص2 + اطبع_نص(نص)؛ // لا يتم هنا إعادة حجز الذاكرة أو نسخها + // الآن يتم تحرير ذاكرة نص ونص2 +} + +دالة هات_نص (): نـص { + عرف ن: نـص = "بسم الله"؛ + ارجع ن؛ // لا يتم هنا إعادة حجز الذاكرة أو نسخها +} + +دالة اطبع_نص (ن: نـص) { + طـرفية.اطبع(ن)؛ // يتم هنا التحويل تلقائيا من صنف نـص إلى مؤشر على محارف. +} +``` +en version: +``` +func main { + def str: String = getString(); + str += " world"; // Memory block is expanded here. + def str2: String = str; // No new memory is allocated here. + str += "."; // Copy of the string buffer is created so str2 is not affected. + printStr(str); // No new memory allocation or copy happens here. + // Now memory blocks of str and str2 are freed. +} + +func getString (): String { + def s: String = "Hello"; + return s; // No new memory allocation or copy happens here. +} + +func printStr (s: String) { + Console.print(s); // s is automatically casted into ptr[array[Char]]. +} +``` diff --git a/doc/ar/terminate.txt b/doc/ar/terminate.txt new file mode 100644 index 0000000..058d204 --- /dev/null +++ b/doc/ar/terminate.txt @@ -0,0 +1,9 @@ +مثلما هو الحال مع تهيئة الكائنات، يمكن للمستخدم تخصيص عملية إتلاف الكائن وذلك بإضافة التعريف التالي إلى الصنف: +ar version: +``` +عملية هذا~أتلف () { <متن_الدالة> }؛ +``` +en version: +``` +handler this~terminate () { }; +``` From 4b71c87d43a1be449986f2c1da2258a0bfbbde19 Mon Sep 17 00:00:00 2001 From: KaisHasan Date: Wed, 18 Jun 2025 07:51:14 +0300 Subject: [PATCH 3/7] add some Arabic docs and replace some docs with just simple mapping --- doc/ar/archint.txt | 2 -- doc/ar/archword.txt | 2 -- doc/ar/array_template.txt | 46 ++++++++++++++++++++++++++++++++ doc/ar/bool.txt | 2 -- doc/ar/char.txt | 2 -- doc/ar/direct_mapping.json | 36 +++++++++++++++++++++++-- doc/ar/float.txt | 14 ---------- doc/ar/int.txt | 20 -------------- doc/ar/map.txt | 54 ++++++++++++++++++++++++++++++++++++++ doc/ar/srdref.txt | 20 ++++++++++++++ doc/ar/word.txt | 20 -------------- 11 files changed, 154 insertions(+), 64 deletions(-) delete mode 100644 doc/ar/archint.txt delete mode 100644 doc/ar/archword.txt create mode 100644 doc/ar/array_template.txt delete mode 100644 doc/ar/bool.txt delete mode 100644 doc/ar/char.txt delete mode 100644 doc/ar/float.txt delete mode 100644 doc/ar/int.txt create mode 100644 doc/ar/map.txt create mode 100644 doc/ar/srdref.txt delete mode 100644 doc/ar/word.txt diff --git a/doc/ar/archint.txt b/doc/ar/archint.txt deleted file mode 100644 index e1752e0..0000000 --- a/doc/ar/archint.txt +++ /dev/null @@ -1,2 +0,0 @@ -صـحيح_متكيف (ArchInt) -عدد صحيح بعدد بتات مطابقة لمعمارية النظام، أي بحجم 32 بت على أنظمة 32 بت وبحجم 64 بت على أنظمة 64 بت. diff --git a/doc/ar/archword.txt b/doc/ar/archword.txt deleted file mode 100644 index 5ee4c1a..0000000 --- a/doc/ar/archword.txt +++ /dev/null @@ -1,2 +0,0 @@ -طـبيعي_متكيف (ArchWord) -عدد صحيح موجب بعدد بتات مطابقة لمعمارية النظام، أي بحجم 32 بت على أنظمة 32 بت وبحجم 64 بت على أنظمة 64 بت. diff --git a/doc/ar/array_template.txt b/doc/ar/array_template.txt new file mode 100644 index 0000000..0dc0b67 --- /dev/null +++ b/doc/ar/array_template.txt @@ -0,0 +1,46 @@ +مـصفوفة (Array) +قالب مصفوفة ديناميكية تتولى مسؤولية إدارة الذاكرة مع مراعاة الأداء وتجنب عمليات النسخ وحجز الذاكرة غير الضرورية. المثال التالي يوضح التعامل مع هذه المصفوفة الديناميكية: +ar version: +``` +دالة رئيسي { + عرف م: مـصفوفة[صـحيح] = هات_مصفوفة()؛ + م.أضف(1)؛ // هنا يتم تمديد حجم الذاكرة المحجوزة + عرف م2: مـصفوفة[صـحيح] = م؛ // هنا لا يتم إنشاء نسخة جديدة من الصوان + م.أضف(2)؛ // الآن يتم إنشاء نسخة جديدة كي لا يتأثر م2 + اطبع_مصفوفة(م)؛ // لا يتم هنا إعادة حجز الذاكرة أو نسخها + // الآن يتم تحرير ذاكرة م وم2 +} + +دالة هات_مصفوفة (): مـصفوفة[صـحيح] { + عرف ن: مـصفوفة[صـحيح]؛ + ن.أضف(0)؛ + ارجع ن؛ // لا يتم هنا إعادة حجز الذاكرة أو نسخها +} + +دالة اطبع_مصفوفة (ن: مـصفوفة[صـحيح]) { + عرف ع: صـحيح؛ + لكل ع = 0، ع < ن.هات_الطول()، ++ع طـرفية.اطبع("%d\ج"، ن(ع))؛ +} +``` +en version: +``` +func main { + def a: Array[Int] = getArray(); + a.add(1); // Here the allocated memory block is expanded. + def a2: Array[Int] = a; // No new memory block is allocated here. + a.add(2); // Now a new copy of the buffer is created so a2 is not affected. + printArray(a); // No new memory block is created or copied here. + // Now the memory blocks of a and a2 are freed. +} + +func getArray(): Array[Int] { + def a: Array[Int]; + a.add(0); + return a; // No new memory block is allcoated here and memory copy happens. +} + +func printArray (a: Array[Int]) { + def i: Int; + for i = 0, i < a.getLength(), ++i Console.print("%d\n", a(i)); +} +``` diff --git a/doc/ar/bool.txt b/doc/ar/bool.txt deleted file mode 100644 index 69bd793..0000000 --- a/doc/ar/bool.txt +++ /dev/null @@ -1,2 +0,0 @@ -ثـنائي (Bool) -قيمية ثنائية، وهو مجرب لقب للصنف `طـبيعي[1]`. diff --git a/doc/ar/char.txt b/doc/ar/char.txt deleted file mode 100644 index 8ab9a8c..0000000 --- a/doc/ar/char.txt +++ /dev/null @@ -1,2 +0,0 @@ -مـحرف (Char) -محرف، وهو مجرد لقب للصنف `طـبيعي[8]`. diff --git a/doc/ar/direct_mapping.json b/doc/ar/direct_mapping.json index ce01e18..3aff935 100644 --- a/doc/ar/direct_mapping.json +++ b/doc/ar/direct_mapping.json @@ -1,5 +1,11 @@ { - "def": "عرف", + "Char": "مـحرف", + "Int": "صـحيح", + "Bool": "ثـنائي", + "ArchInt": "صـحيح_متكيف", + "Float": "عـائم", + "Word": "طـبيعي", + "ArchWord": "طـبيعي_متكيف", "and": "و", "or": "أو", "/n": "/ج", @@ -36,5 +42,31 @@ "format": "املأ", "parseInt": "اقرأ_صحيح", "parseFloat": "اقرأ_عائم", - "parseHexDigit": "اقرأ_محرف_هكس" + "parseHexDigit": "اقرأ_محرف_هكس", + "getBufSize": "هات_حجم_الصوان", + "add": "أضف", + "insert": "احشر", + "clear": "فرّغ", + "keys": "مفاتيح", + "values": "قيم", + "keyAt": "المفتاح_عند", + "valAt": "القيمة_عند", + "set": "حدد", + "setAt": "حدد_عند", + "removeAt": "أزل_عند", + "findPos": "جد_الموقع", + "obj": "كائن", + "refCounter": "عداد_السندات", + "construct": "أنشئ", + "own": "تملك", + "release": "حرر", + "isNull": "أهو_عدم", + "WkRef": "سـندهم", + "Console": "طـرفية", + "getChar": "أدخل_محرفا", + "putChar": "أخرج_محرفا", + "print": "اطبع", + "getInt": "أدخل_صحيح", + "getFloat": "أدخل_عائم", + "getString": "أدخل_محارف" } \ No newline at end of file diff --git a/doc/ar/float.txt b/doc/ar/float.txt deleted file mode 100644 index 7bca5f1..0000000 --- a/doc/ar/float.txt +++ /dev/null @@ -1,14 +0,0 @@ -عـائم (Float) -عدد عائم. يتم تحديد عدد البتات بين أقواس معقوفة. تحديد عدد البتات اختياري وبدونه يكون العدد الافتراضي للبتات 32. -ar version: -``` -عـائم // 32 بتة -عـائم[32] -عـائم[64] -``` -en version: -``` -Float // 32 bits -Float[32] -Float[64] -``` diff --git a/doc/ar/int.txt b/doc/ar/int.txt deleted file mode 100644 index 1acfbcf..0000000 --- a/doc/ar/int.txt +++ /dev/null @@ -1,20 +0,0 @@ -صـحيح (Int) -عدد صحيح. يتم تحديد عدد البتات بين أقواس معقوفة. تحديد عدد البتات اختياري وبدونه يكون العدد الافتراضي للبتات 32. -ar version: -``` -صـحيح // 32 بتة -صـحيح[1] -صـحيح[8] -صـحيح[16] -صـحيح[32] -صـحيح[64] -``` -en version: -``` -Int // 32 bits -Int[1] -Int[8] -Int[16] -Int[32] -Int[64] -``` diff --git a/doc/ar/map.txt b/doc/ar/map.txt new file mode 100644 index 0000000..0ddf9a3 --- /dev/null +++ b/doc/ar/map.txt @@ -0,0 +1,54 @@ +تـطبيق (Map) +قالب تـطبيق (Map) يتيح تحديد صنفي المفتاح والقيمة ويتولى مسؤولية إدارة الذاكرة مع مراعاة الأداء وتجنب عمليات النسخ وحجز الذاكرة غير الضرورية. المثال التالي يوضح التعامل مع هذا التطبيق: +ar version: +``` +دالة رئيسي { + عرف ت1: تـطبيق[صـحيح، صـحيح] = هات_تطبيق()؛ + ت1.حدد(7، 50)؛ // هنا يتم تمديد حجم الذاكرة المحجوزة. + عرف ت2: تـطبيق[صـحيح، صـحيح] = ت1؛ // هنا لا يتم إنشاء نسخة جديدة من الصوان. + ت2.حدد(12، 7)؛ // الآن يتم إنشاء نسخة جديدة كي لا يتأثر ت1. + اطبع_تطبيق(ت2)؛ // لا يتم هنا إعادة حجز الذاكرة أو نسخها. + اطبع_صحيح(ت2(7))؛ // سيطبع 50. + اطبع_صحيح(ت2(12))؛ // سيطبع 7. + // الآن يتم تحرير ذاكرة ت1 و ت2. +} + +دالة هات_تطبيق (): تطبيق[صـحيح، صـحيح] { + عرف ت: تـطبيق[صـحيح، صـحيح]؛ + ت.أضف(0، 10)؛ + ارجع ت؛ // لا يتم هنا إعادة حجز الذاكرة أو نسخها. +} + +دالة اطبع_تطبيق (ت: تـطبيق[صـحيح، صـحيح]) { + عرف ع: صـحيح؛ + لكل ع = 0، ع < ت.هات_الطول()، ++ع { + طـرفية.اطبع("%d = %d\ج"، ت.المفتاح_عند(ع)، ت.القيمة_عند(ع))؛ + } +} +``` +en version: +``` +func main { + def m1: Map[Int, Int] = getMap(); + m1.set(7, 50); // Memory buffer is expanded here. + def m2: Map[Int, Int] = m1; // Buffer is not cloned here. + m2.set(12, 7); // Buffer is cloned here so that m1 is not affected. + printMap(m2); // No buffer cloning happens here. + printInt(m2(7)); // Prints 50. + printInt(m2(12)); // Prints 7. + // Now buffers of m1 and m2 are freed. +} + +func getMap (): Map[Int, Int] { + def m: Map[Int, Int]; + m.add(0, 10); + return m; // No buffer cloning happens here. +} + +func printMap (m: Map[Int, Int]) { + def i: Int; + for i = 0, i < m.getLength(), ++i { + Console.print("%d = %d\n", m.keyAt(i), m.valAt(i)); + } +} +``` diff --git a/doc/ar/srdref.txt b/doc/ar/srdref.txt new file mode 100644 index 0000000..e739d2d --- /dev/null +++ b/doc/ar/srdref.txt @@ -0,0 +1,20 @@ +سـندنا (SrdRef) +قالب سند مشترك يتولى تلقائيا تحرير الكائن عندما تنتهي الحاجة له. يحتفظ هذا السند بعداد لعدد السندات المشتركة التي تشير لنفس الكائن. كلما يُتلف أحد السندات يُنقص العداد وعندما يصل العداد لصفر يُتلف الكائن وتحرر ذاكرته. +ar version: +``` +دالة رئيسي { + عرف س: سـندنا[صـنفي] = سـندنا[صـنفي].أنشئ()؛ + عرف ص: سـندنا[صـنفي] = س؛ // الآن كلا السندين يشيران لنفس الكائن وعداده الآن 2. + س.حرر()؛ // العداد صار 1 لكن الكائن لم يُحرر بعد. + ص.حرر()؛ // الآن أتلف الكائن وحررت ذاكرته. +} +``` +en version: +``` +func main { + def x: SrdRef[MyType] = SrdRef[MyType].construct(); + def y: SrdRef[MyType] = x; // Both refs point to same object. Counter is now 2. + x.release(); // Counter is now 1 and the object is not freed yet. + y.release(); // Now the object is destructed and its memory is released. +} +``` diff --git a/doc/ar/word.txt b/doc/ar/word.txt deleted file mode 100644 index d30a2ca..0000000 --- a/doc/ar/word.txt +++ /dev/null @@ -1,20 +0,0 @@ -طـبيعي (Word) -عدد صحيح موجب. يتم تحديد عدد البتات بين أقواس معقوفة. تحديد عدد البتات اختياري وبدونه يكون العدد الافتراضي للبتات 32. -ar version: -``` -طـبيعي // 32 بتة -طـبيعي[1] -طـبيعي[8] -طـبيعي[16] -طـبيعي[32] -طـبيعي[64] -``` -en version: -``` -Word // 32 bits -Word[1] -Word[8] -Word[16] -Word[32] -Word[64] -``` From 6c0fa717de7f9d6520273de10e1988d24e386062 Mon Sep 17 00:00:00 2001 From: KaisHasan Date: Sat, 21 Jun 2025 09:15:21 +0300 Subject: [PATCH 4/7] add and modify Arabic docs --- doc/ar/direct_mapping.json | 21 +++- doc/ar/libs/WebPlatform/Align.txt | 7 ++ doc/ar/libs/WebPlatform/Animation.txt | 4 + doc/ar/libs/WebPlatform/AudioResource.txt | 11 +++ doc/ar/libs/WebPlatform/Background.txt | 4 + .../libs/WebPlatform/BackgroundPosition.txt | 8 ++ doc/ar/libs/WebPlatform/BackgroundSize.txt | 5 + doc/ar/libs/WebPlatform/BasicWidget.txt | 4 + doc/ar/libs/WebPlatform/BorderStyle.txt | 11 +++ doc/ar/libs/WebPlatform/Box.txt | 10 ++ doc/ar/libs/WebPlatform/BoxShadow.txt | 4 + doc/ar/libs/WebPlatform/Browser.txt | 5 + doc/ar/libs/WebPlatform/Button.txt | 4 + doc/ar/libs/WebPlatform/Canvas.txt | 7 ++ doc/ar/libs/WebPlatform/CanvasResource.txt | 6 ++ doc/ar/libs/WebPlatform/Color.txt | 8 ++ doc/ar/libs/WebPlatform/Component.txt | 8 ++ doc/ar/libs/WebPlatform/Cursor.txt | 21 ++++ doc/ar/libs/WebPlatform/Dimensions.txt | 5 + doc/ar/libs/WebPlatform/Direction.txt | 5 + doc/ar/libs/WebPlatform/Display.txt | 9 ++ doc/ar/libs/WebPlatform/DocView.txt | 5 + doc/ar/libs/WebPlatform/DomEventSignal.txt | 4 + doc/ar/libs/WebPlatform/Drawing.txt | 16 +++ doc/ar/libs/WebPlatform/Errors.txt | 7 ++ doc/ar/libs/WebPlatform/Flex.txt | 4 + doc/ar/libs/WebPlatform/Floating.txt | 6 ++ doc/ar/libs/WebPlatform/FontWeight.txt | 5 + doc/ar/libs/WebPlatform/Hyperlink.txt | 7 ++ doc/ar/libs/WebPlatform/Image.txt | 4 + doc/ar/libs/WebPlatform/ImageResource.txt | 7 ++ doc/ar/libs/WebPlatform/ImageSource.txt | 5 + doc/ar/libs/WebPlatform/Input.txt | 10 ++ doc/ar/libs/WebPlatform/Justify.txt | 10 ++ doc/ar/libs/WebPlatform/Layout.txt | 7 ++ doc/ar/libs/WebPlatform/Length.txt | 16 +++ doc/ar/libs/WebPlatform/Length4.txt | 16 +++ .../libs/WebPlatform/MouseButtonPayload.txt | 6 ++ doc/ar/libs/WebPlatform/MouseMovePayload.txt | 7 ++ doc/ar/libs/WebPlatform/Overflow.txt | 8 ++ doc/ar/libs/WebPlatform/Picture.txt | 5 + doc/ar/libs/WebPlatform/Position.txt | 8 ++ doc/ar/libs/WebPlatform/Rectangle.txt | 7 ++ doc/ar/libs/WebPlatform/RegExp.txt | 6 ++ doc/ar/libs/WebPlatform/RoutePayload.txt | 6 ++ doc/ar/libs/WebPlatform/Router.txt | 6 ++ doc/ar/libs/WebPlatform/RoutingStack.txt | 6 ++ doc/ar/libs/WebPlatform/RoutingSwitcher.txt | 8 ++ doc/ar/libs/WebPlatform/SafeRequest.txt | 6 ++ doc/ar/libs/WebPlatform/SafeTimeout.txt | 5 + doc/ar/libs/WebPlatform/SafeTimer.txt | 5 + doc/ar/libs/WebPlatform/ScalingAlgorithm.txt | 8 ++ doc/ar/libs/WebPlatform/Select.txt | 7 ++ doc/ar/libs/WebPlatform/ServerSession.txt | 4 + doc/ar/libs/WebPlatform/Signal.txt | 8 ++ doc/ar/libs/WebPlatform/Stack.txt | 6 ++ doc/ar/libs/WebPlatform/StaticRoute.txt | 6 ++ doc/ar/libs/WebPlatform/Storage.txt | 9 ++ doc/ar/libs/WebPlatform/StyleSet.txt | 24 +++++ doc/ar/libs/WebPlatform/Switcher.txt | 6 ++ .../libs/WebPlatform/SwitcherTransition.txt | 6 ++ doc/ar/libs/WebPlatform/Text.txt | 5 + doc/ar/libs/WebPlatform/TextAlign.txt | 7 ++ doc/ar/libs/WebPlatform/TextDecoration.txt | 7 ++ .../libs/WebPlatform/TextDecorationStyle.txt | 8 ++ doc/ar/libs/WebPlatform/TextInput.txt | 8 ++ doc/ar/libs/WebPlatform/TextOverflow.txt | 5 + doc/ar/libs/WebPlatform/TextShadow.txt | 4 + doc/ar/libs/WebPlatform/TouchPayload.txt | 15 +++ doc/ar/libs/WebPlatform/Transform.txt | 7 ++ doc/ar/libs/WebPlatform/Transition.txt | 7 ++ doc/ar/libs/WebPlatform/Video.txt | 7 ++ doc/ar/libs/WebPlatform/VideoSource.txt | 5 + doc/ar/libs/WebPlatform/VideoTrack.txt | 7 ++ doc/ar/libs/WebPlatform/WhiteSpace.txt | 7 ++ doc/ar/libs/WebPlatform/Widget.txt | 21 ++++ doc/ar/libs/WebPlatform/Window.txt | 31 ++++++ doc/ar/libs/WebPlatform/WordBreak.txt | 7 ++ doc/ar/libs/WebPlatform/direct_mapping.json | 76 ++++++++++++++ doc/ar/libs/WebPlatform/style.txt | 82 ++++++++++++++++ doc/ar/modifiers.txt | 20 ---- doc/ar/srdref.txt | 20 ---- doc/ar/translator_mapping.json | 98 +++++++++++++++++++ 83 files changed, 879 insertions(+), 44 deletions(-) create mode 100644 doc/ar/libs/WebPlatform/Align.txt create mode 100644 doc/ar/libs/WebPlatform/Animation.txt create mode 100644 doc/ar/libs/WebPlatform/AudioResource.txt create mode 100644 doc/ar/libs/WebPlatform/Background.txt create mode 100644 doc/ar/libs/WebPlatform/BackgroundPosition.txt create mode 100644 doc/ar/libs/WebPlatform/BackgroundSize.txt create mode 100644 doc/ar/libs/WebPlatform/BasicWidget.txt create mode 100644 doc/ar/libs/WebPlatform/BorderStyle.txt create mode 100644 doc/ar/libs/WebPlatform/Box.txt create mode 100644 doc/ar/libs/WebPlatform/BoxShadow.txt create mode 100644 doc/ar/libs/WebPlatform/Browser.txt create mode 100644 doc/ar/libs/WebPlatform/Button.txt create mode 100644 doc/ar/libs/WebPlatform/Canvas.txt create mode 100644 doc/ar/libs/WebPlatform/CanvasResource.txt create mode 100644 doc/ar/libs/WebPlatform/Color.txt create mode 100644 doc/ar/libs/WebPlatform/Component.txt create mode 100644 doc/ar/libs/WebPlatform/Cursor.txt create mode 100644 doc/ar/libs/WebPlatform/Dimensions.txt create mode 100644 doc/ar/libs/WebPlatform/Direction.txt create mode 100644 doc/ar/libs/WebPlatform/Display.txt create mode 100644 doc/ar/libs/WebPlatform/DocView.txt create mode 100644 doc/ar/libs/WebPlatform/DomEventSignal.txt create mode 100644 doc/ar/libs/WebPlatform/Drawing.txt create mode 100644 doc/ar/libs/WebPlatform/Errors.txt create mode 100644 doc/ar/libs/WebPlatform/Flex.txt create mode 100644 doc/ar/libs/WebPlatform/Floating.txt create mode 100644 doc/ar/libs/WebPlatform/FontWeight.txt create mode 100644 doc/ar/libs/WebPlatform/Hyperlink.txt create mode 100644 doc/ar/libs/WebPlatform/Image.txt create mode 100644 doc/ar/libs/WebPlatform/ImageResource.txt create mode 100644 doc/ar/libs/WebPlatform/ImageSource.txt create mode 100644 doc/ar/libs/WebPlatform/Input.txt create mode 100644 doc/ar/libs/WebPlatform/Justify.txt create mode 100644 doc/ar/libs/WebPlatform/Layout.txt create mode 100644 doc/ar/libs/WebPlatform/Length.txt create mode 100644 doc/ar/libs/WebPlatform/Length4.txt create mode 100644 doc/ar/libs/WebPlatform/MouseButtonPayload.txt create mode 100644 doc/ar/libs/WebPlatform/MouseMovePayload.txt create mode 100644 doc/ar/libs/WebPlatform/Overflow.txt create mode 100644 doc/ar/libs/WebPlatform/Picture.txt create mode 100644 doc/ar/libs/WebPlatform/Position.txt create mode 100644 doc/ar/libs/WebPlatform/Rectangle.txt create mode 100644 doc/ar/libs/WebPlatform/RegExp.txt create mode 100644 doc/ar/libs/WebPlatform/RoutePayload.txt create mode 100644 doc/ar/libs/WebPlatform/Router.txt create mode 100644 doc/ar/libs/WebPlatform/RoutingStack.txt create mode 100644 doc/ar/libs/WebPlatform/RoutingSwitcher.txt create mode 100644 doc/ar/libs/WebPlatform/SafeRequest.txt create mode 100644 doc/ar/libs/WebPlatform/SafeTimeout.txt create mode 100644 doc/ar/libs/WebPlatform/SafeTimer.txt create mode 100644 doc/ar/libs/WebPlatform/ScalingAlgorithm.txt create mode 100644 doc/ar/libs/WebPlatform/Select.txt create mode 100644 doc/ar/libs/WebPlatform/ServerSession.txt create mode 100644 doc/ar/libs/WebPlatform/Signal.txt create mode 100644 doc/ar/libs/WebPlatform/Stack.txt create mode 100644 doc/ar/libs/WebPlatform/StaticRoute.txt create mode 100644 doc/ar/libs/WebPlatform/Storage.txt create mode 100644 doc/ar/libs/WebPlatform/StyleSet.txt create mode 100644 doc/ar/libs/WebPlatform/Switcher.txt create mode 100644 doc/ar/libs/WebPlatform/SwitcherTransition.txt create mode 100644 doc/ar/libs/WebPlatform/Text.txt create mode 100644 doc/ar/libs/WebPlatform/TextAlign.txt create mode 100644 doc/ar/libs/WebPlatform/TextDecoration.txt create mode 100644 doc/ar/libs/WebPlatform/TextDecorationStyle.txt create mode 100644 doc/ar/libs/WebPlatform/TextInput.txt create mode 100644 doc/ar/libs/WebPlatform/TextOverflow.txt create mode 100644 doc/ar/libs/WebPlatform/TextShadow.txt create mode 100644 doc/ar/libs/WebPlatform/TouchPayload.txt create mode 100644 doc/ar/libs/WebPlatform/Transform.txt create mode 100644 doc/ar/libs/WebPlatform/Transition.txt create mode 100644 doc/ar/libs/WebPlatform/Video.txt create mode 100644 doc/ar/libs/WebPlatform/VideoSource.txt create mode 100644 doc/ar/libs/WebPlatform/VideoTrack.txt create mode 100644 doc/ar/libs/WebPlatform/WhiteSpace.txt create mode 100644 doc/ar/libs/WebPlatform/Widget.txt create mode 100644 doc/ar/libs/WebPlatform/Window.txt create mode 100644 doc/ar/libs/WebPlatform/WordBreak.txt create mode 100644 doc/ar/libs/WebPlatform/direct_mapping.json create mode 100644 doc/ar/libs/WebPlatform/style.txt delete mode 100644 doc/ar/modifiers.txt delete mode 100644 doc/ar/srdref.txt create mode 100644 doc/ar/translator_mapping.json diff --git a/doc/ar/direct_mapping.json b/doc/ar/direct_mapping.json index 3aff935..eef6aed 100644 --- a/doc/ar/direct_mapping.json +++ b/doc/ar/direct_mapping.json @@ -8,9 +8,9 @@ "ArchWord": "طـبيعي_متكيف", "and": "و", "or": "أو", - "/n": "/ج", - "/r": "/ر", - "/t": "/ت", + "\\n": "\\ج", + "\\r": "\\ر", + "\\t": "\\ت", "continue": "أكمل", "break": "اقطع", "import": "اشمل", @@ -61,6 +61,7 @@ "own": "تملك", "release": "حرر", "isNull": "أهو_عدم", + "SrdRef": "سـندنا", "WkRef": "سـندهم", "Console": "طـرفية", "getChar": "أدخل_محرفا", @@ -68,5 +69,17 @@ "print": "اطبع", "getInt": "أدخل_صحيح", "getFloat": "أدخل_عائم", - "getString": "أدخل_محارف" + "getString": "أدخل_محارف", + "Apm": "مـحا", + "Build": "بـناء", + "importFile": "اشمل_ملف", + "Alusus/WebPlatform": "مـنصة_ويب.أسس", + "Alusus/Http": "بـننف.أسس", + "Alusus/Json": "جـيسون.أسس", + "use": "استخدم", + "Srl": "مـتم", + "Srl/Console": "مـتم/طـرفية", + "Srl/Array": "مـتم/مـصفوفة", + "closure": "مغلفة", + "this": "هذا" } \ No newline at end of file diff --git a/doc/ar/libs/WebPlatform/Align.txt b/doc/ar/libs/WebPlatform/Align.txt new file mode 100644 index 0000000..b7ab024 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Align.txt @@ -0,0 +1,7 @@ +عرف مـحاذاة: لقب Align؛ +@دمج صنف مـحاذاة { + عرف _بداية_: لقب START؛ + عرف _وسط_: لقب CENTER؛ + عرف _نهاية_: لقب END؛ + عرف _تمدد_: لقب STRETCH؛ +} diff --git a/doc/ar/libs/WebPlatform/Animation.txt b/doc/ar/libs/WebPlatform/Animation.txt new file mode 100644 index 0000000..9e69987 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Animation.txt @@ -0,0 +1,4 @@ +عرف تـحريك: لقب Animation؛ +@دمج صنف تـحريك { + عرف حدد: لقب set؛ +} diff --git a/doc/ar/libs/WebPlatform/AudioResource.txt b/doc/ar/libs/WebPlatform/AudioResource.txt new file mode 100644 index 0000000..ca47679 --- /dev/null +++ b/doc/ar/libs/WebPlatform/AudioResource.txt @@ -0,0 +1,11 @@ +عرف مـورد_صوت: لقب AudioResource؛ +@دمج صنف مـورد_صوت { + عرف معرف: لقب id؛ + عرف حمل: لقب load؛ + عرف شغل: لقب play؛ + عرف أوقف: لقب stop؛ + عرف ألبث: لقب pause؛ + عرف استأنف: لقب resume؛ + عرف الجهارة: لقب volume؛ + عرف أمشتغل: لقب isPlaying؛ +} diff --git a/doc/ar/libs/WebPlatform/Background.txt b/doc/ar/libs/WebPlatform/Background.txt new file mode 100644 index 0000000..8c8085f --- /dev/null +++ b/doc/ar/libs/WebPlatform/Background.txt @@ -0,0 +1,4 @@ +عرف خـلفية: لقب Background؛ +@دمج صنف خـلفية { + عرف حول_لنص: لقب toString؛ +} diff --git a/doc/ar/libs/WebPlatform/BackgroundPosition.txt b/doc/ar/libs/WebPlatform/BackgroundPosition.txt new file mode 100644 index 0000000..7ccc07e --- /dev/null +++ b/doc/ar/libs/WebPlatform/BackgroundPosition.txt @@ -0,0 +1,8 @@ +عرف مـوقع_خلفية: لقب BackgroundPosition؛ +@دمج صنف مـوقع_خلفية { + عرف _مركز_: لقب CENTER؛ + عرف _يمين_: لقب RIGHT؛ + عرف _يسار_: لقب LEFT؛ + عرف _فوق_: لقب TOP؛ + عرف _تحت_: لقب BOTTOM؛ +} diff --git a/doc/ar/libs/WebPlatform/BackgroundSize.txt b/doc/ar/libs/WebPlatform/BackgroundSize.txt new file mode 100644 index 0000000..1551ac0 --- /dev/null +++ b/doc/ar/libs/WebPlatform/BackgroundSize.txt @@ -0,0 +1,5 @@ +عرف حـجم_خلفية: لقب BackgroundSize؛ +@دمج صنف حـجم_خلفية { + عرف _احتواء_: لقب CONTAIN؛ + عرف _تغطية_: لقب COVER؛ +} diff --git a/doc/ar/libs/WebPlatform/BasicWidget.txt b/doc/ar/libs/WebPlatform/BasicWidget.txt new file mode 100644 index 0000000..cbd209f --- /dev/null +++ b/doc/ar/libs/WebPlatform/BasicWidget.txt @@ -0,0 +1,4 @@ +عرف ودجـة_أساسية: لقب BasicWidget؛ +@دمج صنف ودجـة_أساسية { + عرب_خصلة[التلميح، _التلميح، hint, Hint]؛ +} diff --git a/doc/ar/libs/WebPlatform/BorderStyle.txt b/doc/ar/libs/WebPlatform/BorderStyle.txt new file mode 100644 index 0000000..ca90c56 --- /dev/null +++ b/doc/ar/libs/WebPlatform/BorderStyle.txt @@ -0,0 +1,11 @@ +عرف طـراز_إطار: لقب BorderStyle؛ +@دمج صنف طـراز_إطار { + عرف _منقط_: لقب DOTTED؛ + عرف _مقطع_: لقب DASHED؛ + عرف _مستمر_: لقب SOLID؛ + عرف _مزدوج_: لقب DOUBLE؛ + عرف _أخدود_: لقب GROOVE؛ + عرف _حافة_: لقب RIDGE؛ + عرف _بلا_: لقب NONE؛ + عرف _مخفي_: لقب HIDDEN؛ +} diff --git a/doc/ar/libs/WebPlatform/Box.txt b/doc/ar/libs/WebPlatform/Box.txt new file mode 100644 index 0000000..7799999 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Box.txt @@ -0,0 +1,10 @@ +عرف صـندوق : لقب Box؛ +@دمج صنف صـندوق { + عرف فروع: لقب children؛ + عرف أضف_فروع: لقب addChildren؛ + عرف أضف_فروعا: لقب addChildren؛ + عرف احشر_فرعا: لقب insertChild؛ + عرف أزل_فروع: لقب removeChildren؛ + عرف أزل_فروعا: لقب removeChildren؛ + عرف أزل_كل_الفروع: لقب removeAllChildren؛ +} diff --git a/doc/ar/libs/WebPlatform/BoxShadow.txt b/doc/ar/libs/WebPlatform/BoxShadow.txt new file mode 100644 index 0000000..386b473 --- /dev/null +++ b/doc/ar/libs/WebPlatform/BoxShadow.txt @@ -0,0 +1,4 @@ +عرف ظـل_صندوق: لقب BoxShadow؛ +@دمج صنف ظـل_صندوق { + عرف حول_لنص: لقب toString؛ +} diff --git a/doc/ar/libs/WebPlatform/Browser.txt b/doc/ar/libs/WebPlatform/Browser.txt new file mode 100644 index 0000000..5562b95 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Browser.txt @@ -0,0 +1,5 @@ +عرف مـتصفح: لقب Browser؛ +@دمج صنف مـتصفح { + عرب_خصلة[الرابط، _الرابط، url، Url]؛ + عرف أرسل_رسالة: لقب postMessage؛ +} diff --git a/doc/ar/libs/WebPlatform/Button.txt b/doc/ar/libs/WebPlatform/Button.txt new file mode 100644 index 0000000..81660d1 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Button.txt @@ -0,0 +1,4 @@ +عرف الـزر: لقب Button؛ +@دمج صنف الـزر { + عرب_خصلة[النص، _النص، text، Text]؛ +} diff --git a/doc/ar/libs/WebPlatform/Canvas.txt b/doc/ar/libs/WebPlatform/Canvas.txt new file mode 100644 index 0000000..35482bf --- /dev/null +++ b/doc/ar/libs/WebPlatform/Canvas.txt @@ -0,0 +1,7 @@ +عرف مـرسم: لقب Canvas؛ +@دمج صنف مـرسم { + عرف رسم: لقب drawing؛ + عرف معرف_مورد: لقب resourceId؛ + عرب_خصلة[عرض_الصورة، _عرض_الصورة، bitmapWidth، BitmapWidth]؛ + عرب_خصلة[طول_الصورة، _طول_الصورة، bitmapHeight، BitmapHeight]؛ +} diff --git a/doc/ar/libs/WebPlatform/CanvasResource.txt b/doc/ar/libs/WebPlatform/CanvasResource.txt new file mode 100644 index 0000000..a6ee239 --- /dev/null +++ b/doc/ar/libs/WebPlatform/CanvasResource.txt @@ -0,0 +1,6 @@ +عرف مـورد_مرسم: لقب CanvasResource؛ +@دمج صنف مـورد_مرسم { + عرف معرف: لقب id؛ + عرف هيئ: لقب init؛ + عرف غير_الأبعاد: لقب resize؛ +} diff --git a/doc/ar/libs/WebPlatform/Color.txt b/doc/ar/libs/WebPlatform/Color.txt new file mode 100644 index 0000000..acc1acd --- /dev/null +++ b/doc/ar/libs/WebPlatform/Color.txt @@ -0,0 +1,8 @@ +عرف لـون: لقب Color؛ +@دمج صنف لـون { + عرف أحمر: لقب red؛ + عرف أخضر: لقب green؛ + عرف أزرق: لقب blue؛ + عرف شفافية: لقب alpha؛ + عرف حول_لنص: لقب toString؛ +} diff --git a/doc/ar/libs/WebPlatform/Component.txt b/doc/ar/libs/WebPlatform/Component.txt new file mode 100644 index 0000000..a5b24dd --- /dev/null +++ b/doc/ar/libs/WebPlatform/Component.txt @@ -0,0 +1,8 @@ +عرف مـركب: لقب Component؛ +@دمج صنف مـركب { + عرف المشهد: لقب view؛ + عرف استبق_البناء: لقب beforeBuild؛ + عرف تذيل_البناء: لقب afterBuild؛ + عرف استبق_الإزالة: لقب beforeUnbuild؛ + عرف تذيل_الإزالة: لقب afterUnbuild؛ +} diff --git a/doc/ar/libs/WebPlatform/Cursor.txt b/doc/ar/libs/WebPlatform/Cursor.txt new file mode 100644 index 0000000..87391ee --- /dev/null +++ b/doc/ar/libs/WebPlatform/Cursor.txt @@ -0,0 +1,21 @@ +عرف مـؤشر: لقب Cursor؛ +@دمج صنف مـؤشر { + عرف _تلقائي_: لقب AUTO؛ + عرف _مبدئي_: لقب DEFAULT؛ + عرف _مساعدة_: لقب HELP؛ + عرف _سبابة_: لقب POINTER؛ + عرف _تقدم_: لقب PROGRESS؛ + عرف _انتظار_: لقب WAIT؛ + عرف _تقاطع_: لقب CROSSHAIR؛ + عرف _كتابة_: لقب TEXT؛ + عرف _تحريك_: لقب MOVE؛ + عرف _ممنوع_: لقب NOT_ALLOWED؛ + عرف _إمساك_: لقب GRAB؛ + عرف _ممسك_: لقب GRABBING؛ + عرف _تحجيم_أفقي_: لقب EW_RESIZE؛ + عرف _تحجيم_عمودي_: لقب NS_RESIZE؛ + عرف _تحجيم_مائل_: لقب NESW_RESIZE؛ + عرف _تحجيم_مائل_معكوس_: لقب NWSE_RESIZE؛ + عرف _تكبير_: لقب ZOOM_IN؛ + عرف _تصغير_: لقب ZOOM_OUT؛ +} diff --git a/doc/ar/libs/WebPlatform/Dimensions.txt b/doc/ar/libs/WebPlatform/Dimensions.txt new file mode 100644 index 0000000..b94285c --- /dev/null +++ b/doc/ar/libs/WebPlatform/Dimensions.txt @@ -0,0 +1,5 @@ +عرف أبـعاد: لقب Dimensions؛ +@دمج صنف أبـعاد { + عرف عرض: لقب width؛ + عرف طول: لقب height؛ +} diff --git a/doc/ar/libs/WebPlatform/Direction.txt b/doc/ar/libs/WebPlatform/Direction.txt new file mode 100644 index 0000000..a2b2243 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Direction.txt @@ -0,0 +1,5 @@ +عرف اتـجاه: لقب Direction؛ +@دمج صنف اتـجاه { + عرف _من_اليسار_: لقب LTR؛ + عرف _من_اليمين_: لقب RTL؛ +} diff --git a/doc/ar/libs/WebPlatform/Display.txt b/doc/ar/libs/WebPlatform/Display.txt new file mode 100644 index 0000000..e824e73 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Display.txt @@ -0,0 +1,9 @@ +عرف إظـهار: لقب Display؛ +@دمج صنف إظـهار { + عرف _ضمني_: لقب INLINE؛ + عرف _كتلة_ضمنية_: لقب INLINE_BLOCK؛ + عرف _كتلة_: لقب BLOCK؛ + عرف _مرن_: لقب FLEX؛ + عرف _شبكة_: لقب GRID؛ + عرف _مخفي_: لقب NONE؛ +} diff --git a/doc/ar/libs/WebPlatform/DocView.txt b/doc/ar/libs/WebPlatform/DocView.txt new file mode 100644 index 0000000..839b4a1 --- /dev/null +++ b/doc/ar/libs/WebPlatform/DocView.txt @@ -0,0 +1,5 @@ +عرف مـشهد_وثيقة: لقب DocView؛ +@دمج صنف مـشهد_وثيقة { + عرف حدد_لتنف: لقب setHtml؛ + عرف حدد_ماركداون: لقب setMarkdown؛ +} diff --git a/doc/ar/libs/WebPlatform/DomEventSignal.txt b/doc/ar/libs/WebPlatform/DomEventSignal.txt new file mode 100644 index 0000000..55cfef8 --- /dev/null +++ b/doc/ar/libs/WebPlatform/DomEventSignal.txt @@ -0,0 +1,4 @@ +عرف إشـارة_حدث_دوم: لقب DomEventSignal؛ +@دمج صنف إشـارة_حدث_دوم { + عرف المبدئي_مكبوح: لقب defaultPrevented؛ +} diff --git a/doc/ar/libs/WebPlatform/Drawing.txt b/doc/ar/libs/WebPlatform/Drawing.txt new file mode 100644 index 0000000..672fb61 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Drawing.txt @@ -0,0 +1,16 @@ +عرف رسـم: لقب Drawing؛ +@دمج صنف رسـم { + عرف ارسم_خطا: لقب drawLine؛ + عرف ارسم_مضلعا: لقب drawPolygon؛ + عرف ارسم_مستطيلا_مليئا: لقب drawFilledRect؛ + عرف فرغ_مستطيلا: لقب clearRect؛ + عرف ارسم_دائرة: لقب drawCircle؛ + عرف ارسم_كتابة: لقب drawText؛ + عرف قس_أبعاد_كتابة: لقب measureText؛ + عرف حدد_الاتجاه: لقب setDirection؛ + عرف حدد_نمط_الملء: لقب setFillStyle؛ + عرف حدد_نمط_القلم: لقب setStrokeStyle؛ + عرف حدد_عرض_القلم: لقب setLineWidth؛ + عرف ارسم_صورة: لقب drawImage؛ + عرف فرغ: لقب clear؛ +} diff --git a/doc/ar/libs/WebPlatform/Errors.txt b/doc/ar/libs/WebPlatform/Errors.txt new file mode 100644 index 0000000..3f3f4ee --- /dev/null +++ b/doc/ar/libs/WebPlatform/Errors.txt @@ -0,0 +1,7 @@ +عرف أخـطاء: لقب Errors؛ +@دمج وحدة أخـطاء { + عرف _تحميل_صوت_: لقب AUDIO_LOAD؛ + عرف _تحميل_صورة_: لقب IMAGE_LOAD؛ + عرف _تحميل_خط_: لقب FONT_LOAD؛ + عرف _تحميل_بريمج_جافاسكريبت_: لقب JS_SCRIPT_LOAD؛ +} diff --git a/doc/ar/libs/WebPlatform/Flex.txt b/doc/ar/libs/WebPlatform/Flex.txt new file mode 100644 index 0000000..bec939c --- /dev/null +++ b/doc/ar/libs/WebPlatform/Flex.txt @@ -0,0 +1,4 @@ +عرف مـرونة: لقب Flex؛ +@دمج صنف مـرونة { + عرف حول_لنص: لقب toString؛ +} diff --git a/doc/ar/libs/WebPlatform/Floating.txt b/doc/ar/libs/WebPlatform/Floating.txt new file mode 100644 index 0000000..8792599 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Floating.txt @@ -0,0 +1,6 @@ +عرف طـوفان: لقب Floating؛ +@دمج صنف طـوفان { + عرف _بلا_: لقب NONE؛ + عرف _يسار_: لقب LEFT؛ + عرف _يمين_: لقب RIGHT؛ +} diff --git a/doc/ar/libs/WebPlatform/FontWeight.txt b/doc/ar/libs/WebPlatform/FontWeight.txt new file mode 100644 index 0000000..51a2aaa --- /dev/null +++ b/doc/ar/libs/WebPlatform/FontWeight.txt @@ -0,0 +1,5 @@ +FontWeight سـمك_خط +عرف سـمك_خط: { + عرف _عادي_: لقب FontWeight.NORMAL؛ + عرف _سميك_: لقب FontWeight.BOLD؛ +} diff --git a/doc/ar/libs/WebPlatform/Hyperlink.txt b/doc/ar/libs/WebPlatform/Hyperlink.txt new file mode 100644 index 0000000..b3ff4fc --- /dev/null +++ b/doc/ar/libs/WebPlatform/Hyperlink.txt @@ -0,0 +1,7 @@ +عرف ارتـباط_تشعبي: لقب Hyperlink؛ +@دمج صنف ارتـباط_تشعبي { + عرف فرع: لقب child؛ + عرف حدد_الفرع: لقب setChild؛ + عرب_خصلة[العنوان، _العنوان، url، Url]؛ + عرب_خصلة[لسان_جديد، _لسان_جديد، newTab، NewTab]؛ +} diff --git a/doc/ar/libs/WebPlatform/Image.txt b/doc/ar/libs/WebPlatform/Image.txt new file mode 100644 index 0000000..3d4aaff --- /dev/null +++ b/doc/ar/libs/WebPlatform/Image.txt @@ -0,0 +1,4 @@ +عرف صـورة: لقب Image؛ +@دمج صنف صـورة { + عرب_خصلة[الرابط، _الرابط، url، Url]؛ +} diff --git a/doc/ar/libs/WebPlatform/ImageResource.txt b/doc/ar/libs/WebPlatform/ImageResource.txt new file mode 100644 index 0000000..a0e0f39 --- /dev/null +++ b/doc/ar/libs/WebPlatform/ImageResource.txt @@ -0,0 +1,7 @@ +عرف مـورد_صورة: لقب ImageResource؛ +@دمج صنف مـورد_صورة { + عرف معرف: لقب id؛ + عرف حمل: لقب load؛ + عرف هيئ_من_مرسم: لقب initFromCanvas؛ + عرف هات_الأبعاد: لقب getDimensions؛ +} diff --git a/doc/ar/libs/WebPlatform/ImageSource.txt b/doc/ar/libs/WebPlatform/ImageSource.txt new file mode 100644 index 0000000..a3aa675 --- /dev/null +++ b/doc/ar/libs/WebPlatform/ImageSource.txt @@ -0,0 +1,5 @@ +عرف مـصدر_صورة: لقب ImageSource؛ +@دمج صنف مـصدر_صورة { + عرف مصدر: لقب src؛ + عرف العرض_الأعظمي: لقب maxWidth؛ +} diff --git a/doc/ar/libs/WebPlatform/Input.txt b/doc/ar/libs/WebPlatform/Input.txt new file mode 100644 index 0000000..34a53f5 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Input.txt @@ -0,0 +1,10 @@ +عرف مـدخل: لقب Input؛ +@دمج صنف مـدخل { + عرب_خصلة[النص، _النص، text، Text]؛ + عرب_خصلة[صنف_الإدخال، _صنف_الإدخال، inputType، InputType]؛ + عرب_خصلة[قيمة_وصفية، _قيمة_وصفية، placeholder، Placeholder]؛ + عرب_خصلة[معطل، _معطل، disabled، Disabled]؛ + عرف عند_الغيير: لقب onChanged؛ + عرف عند_كبس_مفتاح: لقب onKeyPress؛ + عرف عند_انتهاء_الكبسة: لقب onKeyUp؛ +} diff --git a/doc/ar/libs/WebPlatform/Justify.txt b/doc/ar/libs/WebPlatform/Justify.txt new file mode 100644 index 0000000..98598e7 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Justify.txt @@ -0,0 +1,10 @@ +عرف مـلء_سطر: لقب Justify؛ +@دمج صنف مـلء_سطر { + عرف _بداية_: لقب START؛ + عرف _وسط_: لقب CENTER؛ + عرف _نهاية_: لقب END؛ + عرف _تمدد_: لقب STRETCH؛ + عرف _مسافة_بينية_: لقب SPACE_BETWEEN؛ + عرف _مسافة_محيطية_: لقب SPACE_AROUND؛ + عرف _مسافة_متساوية_: لقب SPACE_EVENLY؛ +} diff --git a/doc/ar/libs/WebPlatform/Layout.txt b/doc/ar/libs/WebPlatform/Layout.txt new file mode 100644 index 0000000..0a15bde --- /dev/null +++ b/doc/ar/libs/WebPlatform/Layout.txt @@ -0,0 +1,7 @@ +عرف نـسق: لقب Layout؛ +@دمج صنف نـسق { + عرف _سطر_: لقب ROW؛ + عرف _سطر_معكوس_: لقب ROW_REVERSE؛ + عرف _عمود_: لقب COLUMN؛ + عرف _عمود_معكوس_: لقب COLUMN_REVERSE؛ +} diff --git a/doc/ar/libs/WebPlatform/Length.txt b/doc/ar/libs/WebPlatform/Length.txt new file mode 100644 index 0000000..3fe76a2 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Length.txt @@ -0,0 +1,16 @@ +عرف مـسافة: لقب Length؛ +@دمج صنف مـسافة { + عرف بكسلات: لقب px؛ + عرف نقاط: لقب pt؛ + عرف مم: لقب mm؛ + عرف عن: لقب vw؛ + عرف طن: لقب vh؛ + عرف بنص: لقب vmin؛ + عرف بنك: لقب vmax؛ + عرف حخ: لقب em؛ + عرف مئوي: لقب percent؛ + عرف تلقائي: لقب auto؛ + عرف موروث: لقب inherit؛ + + عرف حول_لنص: لقب toString؛ +} diff --git a/doc/ar/libs/WebPlatform/Length4.txt b/doc/ar/libs/WebPlatform/Length4.txt new file mode 100644 index 0000000..8c3f818 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Length4.txt @@ -0,0 +1,16 @@ +عرف مـسافة4: لقب Length4؛ +@دمج صنف مـسافة4 { + عرف بكسلات: لقب px؛ + عرف نقاط: لقب pt؛ + عرف مم: لقب mm؛ + عرف عن: لقب vw؛ + عرف طن: لقب vh؛ + عرف بنص: لقب vmin؛ + عرف بنك: لقب vmax؛ + عرف حخ: لقب em؛ + عرف مئوي: لقب percent؛ + عرف تلقائي: لقب auto؛ + عرف موروث: لقب inherit؛ + + عرف حول_لنص: لقب toString؛ +} diff --git a/doc/ar/libs/WebPlatform/MouseButtonPayload.txt b/doc/ar/libs/WebPlatform/MouseButtonPayload.txt new file mode 100644 index 0000000..0290c8a --- /dev/null +++ b/doc/ar/libs/WebPlatform/MouseButtonPayload.txt @@ -0,0 +1,6 @@ +عرف حـمولة_زر_المؤشر: لقب MouseButtonPayload؛ +@دمج صنف حـمولة_زر_المؤشر { + عرف الزر: لقب button؛ + عرف موقع_س: لقب posX؛ + عرف موقع_ص: لقب posY؛ +} diff --git a/doc/ar/libs/WebPlatform/MouseMovePayload.txt b/doc/ar/libs/WebPlatform/MouseMovePayload.txt new file mode 100644 index 0000000..abf4ce4 --- /dev/null +++ b/doc/ar/libs/WebPlatform/MouseMovePayload.txt @@ -0,0 +1,7 @@ +عرف حـمولة_تحريك_المؤشر: لقب MouseMovePayload؛ +@دمج صنف حـمولة_تحريك_المؤشر { + عرف موقع_س: لقب posX؛ + عرف موقع_ص: لقب posY؛ + عرف إزاحة_س: لقب deltaX؛ + عرف إزاحة_ص: لقب deltaY؛ +} diff --git a/doc/ar/libs/WebPlatform/Overflow.txt b/doc/ar/libs/WebPlatform/Overflow.txt new file mode 100644 index 0000000..36cd366 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Overflow.txt @@ -0,0 +1,8 @@ +عرف فـيض: لقب Overflow؛ +@دمج صنف فـيض { + عرف _ظاهر_: لقب VISIBLE؛ + عرف _مخفي_: لقب HIDDEN؛ + عرف _مقطوع_: لقب CLIP؛ + عرف _تمرير_: لقب SCROLL؛ + عرف _تلقائي_: لقب AUTO؛ +} diff --git a/doc/ar/libs/WebPlatform/Picture.txt b/doc/ar/libs/WebPlatform/Picture.txt new file mode 100644 index 0000000..bb0e8d9 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Picture.txt @@ -0,0 +1,5 @@ +عرف صـورة_متعددة: لقب Picture؛ +@دمج صنف صـورة_متعددة { + عرف مصفوفة_مصدر: لقب sourceArray؛ + عرف حدد_الفرع: لقب setChild؛ +} diff --git a/doc/ar/libs/WebPlatform/Position.txt b/doc/ar/libs/WebPlatform/Position.txt new file mode 100644 index 0000000..80bd833 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Position.txt @@ -0,0 +1,8 @@ +عرف مـوقع: لقب Position؛ +@دمج صنف مـوقع { + عرف _ساكن_: لقب STATIC؛ + عرف _نسبي_: لقب RELATIVE؛ + عرف _مثبت_: لقب FIXED؛ + عرف _مطلق_: لقب ABSOLUTE؛ + عرف _لزج_: لقب STICKY؛ +} diff --git a/doc/ar/libs/WebPlatform/Rectangle.txt b/doc/ar/libs/WebPlatform/Rectangle.txt new file mode 100644 index 0000000..dae4426 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Rectangle.txt @@ -0,0 +1,7 @@ +عرف مـستطيل: لقب Rectangle؛ +@دمج صنف مـستطيل { + عرف س: لقب x؛ + عرف ص: لقب y؛ + عرف عرض: لقب width؛ + عرف طول: لقب height؛ +} diff --git a/doc/ar/libs/WebPlatform/RegExp.txt b/doc/ar/libs/WebPlatform/RegExp.txt new file mode 100644 index 0000000..90dcbf2 --- /dev/null +++ b/doc/ar/libs/WebPlatform/RegExp.txt @@ -0,0 +1,6 @@ +عرف تـعبير_نمطي: لقب RegExp؛ +@دمج صنف تـعبير_نمطي { + عرف هيئ: لقب initialize؛ + عرف حرر: لقب release؛ + عرف طابق: لقب match؛ +} diff --git a/doc/ar/libs/WebPlatform/RoutePayload.txt b/doc/ar/libs/WebPlatform/RoutePayload.txt new file mode 100644 index 0000000..600bdad --- /dev/null +++ b/doc/ar/libs/WebPlatform/RoutePayload.txt @@ -0,0 +1,6 @@ +عرف حـمولة_مسار: لقب RoutePayload؛ +@دمج صنف حـمولة_مسار { + عرف المسار_الكامل: لقب fullPath؛ + عرف المسار: لقب route؛ + عرف المعطيات: لقب params؛ +} diff --git a/doc/ar/libs/WebPlatform/Router.txt b/doc/ar/libs/WebPlatform/Router.txt new file mode 100644 index 0000000..ed35042 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Router.txt @@ -0,0 +1,6 @@ +عرف مـوجه: لقب Router؛ +@دمج صنف مـوجه { + عرف مسار: لقب route؛ + عرف عند_المسار_المجهول: لقب onUnknownRoute؛ + عرف أطلق_التوجيه: لقب triggerRoute؛ +} diff --git a/doc/ar/libs/WebPlatform/RoutingStack.txt b/doc/ar/libs/WebPlatform/RoutingStack.txt new file mode 100644 index 0000000..2af4385 --- /dev/null +++ b/doc/ar/libs/WebPlatform/RoutingStack.txt @@ -0,0 +1,6 @@ +عرف مـكداس_توجيه: لقب RoutingStack؛ +@دمج صنف مـكداس_توجيه { + عرف عند_المسار_المجهول: لقب onUnknownRoute؛ + عرف مسار: لقب route؛ + عرف حدد_الانتقال: لقب setTransition؛ +} diff --git a/doc/ar/libs/WebPlatform/RoutingSwitcher.txt b/doc/ar/libs/WebPlatform/RoutingSwitcher.txt new file mode 100644 index 0000000..634c211 --- /dev/null +++ b/doc/ar/libs/WebPlatform/RoutingSwitcher.txt @@ -0,0 +1,8 @@ +عرف مـبدال_توجيه: لقب RoutingSwitcher؛ +@دمج صنف مـبدال_توجيه { + عرف عند_المسار_المجهول: لقب onUnknownRoute؛ + عرف تسلسل_المسار_الحالي: لقب currentRouteIndex؛ + عرف مسار: لقب route؛ + عرف حدد_الانتقال: لقب setTransition؛ + عرف استنتج_تسلسل_المسار_الحالي: لقب determineCurrentRouteIndex؛ +} diff --git a/doc/ar/libs/WebPlatform/SafeRequest.txt b/doc/ar/libs/WebPlatform/SafeRequest.txt new file mode 100644 index 0000000..2367367 --- /dev/null +++ b/doc/ar/libs/WebPlatform/SafeRequest.txt @@ -0,0 +1,6 @@ +عرف نـداء_آمن: لقب SafeRequest؛ +@دمج صنف نـداء_آمن { + عرف أرسل: لقب send؛ + عرف ألغ: لقب cancel؛ + عرف قيد_الإرسال: لقب inProgress؛ +} diff --git a/doc/ar/libs/WebPlatform/SafeTimeout.txt b/doc/ar/libs/WebPlatform/SafeTimeout.txt new file mode 100644 index 0000000..5385cda --- /dev/null +++ b/doc/ar/libs/WebPlatform/SafeTimeout.txt @@ -0,0 +1,5 @@ +عرف مـؤقت_آمن: لقب SafeTimeout؛ +@دمج صنف مـؤقت_آمن { + عرف ابدأ: لقب set؛ + عرف ألغ: لقب cancel؛ +} diff --git a/doc/ar/libs/WebPlatform/SafeTimer.txt b/doc/ar/libs/WebPlatform/SafeTimer.txt new file mode 100644 index 0000000..4eceaac --- /dev/null +++ b/doc/ar/libs/WebPlatform/SafeTimer.txt @@ -0,0 +1,5 @@ +عرف مـؤقت_متكرر_آمن: لقب SafeTimer؛ +@دمج صنف مـؤقت_متكرر_آمن { + عرف ابدأ: لقب start؛ + عرف أوقف: لقب stop؛ +} diff --git a/doc/ar/libs/WebPlatform/ScalingAlgorithm.txt b/doc/ar/libs/WebPlatform/ScalingAlgorithm.txt new file mode 100644 index 0000000..d958248 --- /dev/null +++ b/doc/ar/libs/WebPlatform/ScalingAlgorithm.txt @@ -0,0 +1,8 @@ +عرف خـوارزمية_تحجيم: لقب ScalingAlgorithm؛ +@دمج صنف خـوارزمية_تحجيم { + عرف _تلقائي_: لقب AUTO؛ + عرف _أملس_: لقب SMOOTH؛ + عرف _جودة_عالية_: لقب HIGH_QUALITY؛ + عرف _مبكسل_: لقب PIXELATED؛ + عرف _حواف_هشة_: لقب CRISP_EDGES؛ +} diff --git a/doc/ar/libs/WebPlatform/Select.txt b/doc/ar/libs/WebPlatform/Select.txt new file mode 100644 index 0000000..03fbaa6 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Select.txt @@ -0,0 +1,7 @@ +عرف خـيارات: لقب Select؛ +@دمج صنف خـيارات { + عرب_خصلة[العناصر، _العناصر، items، Items]؛ + عرف عند_الغيير: لقب onChanged؛ + عرف هات_القيمة_المختارة: لقب getSelectedValue؛ + عرف اختر_قيمة: لقب selectValue؛ +} diff --git a/doc/ar/libs/WebPlatform/ServerSession.txt b/doc/ar/libs/WebPlatform/ServerSession.txt new file mode 100644 index 0000000..9954e61 --- /dev/null +++ b/doc/ar/libs/WebPlatform/ServerSession.txt @@ -0,0 +1,4 @@ +عرف جـلسة_خادم: لقب ServerSession؛ +@دمج صنف جـلسة_خادم { + عرف سياق_بننف: لقب httpContext؛ +} diff --git a/doc/ar/libs/WebPlatform/Signal.txt b/doc/ar/libs/WebPlatform/Signal.txt new file mode 100644 index 0000000..9b60c44 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Signal.txt @@ -0,0 +1,8 @@ +عرف إشـارة: لقب Signal؛ +@دمج صنف إشـارة { + عرف اربط: لقب connect؛ + عرف افصل: لقب disconnect؛ + عرف هات_عدد_الروابط: لقب getConnectionCount؛ + عرف أرسل: لقب emit؛ + عرف عند_تغير_الارتباطات: لقب onConnectionsChanged؛ +} diff --git a/doc/ar/libs/WebPlatform/Stack.txt b/doc/ar/libs/WebPlatform/Stack.txt new file mode 100644 index 0000000..3326a68 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Stack.txt @@ -0,0 +1,6 @@ +عرف مـكداس: لقب Stack؛ +@دمج صنف مـكداس { + عرف حدد_الانتقال: لقب setTransition؛ + عرف أضف: لقب push؛ + عرف أزل: لقب pop؛ +} diff --git a/doc/ar/libs/WebPlatform/StaticRoute.txt b/doc/ar/libs/WebPlatform/StaticRoute.txt new file mode 100644 index 0000000..dbafabf --- /dev/null +++ b/doc/ar/libs/WebPlatform/StaticRoute.txt @@ -0,0 +1,6 @@ +عرف مـسار_سواكن: لقب StaticRoute؛ +@دمج صنف مـسار_سواكن { + عرف مسار_الخادم: لقب uri؛ + عرف مسار_المصدر: لقب srcPath؛ + عرف مسار_البناء: لقب buildPath؛ +} diff --git a/doc/ar/libs/WebPlatform/Storage.txt b/doc/ar/libs/WebPlatform/Storage.txt new file mode 100644 index 0000000..ce7c960 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Storage.txt @@ -0,0 +1,9 @@ +عرف مـخزن: لقب Storage؛ +@دمج صنف مـخزن { + عرف هات_الطول: لقب getLength؛ + عرف هات_مفتاحا: لقب getKey؛ + عرف هات_عنصرا: لقب getItem؛ + عرف حدد_عنصرا: لقب setItem؛ + عرف أزل_عنصرا: لقب removeItem؛ + عرف فرغ: لقب clear؛ +} diff --git a/doc/ar/libs/WebPlatform/StyleSet.txt b/doc/ar/libs/WebPlatform/StyleSet.txt new file mode 100644 index 0000000..17a426a --- /dev/null +++ b/doc/ar/libs/WebPlatform/StyleSet.txt @@ -0,0 +1,24 @@ +عرف طـقم_طرز: لقب StyleSet؛ +عرف مـحدد_حالة: { + عرف _فعال_: لقب StateSelector.ACTIVE؛ + عرف _معلم_: لقب StateSelector.CHECKED؛ + عرف _مبدئي_: لقب StateSelector.DEFAULT؛ + عرف _معطل_: لقب StateSelector.DISABLED؛ + عرف _فارغ_: لقب StateSelector.EMPTY؛ + عرف _ممكن_: لقب StateSelector.ENABLED؛ + عرف _بؤرة_: لقب StateSelector.FOCUS؛ + عرف _ملء_الشاشة_: لقب StateSelector.FULLSCREEN؛ + عرف _حوم_: لقب StateSelector.HOVER؛ + عرف _ضمن_النطاق_: لقب StateSelector.IN_RANGE؛ + عرف _وسطي_: لقب StateSelector.INTERMEDIATE؛ + عرف _باطل_: لقب StateSelector.INVALID؛ + عرف _رابط_: لقب StateSelector.LINK؛ + عرف _اختياري_: لقب StateSelector.OPTIONAL؛ + عرف _خارج_النطاق_: لقب StateSelector.OUT_OF_RANGE؛ + عرف _قراءة_فقط_: لقب StateSelector.READ_ONLY؛ + عرف _قراءة_وكتابة_: لقب StateSelector.READ_WRITE؛ + عرف _إلزامي_: لقب StateSelector.REQUIRED؛ + عرف _مستهدف_: لقب StateSelector.TARGET؛ + عرف _صالح_: لقب StateSelector.VALID؛ + عرف _مزار_: لقب StateSelector.VISITED؛ +} diff --git a/doc/ar/libs/WebPlatform/Switcher.txt b/doc/ar/libs/WebPlatform/Switcher.txt new file mode 100644 index 0000000..ced08d6 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Switcher.txt @@ -0,0 +1,6 @@ +عرف مـبدال: لقب Switcher؛ +@دمج صنف مـبدال { + عرف حدد_الانتقال: لقب setTransition؛ + عرف بدل_إلى: لقب switchTo؛ + عرف أيجب_الاحتفاظ_بالفرع: لقب shouldPreserveChild؛ +} diff --git a/doc/ar/libs/WebPlatform/SwitcherTransition.txt b/doc/ar/libs/WebPlatform/SwitcherTransition.txt new file mode 100644 index 0000000..e0e3fe3 --- /dev/null +++ b/doc/ar/libs/WebPlatform/SwitcherTransition.txt @@ -0,0 +1,6 @@ +عرف انـتقال_مبدال: لقب SwitcherTransition؛ +@دمج صنف انـتقال_مبدال { + عرف طراز_المشهد_الحالي: لقب currentViewStyle؛ + عرف طراز_المشهد_التالي: لقب incomingViewStyle؛ + عرف المدة_الكلية: لقب totalDuration؛ +} diff --git a/doc/ar/libs/WebPlatform/Text.txt b/doc/ar/libs/WebPlatform/Text.txt new file mode 100644 index 0000000..0c53697 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Text.txt @@ -0,0 +1,5 @@ +عرف كـتابة: لقب Text؛ +@دمج صنف كـتابة { + عرب_خصلة[النص، _النص، text، Text]؛ + عرب_خصلة[المعرف_المستهدف، _المعرف_المستهدف، targetId، TargetId]؛ +} diff --git a/doc/ar/libs/WebPlatform/TextAlign.txt b/doc/ar/libs/WebPlatform/TextAlign.txt new file mode 100644 index 0000000..d79e19c --- /dev/null +++ b/doc/ar/libs/WebPlatform/TextAlign.txt @@ -0,0 +1,7 @@ +عرف مـحاذاة_نص: لقب TextAlign؛ +@دمج صنف مـحاذاة_نص { + عرف _يسار_: لقب LEFT؛ + عرف _يمين_: لقب RIGHT؛ + عرف _وسط_: لقب CENTER؛ + عرف _املأ_: لقب JUSTIFY؛ +} diff --git a/doc/ar/libs/WebPlatform/TextDecoration.txt b/doc/ar/libs/WebPlatform/TextDecoration.txt new file mode 100644 index 0000000..2dba457 --- /dev/null +++ b/doc/ar/libs/WebPlatform/TextDecoration.txt @@ -0,0 +1,7 @@ +عرف زخـرفة_نص: لقب TextDecoration؛ +@دمج صنف زخـرفة_نص { + عرف _بلا_: لقب NONE؛ + عرف _تحت_: لقب UNDERLINE؛ + عرف _فوق_: لقب OVERLINE؛ + عرف _خلال_: لقب LINE_THROUGH؛ +} diff --git a/doc/ar/libs/WebPlatform/TextDecorationStyle.txt b/doc/ar/libs/WebPlatform/TextDecorationStyle.txt new file mode 100644 index 0000000..ea96ff4 --- /dev/null +++ b/doc/ar/libs/WebPlatform/TextDecorationStyle.txt @@ -0,0 +1,8 @@ +عرف طـراز_زخرفة_نص: لقب TextDecorationStyle؛ +@دمج صنف طـراز_زخرفة_نص { + عرف _مستمر_: لقب SOLID؛ + عرف _مزدوج_: لقب DOUBLE؛ + عرف _منقط_: لقب DOTTED؛ + عرف _مقطع_: لقب DASHED؛ + عرف _متموج_: لقب WAVY؛ +} diff --git a/doc/ar/libs/WebPlatform/TextInput.txt b/doc/ar/libs/WebPlatform/TextInput.txt new file mode 100644 index 0000000..2687e65 --- /dev/null +++ b/doc/ar/libs/WebPlatform/TextInput.txt @@ -0,0 +1,8 @@ +عرف مـدخل_نص: لقب TextInput؛ +@دمج صنف مـدخل_نص { + عرب_خصلة[النص، _النص، text، Text]؛ + عرب_خصلة[قيمة_وصفية، _قيمة_وصفية، placeholder، Placeholder]؛ + عرف عند_الغيير: لقب onChanged؛ + عرف عند_كبس_مفتاح: لقب onKeyPress؛ + عرف عند_انتهاء_الكبسة: لقب onKeyUp؛ +} diff --git a/doc/ar/libs/WebPlatform/TextOverflow.txt b/doc/ar/libs/WebPlatform/TextOverflow.txt new file mode 100644 index 0000000..e2d1fe7 --- /dev/null +++ b/doc/ar/libs/WebPlatform/TextOverflow.txt @@ -0,0 +1,5 @@ +عرف فـيض_كتابة: لقب TextOverflow؛ +@دمج صنف فـيض_كتابة { + عرف _قطع_: لقب CLIP؛ + عرف _نقط_: لقب ELLIPSIS؛ +} diff --git a/doc/ar/libs/WebPlatform/TextShadow.txt b/doc/ar/libs/WebPlatform/TextShadow.txt new file mode 100644 index 0000000..2df3640 --- /dev/null +++ b/doc/ar/libs/WebPlatform/TextShadow.txt @@ -0,0 +1,4 @@ +عرف ظـل_نص: لقب TextShadow؛ +@دمج صنف ظـل_نص { + عرف حول_لنص: لقب toString؛ +} diff --git a/doc/ar/libs/WebPlatform/TouchPayload.txt b/doc/ar/libs/WebPlatform/TouchPayload.txt new file mode 100644 index 0000000..063647e --- /dev/null +++ b/doc/ar/libs/WebPlatform/TouchPayload.txt @@ -0,0 +1,15 @@ +عرف حـمولة_لمس: لقب TouchPayload؛ +@دمج صنف حـمولة_لمس { + عرف المعرف: لقب identifier؛ + عرف شاشة_س: لقب screenX؛ + عرف شاشة_ص: لقب screenY؛ + عرف مشهد_س: لقب clientX؛ + عرف مشهد_ص: لقب clientY؛ + عرف وثيقة_س: لقب pageX؛ + عرف وثيقة_ص: لقب pageY؛ + عرف نق_س: لقب radiusX؛ + عرف نق_ص: لقب radiusY؛ + عرف الزاوية: لقب rotationAngle؛ + عرف القوة: لقب force؛ + عرف مغيرة: لقب changed؛ +} diff --git a/doc/ar/libs/WebPlatform/Transform.txt b/doc/ar/libs/WebPlatform/Transform.txt new file mode 100644 index 0000000..67c4d5d --- /dev/null +++ b/doc/ar/libs/WebPlatform/Transform.txt @@ -0,0 +1,7 @@ +عرف تـحول: لقب Transform؛ +@دمج وحدة تـحول { + عرف ماتركس: لقب matrix؛ + عرف دور: لقب rotate؛ + عرف حجم: لقب scale؛ + عرف أزح: لقب translate؛ +} diff --git a/doc/ar/libs/WebPlatform/Transition.txt b/doc/ar/libs/WebPlatform/Transition.txt new file mode 100644 index 0000000..5f1ee5f --- /dev/null +++ b/doc/ar/libs/WebPlatform/Transition.txt @@ -0,0 +1,7 @@ +عرف انـتقال: لقب Transition؛ +@دمج صنف انـتقال { + عرف المدة: لقب duration؛ + عرف الدالة: لقب fn؛ + عرف التأخير: لقب delay؛ + عرف حول_لنص: لقب toString؛ +} diff --git a/doc/ar/libs/WebPlatform/Video.txt b/doc/ar/libs/WebPlatform/Video.txt new file mode 100644 index 0000000..cc8759a --- /dev/null +++ b/doc/ar/libs/WebPlatform/Video.txt @@ -0,0 +1,7 @@ +عرف فـيديو: لقب Video؛ +@دمج صنف فـيديو { + عرف مصفوفة_مصدر: لقب sourceArray؛ + عرف مصفوفة_المسارات: لقب trackArray؛ + عرف التحكمات: لقب controls؛ + عرف تشغيل_تلقائي: لقب autoplay؛ +} diff --git a/doc/ar/libs/WebPlatform/VideoSource.txt b/doc/ar/libs/WebPlatform/VideoSource.txt new file mode 100644 index 0000000..85dffa0 --- /dev/null +++ b/doc/ar/libs/WebPlatform/VideoSource.txt @@ -0,0 +1,5 @@ +عرف مـصدر_فيديو: لقب VideoSource؛ +@دمج صنف مـصدر_فيديو { + عرف مصدر: لقب src؛ + عرف نوع_الفيديو: لقب videoType؛ +} diff --git a/doc/ar/libs/WebPlatform/VideoTrack.txt b/doc/ar/libs/WebPlatform/VideoTrack.txt new file mode 100644 index 0000000..c3b8762 --- /dev/null +++ b/doc/ar/libs/WebPlatform/VideoTrack.txt @@ -0,0 +1,7 @@ +عرف مـسار_فيديو: لقب VideoTrack؛ +@دمج صنف مـسار_فيديو { + عرف مصدر: لقب src؛ + عرف نوع_الفيديو: لقب kind؛ + عرف لغة_المصدر: لقب srclang؛ + عرف النص_الظاهر: لقب label؛ +} diff --git a/doc/ar/libs/WebPlatform/WhiteSpace.txt b/doc/ar/libs/WebPlatform/WhiteSpace.txt new file mode 100644 index 0000000..034a2e7 --- /dev/null +++ b/doc/ar/libs/WebPlatform/WhiteSpace.txt @@ -0,0 +1,7 @@ +عرف مـحرف_مسافة: لقب WhiteSpace؛ +@دمج صنف مـحرف_مسافة { + عرف _عادي_: لقب NORMAL؛ + عرف _حرفي_: لقب PRE؛ + عرف _حرفي_لف_: لقب PRE_WRAP؛ + عرف _حرفي_سطر_: لقب PRE_LINE؛ +} diff --git a/doc/ar/libs/WebPlatform/Widget.txt b/doc/ar/libs/WebPlatform/Widget.txt new file mode 100644 index 0000000..e376ed2 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Widget.txt @@ -0,0 +1,21 @@ +عرف ودجـة: لقب Widget؛ +@دمج صنف ودجـة { + عرف الطراز: لقب style؛ + عرف معرف: لقب id؛ + عرب_خصلة[اسم_الفئة، _اسم_الفئة، className, ClassName]؛ + عرف عند_تغير_الأبعاد: لقب onResize؛ + عرف عند_دخول_المؤشر: لقب onMouseEnter؛ + عرف عند_خروج_المؤشر: لقب onMouseOut؛ + عرف عند_بدء_النقرة: لقب onMouseDown؛ + عرف عند_انتهاء_النقرة: لقب onMouseUp؛ + عرف عند_تحريك_المؤشر: لقب onMouseMove؛ + عرف عند_بدء_اللمس: لقب onTouchStart؛ + عرف عند_انتهاء_اللمس: لقب onTouchEnd؛ + عرف عند_تحريك_اللمس: لقب onTouchMove؛ + عرف عند_الضغط: لقب onClick؛ + عرف هات_الأبعاد: لقب getDimensions؛ + عرف هات_المستطيل_المحيط: لقب getBoundingRect؛ + عرف التمس_احتكار_المؤشر: لقب requestPointerLock؛ + عرف التمس_ملء_الشاشة: لقب requestFullScreen؛ + عرف مرر_إلى_المرأى: لقب scrollIntoView؛ +} diff --git a/doc/ar/libs/WebPlatform/Window.txt b/doc/ar/libs/WebPlatform/Window.txt new file mode 100644 index 0000000..51ec766 --- /dev/null +++ b/doc/ar/libs/WebPlatform/Window.txt @@ -0,0 +1,31 @@ +عرف نـافذة: لقب Window؛ +@دمج صنف نـافذة { + عرف النموذج: لقب instance؛ + عرف الطراز: لقب style؛ + عرف مخزن_الجلسة: لقب sessionStorage؛ + عرف المخزن_المحلي: لقب localStorage؛ + عرف حدد_المشهد: لقب setView؛ + عرف أزل_المشهد: لقب unsetView؛ + عرف الموقع: لقب location؛ + عرف بروتوكول_الموقع: لقب locationProtocol؛ + عرف خادم_الموقع: لقب locationHost؛ + عرف مسار_الموقع: لقب locationPath؛ + عرف استعلام_الموقع: لقب locationQuery؛ + عرف وسم_الموقع: لقب locationHash؛ + عرف هات_متغير_استعلام: لقب getQueryParam؛ + عرف ادفع_مسارا: لقب pushLocation؛ + عرف مرئية: لقب visible؛ + عرف حجم: لقب resize؛ + عرف المفاتيح_المكبوتة: لقب keysToSwallow؛ + عرف عند_بدء_الكبسة: لقب onKeyDown؛ + عرف عند_انتهاء_الكبسة: لقب onKeyUp؛ + عرف عند_تغير_احتكار_المؤشر: لقب onPointerLockChange؛ + عرف عند_تغير_ملء_الشاشة: لقب onFullScreenChange؛ + عرف عند_ربط_مقبض: لقب onGamepadConnected؛ + عرف عند_فصل_مقبض: لقب onGamepadDisconnected؛ + عرف عند_تغير_المسار: لقب onLocationChanged؛ + عرف عند_تغير_المرئية: لقب onVisibilityChanged؛ + عرف عند_استلام_رسالة: لقب onMessage؛ + عرف أرسل_رسالة: لقب postMessage؛ + عرف ارسل_رسالة_للمالك: لقب postMessageToParent؛ +} diff --git a/doc/ar/libs/WebPlatform/WordBreak.txt b/doc/ar/libs/WebPlatform/WordBreak.txt new file mode 100644 index 0000000..0dcd7e2 --- /dev/null +++ b/doc/ar/libs/WebPlatform/WordBreak.txt @@ -0,0 +1,7 @@ +عرف تـقطيع_كلمات: لقب WordBreak؛ +@دمج صنف تـقطيع_كلمات { + عرف _عادي_: لقب NORMAL؛ + عرف _قطع_الكل_: لقب BREAK_ALL؛ + عرف _احتفظ_بالكل_: لقب KEEP_ALL؛ + عرف _قطع_الكلمات_: لقب BREAK_WORD؛ +} diff --git a/doc/ar/libs/WebPlatform/direct_mapping.json b/doc/ar/libs/WebPlatform/direct_mapping.json new file mode 100644 index 0000000..a0c89c3 --- /dev/null +++ b/doc/ar/libs/WebPlatform/direct_mapping.json @@ -0,0 +1,76 @@ +{ + "WebPlatform": "مـنصة_ويب", + "webPlatformPath": "مسار_منصة_ويب", + "getBuildDependencies": "هات_اعتماديات_البناء", + "createElement": "أنشئ_عنصر", + "setElementAttribute": "حدد_ميزة_عنصر", + "getElementAttribute": "هات_ميزة_عنصر", + "removeElementAttribute": "أزل_ميزة_عنصر", + "setStyleRule": "حدد_متن_طراز", + "runEventLoop": "نفذ_حلقة_معالجة_الأحداث", + "dispatchEvents": "عالج_الأحداث", + "waitForEvent": "انتظر_حدثا", + "await": "انتظر", + "startServer": "ابدأ_الخادم", + "stopServer": "أوقف_الخادم", + "runServer": "شغل_الخادم", + "buildAndStartServer": "ابن_وابدأ_الخادم", + "buildAndRunServer": "ابن_وشغل_الخادم", + "getAssetsRoutesFromModules": "هات_مسارات_الموارد_لوحدات", + "buildUiEndpoints": "ابن_المنافذ_المرئية", + "startTimer": "ابدأ_المؤقت_المتكرر", + "stopTimer": "أوقف_المؤقت_المتكرر", + "setTimeout": "ابدأ_المؤقت", + "cancelTimeout": "ألغ_المؤقت", + "sendRequest": "أرسل_نداء", + "cancelRequest": "ألغ_نداء", + "loadFont": "حمل_خط", + "loadJsScript": "حمل_بريمج_جافاسكريبت", + "callCustomJsFn": "استدع_دالة_جافاسكريبت", + "callCustomAsyncJsFn": "استدع_دالة_جافاسكريبت_لامتزامنة", + "getUserLanguages": "هات_لغات_المستخدم", + "getPreferredLanguage": "هات_اللغة_المفضلة", + "isDarkColorSchemePreferred": "هل_يفضل_نمط_الألوان_الداكن", + "isAppUpdateAvailable": "أيوجد_تحديث_للتطبيق", + "updateApp": "حدث_التطبيق", + "getAppDisplayMode": "هات_نمط_عرض_التطبيق", + "isAppInstallPromptAvailable": "أتوجد_واجهة_تنصيب_للتطبيق", + "showAppInstallPrompt": "اعرض_واجهة_تنصيب_التطبيق", + "getTimestamp": "هات_الختم_الزمني", + "getDate": "هات_التاريخ", + "exitPointerLock": "ألغ_احتكار_المؤشر", + "exitFullScreen": "ألغ_ملء_الشاشة", + "requestWakeLock": "التمس_يقظة_الشاشة", + "exitWakeLock": "ألغ_يقظة_الشاشة", + "getGamepadsCount": "هات_عدد_المقابض", + "getGamepadId": "هات_رمز_المقبض", + "getGamepadAxesCount": "هات_عدد_محاور_المقبض", + "getGamepadButtonsCount": "هات_عدد_أزرار_المقبض", + "getGamepadAxis": "هات_قيمة_محور_المقبض", + "getGamepadButton": "هات_قيمة_زر_المقبض", + "httpRedirect": "أعد_التوجيه", + "logToConsole": "اكتب_في_الطرفية", + "matchRegex": "طابق_نمطا", + "suspendAudioContext": "علق_سياق_الصوت", + "resumeAudioContext": "استأنف_سياق_الصوت", + "createSlideSwitcherTransition": "أنشئ_انتقال_انزلاق_مبدال", + "createFadeSwitcherTransition": "أنشئ_انتقال_تلاشي_مبدال", + "createSlideStackTransition": "أنشئ_انتقال_انزلاق_مكداس", + "createFadeStackTransition": "أنشئ_انتقال_تلاشي_مكداس", + "createFadeWithScaleStackTransition": "أنشئ_انتقال_تلاشي_مع_تحجيم_مكداس", + "@uiEndpoint": "@منفذ_مرئي", + "@title": "@عنوان", + "onClick": "عند_الضغط", + "Http.Connection": "بـننف.اتـصال", + "@beEndpoint": "@منفذ_بياني", + "Http.read": "بـننف.اقرأ", + "Http.print": "بـننف.اطبع", + "onFetch": "عند_استلام_بيانات", + "textShow": "عرض_النص", + "Json": "جـيسون", + "sendRequest": "أرسل_نداء", + "@injection": "@حقنة", + "Component": "مـركب", + "this_type": "هذا_الصنف", + "onNewEntry": "قد_تم_الإدخال" +} \ No newline at end of file diff --git a/doc/ar/libs/WebPlatform/style.txt b/doc/ar/libs/WebPlatform/style.txt new file mode 100644 index 0000000..fb7befc --- /dev/null +++ b/doc/ar/libs/WebPlatform/style.txt @@ -0,0 +1,82 @@ +عرف طـراز: لقب style؛ +@دمج صنف طـراز { + عرف حدد_طرازا_خاما: لقب setRawStyle؛ + عرف طراز_الإطار: لقب borderStyle؛ + عرف طراز_الآوتلاين: لقب outlineStyle؛ + عرف الطوفان: لقب floating؛ + عرف الموقع: لقب position؛ + عرف النسق: لقب layout؛ + عرف ملء_السطر: لقب justify؛ + عرف المحاذاة: لقب align؛ + عرف محاذاة_النص: لقب textAlign؛ + عرف زخرفة_النص: لقب textDecoration؛ + عرف طراز_زخرفة_النص: لقب textDecorationStyle؛ + عرف الاتجاه: لقب direction؛ + عرف فئة_الخط: لقب fontFamily؛ + عرف الفيض_س: لقب overflowX؛ + عرف الفيض_ص: لقب overflowY؛ + عرف الفيض: لقب overflow؛ + عرف فيض_الكتابة: لقب textOverflow؛ + عرف الإظهار: لقب display؛ + عرف المؤشر: لقب cursor؛ + عرف التحريك: لقب animation؛ + عرف تقطيع_الكلمات: لقب wordBreak؛ + عرف محرف_المسافة: لقب whiteSpace؛ + تمهيد { + استخدم الـقلب.أسـاسيات؛ + استخدم الـقلب.بـيانات؛ + عرف تعريفات: سند[كـائن_بهوية](شبم { + العرض: width؛ + الطول: height؛ + أدنى_عرض: minWidth؛ + أدنى_طول: minHeight؛ + أقصى_عرض: maxWidth؛ + أقصى_طول: maxHeight؛ + سمك_الإطار: borderWidth؛ + لون_الإطار: borderColor؛ + نصف_قطر_الإطار: borderRadius؛ + سمك_الآوتلاين: outlineWidth؛ + إزاحة_الآوتلاين: outlineOffset؛ + لون_الآوتلاين: outlineColor؛ + تسلسل_العمق: zIndex؛ + المرونة: flex؛ + الهامش: margin؛ + لون_زخرفة_النص: textDecorationColor؛ + سمك_زخرفة_النص: textDecorationThickness؛ + الحشوة: padding؛ + حجم_الخط: fontSize؛ + لون_الخط: fontColor؛ + سمك_الخط: fontWeight؛ + تباعد_الحروف: letterSpacing؛ + ارتفاع_الكتابة: lineHeight؛ + الشفافية: opacity؛ + التحول: transform؛ + ظل_الصندوق: boxShadow؛ + ظل_النص: textShadow؛ + فوق: top؛ + يسار: left؛ + يمين: right؛ + تحت: bottom؛ + الخلفية: background؛ + خوارزمية_التحجيم: scalingAlgorithm؛ + })؛ + عرف حاوية: حـاوية[تعريفات]؛ + عرف ع: طـبيعي؛ + لكل ع = 0، ع < حاوية.هات_عدد_العناصر()، ++ع { + عرف تعريف: حـاوية_تطبيقية[حاوية.هات_عنصرا(ع)]؛ + عرف الاسم_العربي: سند[نـص](تعريف.هات_عنصرا("first")~مثل[سند[شـبم.مـعرف]].القيمة.القيمة)؛ + عرف الاسم_الإنجليزي: سند[نـص](تعريف.هات_عنصرا("second")~مثل[سند[شـبم.مـعرف]].القيمة.القيمة)؛ + نـبم.مدير_شبم.احشر_شبم( + شبم { + عرف اسم_عربي: لقب اسم_إنجليزي؛ + عرف اسم_الإنتقال_عربي: لقب اسم_الإنتقال_إنجليزي؛ + }، + تـطبيق[نـص، سند[كـائن_بهوية]]() + .حدد(نـص("اسم_عربي")، نـص_بهوية(الاسم_العربي)) + .حدد(نـص("اسم_إنجليزي")، شـبم.مـعرف(الاسم_الإنجليزي)) + .حدد(نـص("اسم_الإنتقال_عربي")، نـص_بهوية(نـص("انتقال_") + الاسم_العربي)) + .حدد(نـص("اسم_الإنتقال_إنجليزي")، شـبم.مـعرف(الاسم_الإنجليزي + "Transition")) + )؛ + } + }؛ +} diff --git a/doc/ar/modifiers.txt b/doc/ar/modifiers.txt deleted file mode 100644 index e8cd1df..0000000 --- a/doc/ar/modifiers.txt +++ /dev/null @@ -1,20 +0,0 @@ -يمكن وسم عناصر الشفرة المصدرية بمبدلات تستخدم لاحقا في مجالات مختلفة. المبدل يمكن أن يغير طريقة ترجمة وتنفيذ الشفرة الموسومة ويمكن أن لا يفعل سوى إضافة بيانات وصفية. المبدل له النسق التالي: -ar version: -``` -@<كلمة_تعريفية> <تعريف_العنصر_المراد_وسمه> -@<كلمة_تعريفية>[<معطيات>] <تعريف_العنصر_المراد_وسمه> -``` -en version: -``` -@ -@[] -``` -يعتمد المترجم على مبدلات معرفة مسبقا لإضافة خواص معينة على التعريفات المختلفة كما هو موضح في مواضع عدة من هذه الوثيقة. وبإمكان المستخدم إضافة مبدلات خاصة وقراءتها لاحقا باستخدام `نـبم.مدير_شبم` (`Spp.astMgr`). -ar version: -``` -@مبدلي["معطى1"، "معطى2"] دالة دالتي { ... }؛ -``` -en version: -``` -@mymodifier["arg1", "arg2"] func myFunc { ... }; -``` diff --git a/doc/ar/srdref.txt b/doc/ar/srdref.txt deleted file mode 100644 index e739d2d..0000000 --- a/doc/ar/srdref.txt +++ /dev/null @@ -1,20 +0,0 @@ -سـندنا (SrdRef) -قالب سند مشترك يتولى تلقائيا تحرير الكائن عندما تنتهي الحاجة له. يحتفظ هذا السند بعداد لعدد السندات المشتركة التي تشير لنفس الكائن. كلما يُتلف أحد السندات يُنقص العداد وعندما يصل العداد لصفر يُتلف الكائن وتحرر ذاكرته. -ar version: -``` -دالة رئيسي { - عرف س: سـندنا[صـنفي] = سـندنا[صـنفي].أنشئ()؛ - عرف ص: سـندنا[صـنفي] = س؛ // الآن كلا السندين يشيران لنفس الكائن وعداده الآن 2. - س.حرر()؛ // العداد صار 1 لكن الكائن لم يُحرر بعد. - ص.حرر()؛ // الآن أتلف الكائن وحررت ذاكرته. -} -``` -en version: -``` -func main { - def x: SrdRef[MyType] = SrdRef[MyType].construct(); - def y: SrdRef[MyType] = x; // Both refs point to same object. Counter is now 2. - x.release(); // Counter is now 1 and the object is not freed yet. - y.release(); // Now the object is destructed and its memory is released. -} -``` diff --git a/doc/ar/translator_mapping.json b/doc/ar/translator_mapping.json new file mode 100644 index 0000000..e6ce372 --- /dev/null +++ b/doc/ar/translator_mapping.json @@ -0,0 +1,98 @@ +[ + { + "name": "pointers", + "filename": "ptr.txt", + "regex": false, + "patterns": ["ptr", "~cnt"] + }, + { + "name": "if", + "filename": "if.txt", + "regex": false, + "patterns": ["if"] + }, + { + "name": "loop", + "filename": "loops.txt", + "regex": false, + "patterns": ["for", "while"] + }, + { + "name": "function", + "filename": "function.txt", + "regex": false, + "patterns": ["function", "func"] + }, + { + "name": "class", + "filename": "class.txt", + "regex": false, + "patterns": ["class"] + }, + { + "name": "reference", + "filename": "reference.txt", + "regex": false, + "patterns": ["ref"] + }, + { + "name": "array", + "filename": "array.txt", + "regex": false, + "patterns": ["array"] + }, + { + "name": "array_template", + "filename": "array_template.txt", + "regex": false, + "patterns": ["Array"] + }, + { + "name": "string", + "filename": "string.txt", + "regex": false, + "patterns": ["String"] + }, + { + "name": "map", + "filename": "map.txt", + "regex": false, + "patterns": ["Map"] + }, + { + "name": "constructor", + "filename": "init.txt", + "regex": false, + "patterns": ["init"] + }, + { + "name": "destructor", + "filename": "terminate.txt", + "regex": false, + "patterns": ["terminate"] + }, + { + "name": "methods", + "filename": "methods.txt", + "regex": false, + "patterns": ["@member", "handler"] + }, + { + "name": "definitions", + "filename": "def.txt", + "regex": false, + "patterns": ["def"] + }, + { + "name": "alias", + "filename": "alias.txt", + "regex": false, + "patterns": ["alias"] + }, + { + "name": "cast", + "filename": "cast.txt", + "regex": false, + "patterns": ["cast"] + } +] From ef817690929d039dc80a4d323c52572520e2e853 Mon Sep 17 00:00:00 2001 From: KaisHasan Date: Sat, 21 Jun 2025 09:17:53 +0300 Subject: [PATCH 5/7] implement translator workflow --- copilot_server/agents.py | 160 ++++++++++++++++++++++++++++++++++++++- copilot_server/app.py | 16 +++- 2 files changed, 172 insertions(+), 4 deletions(-) diff --git a/copilot_server/agents.py b/copilot_server/agents.py index 21d8265..bdeae70 100644 --- a/copilot_server/agents.py +++ b/copilot_server/agents.py @@ -238,7 +238,6 @@ def __clean_and_extract_code(self, llm_output): return code - class KeywordDocsRetriever: def __init__(self, alusus_features_mapper_path: str, docs_root_dir: str): self.alusus_features_mapper_path = alusus_features_mapper_path @@ -347,3 +346,162 @@ def __clean_and_extract_code(self, llm_output): code = "Cannot answer this question" return code + + +class Translator: + def __init__(self, llm: LLM, ar_docs_dir: str, debug=False): + self.llm = llm + self.debug = debug + self.ar_docs_dir = ar_docs_dir + + with open(os.path.join(self.ar_docs_dir, "translator_mapping.json"), encoding='utf-8') as f: + self.translator_mapping = json.load(f) + + self.direct_mapping = dict() + with open(os.path.join(self.ar_docs_dir, "direct_mapping.json"), encoding='utf-8') as f: + self.direct_mapping["basic"] = json.load(f) + + # libraries + self.features_names = dict() + self.libs_dir = os.path.join(self.ar_docs_dir, "libs") + for lib in os.listdir(self.libs_dir): + lib_path = os.path.join(self.libs_dir, lib) + lib_dict_path = os.path.join(lib_path, "direct_mapping.json") + + self.features_names[lib] = [ + os.path.splitext(feature)[0] + for feature in os.listdir(lib_path) + if feature != 'direct_mapping.json' + ] + + with open(lib_dict_path, encoding='utf-8') as f: + self.direct_mapping[lib] = json.load(f) + + + def __call__(self, code, lang, used_libs=None): + if lang == 'en': + return code + + docs = self.__get_docs(code, used_libs) + + # The number 3 is determined by experiments + # More complex experiments might need more iterations + for _ in range(3): + + prompt = self.__generate_prompt(code, docs) + + messages=[ + {"role": "user", "content": prompt}, + ] + + response = self.llm(messages) + + if self.debug: + write_logs([ + "############Translator_START\n" + f"Raw output:\n{response}\n" + "############Translator_END\n" + ]) + + code = self.__clean_and_extract_code(response) + + return code + + def __get_docs(self, code, used_libs): + # TODO: all loops in this function should be parallelized before pushing to production + docs = [] + + # Extract related basic docs + for feature in self.translator_mapping: + if self.__is_feature_used(code, feature): + doc_path = os.path.join(self.ar_docs_dir, feature["filename"]) + with open(doc_path, encoding='utf-8') as f: + doc = f.read() + docs.append(f"doc about '{feature['name']}':\n{doc}") + + syntax_dictionary = [] + for en_keyword, ar_keyword in self.direct_mapping["basic"].items(): + if code.find(en_keyword) != -1: + syntax_dictionary.append(f"'{en_keyword}': '{ar_keyword}'") + + inline_direct_mappings = "\n".join(syntax_dictionary) + docs.append(f"Keyword mapping dictionary:\n{inline_direct_mappings}") + + # Extract related libraries docs + if used_libs is not None: + for lib in used_libs: + lib_path = os.path.join(self.libs_dir, lib) + + for feature in self.features_names[lib]: + if code.find(feature) != -1: + doc_path = os.path.join(lib_path, f"{feature}.txt") + with open(doc_path, encoding='utf-8') as f: + doc = f.read() + docs.append(f"doc about '{feature}':\n{doc}") + + syntax_dictionary = [] + for en_keyword, ar_keyword in self.direct_mapping[lib].items(): + if code.find(en_keyword) != -1: + syntax_dictionary.append(f"'{en_keyword}': '{ar_keyword}'") + + inline_direct_mappings = "\n".join(syntax_dictionary) + docs.append(f"{lib} library dictionary:\n{inline_direct_mappings}") + + return docs + + def __is_feature_used(self, code, feature): + if feature["regex"]: + for pattern in feature["patterns"]: + m = re.search(pattern, code, re.DOTALL | re.MULTILINE) + if m is not None: + return True + else: + for pattern in feature["patterns"]: + if code.find(pattern) != -1: + return True + return False + + def __generate_prompt(self, code, docs): + inline_docs = "\n******\n".join(docs) + prompt = ( + "Alusus is a programming language with syntax in English and Arabic.\n" + "Your task will be to translate from the English syntax to the Arabic syntax\n" + "Please follow this rules:\n" + "1. Variables names and user-defined functions names should always be translated and must be consistent.\n" + "2. Language reserved keywords and built-in functions should be translated only if present in the docs," + "otherwise, leave them as they are.\n" + "3. You should only translate, do not change the approach or the code structure.\n" + "4. comments and print strings literals should be translated and written in Arabic.\n" + "5. Check your work twice before providing the final answer.\n" + "6. Make sure to match anything in the docs with the code and translate it, sometimes there" + "will be hierarchical structure so make sure to account for that.\n" + "7. To translate effectively, move through the code line by line, and translate according to the docs.\n" + "Documents:\n" + f"{inline_docs}\n" + "Code:\n" + "```" + f"{code}" + "```" + "Please think about what you should translate between tags.\n" + "Please put the full code after translation between tags.\n" + ) + return prompt + + def __clean_and_extract_code(self, llm_output): + """Remove section and extract the code""" + # Remove the section if it exists + cleaned_output = re.sub(r".*?", "", llm_output, flags=re.DOTALL).strip() + + write_logs([ + f"cleaned_output:\n{cleaned_output}\n----------\n" + ]) + + # Extract the code from tags + match = re.search(r"(.*?)", cleaned_output, re.DOTALL) + if match: + code = match.group(1) + else: + # Default response if tags are not found + code = "Something wrong has happened!" + + return code diff --git a/copilot_server/app.py b/copilot_server/app.py index a371909..e32c1c4 100644 --- a/copilot_server/app.py +++ b/copilot_server/app.py @@ -7,6 +7,7 @@ from copilot_server.agents import DocsExpert, MainAgent, AlususExpert from copilot_server.agents import KeywordDocsRetriever, BasicExamplesRetriever from copilot_server.LLMs import OpenAILLM, DeepSeekLLM +from copilot_server.agents import Translator app = Flask(__name__) @@ -26,6 +27,7 @@ HF_API_KEY = os.getenv("HF_TOKEN") MODEL_TAG = os.getenv("MODEL_TAG") BASE_MODEL_TAG = os.getenv("BASE_MODEL_TAG") +AR_DOCS_DIR = os.getenv("AR_DOCS_DIR") alusus_gpt4 = OpenAILLM(OPENAI_API_KEY, MODEL_TAG) @@ -38,7 +40,7 @@ main_agent = MainAgent(llm=o3_mini, debug=DEBUG) keyword_docs_retriever = KeywordDocsRetriever(ALUSUS_FEATURES_MAPPER_PATH, DOCS_ROOT_DIR) alusus_expert = AlususExpert(llm=o3_mini, debug=DEBUG) - +translator = Translator(o3_mini, ar_docs_dir=AR_DOCS_DIR, debug=DEBUG) def format_response(code): @@ -56,6 +58,7 @@ def format_response(code): def handle_basic(): data = request.json query = data.get('query') + lang = data.get('lang') engine = BasicEngine(OPENAI_API_KEY, MODEL_TAG, BASE_MODEL_TAG, DOCS_ROOT_DIR, BASIC_INDEX_PATH) @@ -75,13 +78,17 @@ def handle_basic(): syntax_docs = keyword_docs_retriever.get_docs(code) refined_code = alusus_expert(code, syntax_docs) - return jsonify({"response": format_response(refined_code)}) + # translate code + translated_code = translator(refined_code, lang) + + return jsonify({"response": format_response(translated_code)}) @app.route('/web_platform', methods=['POST']) def handle_web_platform(): data = request.json query = data.get('query') + lang = data.get('lang') engine = WebPlatformEngine(OPENAI_API_KEY, MODEL_TAG, WEBPLATFORM_INDEX_PATH, RAG_INDEX_PATH) @@ -97,7 +104,10 @@ def handle_web_platform(): syntax_docs = keyword_docs_retriever.get_docs(code) refined_code = alusus_expert(code, syntax_docs) - return jsonify({"response": format_response(refined_code)}) + # translate code + translated_code = translator(refined_code, lang, used_libs=['WebPlatform']) + + return jsonify({"response": format_response(translated_code)}) if __name__ == '__main__': From 26d3aa14a3b6de25dabb7c012165fd10ef1d76de Mon Sep 17 00:00:00 2001 From: KaisHasan Date: Tue, 1 Jul 2025 13:29:49 +0300 Subject: [PATCH 6/7] implement the translation feature in C --- c_api/include/Translator.h | 15 + c_api/include/WebPlatformEngine.h | 4 +- c_api/include/common.h | 8 + c_api/src/BasicEngine.c | 14 +- c_api/src/Translator.c | 483 ++++++++++++++++++++++++++++++ c_api/src/WebPlatformEngine.c | 14 +- c_api/src/main.c | 36 ++- c_api/src/utils.c | 1 + 8 files changed, 558 insertions(+), 17 deletions(-) create mode 100644 c_api/include/Translator.h create mode 100644 c_api/src/Translator.c diff --git a/c_api/include/Translator.h b/c_api/include/Translator.h new file mode 100644 index 0000000..daa5c2e --- /dev/null +++ b/c_api/include/Translator.h @@ -0,0 +1,15 @@ +#ifndef TRANSLATOR_H +#define TRANSLATOR_H + +#include +#include "common.h" + +// Function declarations +const char* prompt_translator( + const char *code, + const char *lang, + const char *ar_docs_dir, + const char *api_key, + JSON *used_libs); + +#endif // TRANSLATOR_H diff --git a/c_api/include/WebPlatformEngine.h b/c_api/include/WebPlatformEngine.h index 1cb1b4d..57c72f0 100644 --- a/c_api/include/WebPlatformEngine.h +++ b/c_api/include/WebPlatformEngine.h @@ -5,8 +5,8 @@ void webplatform_free_resources(); char* webplatform_run( - const char *api_key, const char *question, - const char *docs_index_path, const char *rag_index_path, + const char *api_key, const char *question, const char *lang, + const char *docs_index_path, const char *rag_index_path, const char *ar_docs_dir, const char *model_tag, const char *model_path, const char *alusus_features_mapper_path, const char *docs_root_dir); diff --git a/c_api/include/common.h b/c_api/include/common.h index e2daf47..b71370e 100644 --- a/c_api/include/common.h +++ b/c_api/include/common.h @@ -31,6 +31,14 @@ typedef struct { char basic_vdb_path[MAX_LINE_LENGTH]; char basic_index_path[MAX_LINE_LENGTH]; char alusus_features_mapper_path[MAX_LINE_LENGTH]; + char ar_docs_dir[MAX_LINE_LENGTH]; } Config; +// constants +#define PATH_MAX 2048 +static const char *library_names[] = { + "WebPlatform" +}; +static const int num_libraries = sizeof(library_names) / sizeof(library_names[0]); + #endif // COMMON_H diff --git a/c_api/src/BasicEngine.c b/c_api/src/BasicEngine.c index e570ab3..eeffd58 100644 --- a/c_api/src/BasicEngine.c +++ b/c_api/src/BasicEngine.c @@ -3,6 +3,7 @@ #include "MainAgent.h" #include "AlususExpert.h" #include "KeywordDocsRetriever.h" +#include "Translator.h" #include "common.h" #include "utils.h" #include @@ -57,7 +58,7 @@ static float* get_embedding(const char *question, const char *model_path) { if (model == NULL) { printf("%s: unable to load model\n", __func__); - return 1; + return NULL; } else { printf("model loaded successfuly!\n"); @@ -222,8 +223,8 @@ static JSON* get_examples(idx_t *indices, int k, const char *examples_index_path } char* basic_run( - const char *api_key, const char *question, - const char* docs_root_dir, const char *docs_index_path, + const char *api_key, const char *question, const char *lang, + const char* docs_root_dir, const char *docs_index_path, const char *ar_docs_dir, const char *base_model_tag, const char *model_tag, const char *vdb_path, const char *index_path, const char *alusus_features_mapper_path, const char *embedding_model_path) { @@ -303,7 +304,12 @@ char* basic_run( const char *final_answer = prompt_alusus_expert(initial_code, keyword_docs, api_key); printf("\nPrompting Alusus Expert is done successfully\n"); - char *formatted_response = format_final_response(final_answer); + // translate the code + printf("\nPrompting Alusus Translator ...\n"); + const char *translated_code = prompt_translator(final_answer, lang, ar_docs_dir, api_key, NULL); + printf("\nPrompting Alusus Translator is done successfully\n"); + + char *formatted_response = format_final_response(translated_code); //printf("formatted_response:\n%s\n", formatted_response); return formatted_response; } diff --git a/c_api/src/Translator.c b/c_api/src/Translator.c new file mode 100644 index 0000000..b9d13e4 --- /dev/null +++ b/c_api/src/Translator.c @@ -0,0 +1,483 @@ +#include "Translator.h" +#include "common.h" +#include "utils.h" +#include +#include +#include +#include +#include + +#ifdef _WIN32 + #include +#else + #include + #include +#endif + + +#define OVECCOUNT 30 // Must be a multiple of 3 + +// Remove section and extract code between ... +static char* clean_and_extract_code(const char *llm_output) { + // Step 1: Remove sections + char *cleaned_output = remove_think_section(llm_output); + if (!cleaned_output) + return "Cannot answer this question"; + trim_whitespace(cleaned_output); + + // Regular expression to capture text between and + const char *pattern = "(.*?)"; + const char *error; + int erroffset; + + // Compile the pattern with PCRE_DOTALL to allow matching newline characters. + pcre *re = pcre_compile(pattern, PCRE_DOTALL, &error, &erroffset, NULL); + if (!re) { + fprintf(stderr, "PCRE compilation failed at offset %d: %s\n", erroffset, error); + return NULL; + } + + int ovector[OVECCOUNT]; + int subject_length = (int)strlen(cleaned_output); + int rc = pcre_exec(re, NULL, cleaned_output, subject_length, 0, 0, ovector, OVECCOUNT); + + char *code_str = NULL; + if (rc >= 2) { + // Group 1 (the captured content) indices + int start = ovector[2]; + int end = ovector[3]; + int len = end - start; + code_str = (char*)malloc(len + 1); + if (code_str) { + for (int i = start ; i < end ; ++i) { + code_str[i-start] = cleaned_output[i]; + } + // memcpy(code_str, cleaned_output + start, len); + code_str[len] = '\0'; + } + } + + pcre_free(re); + return code_str; +} + +static char* generate_prompt(const char *code, const JSON *docs) { + const char *separator = "\n******\n"; + size_t sep_len = strlen(separator); + size_t num_docs = JSON_A_LEN(docs); + size_t inline_docs_len = 0; + + // Compute total length for joined documents. + for (int i = 0; i < num_docs; i++) { + const char *doc = JSON2STR(JSON_AT_IDX(docs, i)); + inline_docs_len += strlen(doc); + if (i < num_docs - 1) { + inline_docs_len += sep_len; + } + } + + // Allocate memory for the joined docs. +1 for the null-terminator. + char *inline_docs = malloc(inline_docs_len + 1); + if (!inline_docs) { + return NULL; + } + inline_docs[0] = '\0'; // Start with an empty string + + // Concatenate all docs with the separator. + for (int i = 0; i < num_docs; i++) { + const char *doc = JSON2STR(JSON_AT_IDX(docs, i)); + strcat(inline_docs, doc); + if (i < num_docs - 1) { + strcat(inline_docs, separator); + } + } + size_t prompt_size = strlen(inline_docs) + strlen(code) + 4096; + char *prompt = (char*)malloc(prompt_size); + if (!prompt) { + free(inline_docs); + return NULL; + } + + // Format the prompt + printf("\tFilling the prompt...\n"); + snprintf(prompt, prompt_size, + "Alusus is a programming language with syntax in English and Arabic.\n" + "Your task will be to translate from the English syntax to the Arabic syntax\n" + "Please follow this rules:\n" + "1. Variables names and user-defined functions names should always be translated and must be consistent.\n" + "2. Language reserved keywords and built-in functions should be translated only if present in the docs," + "otherwise, leave them as they are.\n" + "3. You should only translate, do not change the approach or the code structure.\n" + "4. comments and print strings literals should be translated and written in Arabic.\n" + "5. Check your work twice before providing the final answer.\n" + "6. Make sure to match anything in the docs with the code and translate it, sometimes there" + "will be hierarchical structure so make sure to account for that.\n" + "7. To translate effectively, move through the code line by line, and translate according to the docs.\n" + "Documents:\n%s\n" + "Code:\n" + "```%s```\n" + "Please think about what you should translate between tags.\n" + "Please put the full code after translation between tags.\n", + inline_docs, code); + + printf("\tCleaning up...\n"); + free(inline_docs); + return prompt; +} + +static JSON* list_dir(const char *path) { + JSON *files_names = json_object_new_array(); + + #ifdef _WIN32 + char search_path[MAX_PATH]; + snprintf(search_path, sizeof(search_path), "%s\\*", path); + + WIN32_FIND_DATAA fd; + HANDLE hFind = FindFirstFileA(search_path, &fd); + + if (hFind == INVALID_HANDLE_VALUE) { + fprintf(stderr, "Failed to open directory: %s\n", path); + return NULL; + } + + do { + if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { + printf("\t\tFound file: %s\n", fd.cFileName); + JSON_A_ADD(files_names, STR2JSON(fd.cFileName)); + } + } while (FindNextFileA(hFind, &fd)); + FindClose(hFind); + #else + DIR *dir = opendir(path); + if (!dir) { + perror("opendir"); + return NULL; + } + + struct dirent *entry; + while ((entry = readdir(dir))) { + if (entry->d_type != DT_DIR) { + printf("\t\tFound file: %s\n", entry->d_name); + JSON_A_ADD(files_names, STR2JSON(entry->d_name)); + } + } + closedir(dir); + #endif + + return files_names; +} + +static JSON* get_mapping_meta_data(const char *ar_docs_dir) +{ + char translator_mapping_path[PATH_MAX]; + snprintf( + translator_mapping_path, + sizeof(translator_mapping_path), + "%s/translator_mapping.json", + ar_docs_dir); + JSON *translator_mapping = read_json_file(translator_mapping_path); + + JSON *direct_mapping = json_object_new_object(); + + char basic_direct_mapping_path[PATH_MAX]; + snprintf( + basic_direct_mapping_path, + sizeof(basic_direct_mapping_path), + "%s/direct_mapping.json", + ar_docs_dir); + JSON_ADD(direct_mapping, "basic", read_json_file(basic_direct_mapping_path)); + + // add libraries meta data + char libs_dir[PATH_MAX]; + snprintf(libs_dir, sizeof(libs_dir), "%s/libs", ar_docs_dir); + + JSON *features_names = json_object_new_object(); + + for (int lib_id = 0 ; lib_id < num_libraries ; lib_id++) { + const char *lib_name = library_names[lib_id]; + printf("\tgettings meta data for library '%s'\n", lib_name); + + // Build full path to this lib folder + char lib_path[PATH_MAX]; + snprintf(lib_path, sizeof(lib_path), "%s/%s", libs_dir, lib_name); + + JSON *lib_features_names = json_object_new_array(); + + printf("\tListing library files\n"); + JSON *files_names = list_dir(lib_path); + printf("\tStoring the features names\n"); + for (int f_id = 0 ; f_id < JSON_A_LEN(files_names) ; f_id++) { + const char *filename = JSON2STR(JSON_AT_IDX(files_names, f_id)); + + // skip our mapping file and hidden files + if (strcmp(filename, "direct_mapping.json") == 0 || + filename[0] == '.') { + continue; + } + + /* strip extension */ + char *dot = strrchr(filename, '.'); + size_t len = dot ? (size_t)(dot - filename) : strlen(filename); + char name_only[256]; + strncpy(name_only, filename, len); + name_only[len] = '\0'; + + JSON_A_ADD(lib_features_names, STR2JSON(name_only)); + } + + printf("\tadding library features to the meta data\n"); + // add to features_names JSON object + JSON_ADD(features_names, + lib_name, + lib_features_names); + + // Load direct_mapping.json for this lib + char mapping_path[PATH_MAX]; + snprintf(mapping_path, sizeof(mapping_path), "%s/direct_mapping.json", lib_path); + + printf("\tadding direct mapping of library '%s'\n", lib_name); + JSON_ADD(direct_mapping, lib_name, read_json_file(mapping_path)); + } + + JSON *meta_data = json_object_new_object(); + JSON_ADD(meta_data, "translator_mapping", translator_mapping); + JSON_ADD(meta_data, "direct_mapping", direct_mapping); + JSON_ADD(meta_data, "features_names", features_names); + + return meta_data; +} + +static int feature_exists(JSON* feature, const char* code) { + JSON* regex; + JSON* patterns; + JSON_REF(feature, "regex", ®ex); + JSON_REF(feature, "patterns", &patterns); + + if (json_object_get_boolean(regex)) { + for (int i = 0; i < JSON_A_LEN(patterns); i++) { + const char* pattern = JSON2STR(JSON_AT_IDX(patterns, i)); + const char* error; + int erroffset; + pcre* re = pcre_compile(pattern, PCRE_DOTALL | PCRE_MULTILINE, &error, &erroffset, NULL); + if (re == NULL) { + continue; + } + int ovector[30]; + int rc = pcre_exec(re, NULL, code, strlen(code), 0, 0, ovector, 30); + pcre_free(re); + if (rc >= 0) { + return 1; + } + } + } else { + for (int i = 0; i < JSON_A_LEN(patterns); i++) { + const char* pattern = JSON2STR(JSON_AT_IDX(patterns, i)); + if (strstr(code, pattern) != NULL) { + return 1; + } + } + } + return 0; +} + +static char* get_direct_mapping_doc(JSON *direct_mapping, const char *code, const char* title) { + JSON *docs = json_object_new_array(); + size_t docs_size = 0; + + printf("\t\tLooping through the keywords...\n"); + json_object_object_foreach(direct_mapping, key, val) { + if (strstr(code, key) != NULL) { + const char *ar_keyword = JSON2STR(val); + size_t doc_size = strlen(key) + strlen(ar_keyword) + 32; + char *doc = (char*)malloc(doc_size); + snprintf( + doc, + doc_size, + "'%s': '%s'", + key, + ar_keyword + ); + printf("\t\t\t%s\n", doc); + + JSON_A_ADD(docs, STR2JSON(doc)); + docs_size += strlen(doc); + + free(doc); + } + } + printf("\t\tEND\n"); + + char *inline_docs = (char*)malloc(docs_size + strlen(title) + 1024); + inline_docs[0] = '\0'; + + strcat(inline_docs, title); + + int num_docs = JSON_A_LEN(docs); + const char *separator = "\n"; + for (int i = 0 ; i < num_docs ; i++) { + const char *doc = JSON2STR(JSON_AT_IDX(docs, i)); + + strcat(inline_docs, separator); + strcat(inline_docs, doc); + } + + printf("\t\tCleaning up...\n"); + json_object_put(docs); + + return inline_docs; +} + +static JSON* get_docs(const char *code, JSON *used_libs, JSON *meta_data, const char *ar_docs_dir) +{ + JSON *docs = json_object_new_array(); + + // Extract related basic docs + JSON *translator_mapping; + JSON_REF(meta_data, "translator_mapping", &translator_mapping); + + printf("\tAdding basic features...\n"); + for (int entry_id = 0 ; entry_id < JSON_A_LEN(translator_mapping) ; entry_id++) { + JSON *entry = JSON_AT_IDX(translator_mapping, entry_id); + if (feature_exists(entry, code)) { + printf("\t\tAdding feature %s...\n", JSON2STR(JSON_AT(entry, "filename"))); + char doc_path[PATH_MAX]; + snprintf( + doc_path, + sizeof(doc_path), + "%s/%s", + ar_docs_dir, + JSON2STR(JSON_AT(entry, "filename"))); + + const char *doc = read_doc_by_path(doc_path); + + size_t doc_size = strlen(doc) + 256; + char *formatted_doc = (char*)malloc(doc_size); + snprintf( + formatted_doc, + doc_size, + "doc about '%s':\n%s", + JSON2STR(JSON_AT(entry, "name")), + doc + ); + + JSON_A_ADD(docs, STR2JSON(formatted_doc)); + + free(formatted_doc); + free(doc); + } + } + + JSON *direct_mapping; + JSON_REF(meta_data, "direct_mapping", &direct_mapping); + JSON *basic_direct_mapping; + JSON_REF(direct_mapping, "basic", &basic_direct_mapping); + + printf("\tAdding basic keyword mapping...\n"); + const char *basic_direct_mapping_doc = get_direct_mapping_doc(basic_direct_mapping, code, "Keyword mapping dictionary:"); + //printf("\t**basic dmap: %s***\n", basic_direct_mapping_doc); + JSON_A_ADD(docs, STR2JSON(basic_direct_mapping_doc)); + + // Extract related libraries docs + if (used_libs == NULL) { + printf("\tNo library used!\n"); + return docs; + } + + JSON *features_names; + JSON_REF(meta_data, "features_names", &features_names); + + for (int lib_idx = 0 ; lib_idx < JSON_A_LEN(used_libs) ; lib_idx++) { + const char *lib_name = JSON2STR(JSON_AT_IDX(used_libs, lib_idx)); + + JSON *lib_features_names; + JSON_REF(features_names, lib_name, &lib_features_names); + + for (int i = 0 ; i < JSON_A_LEN(lib_features_names); i++) { + const char *feature_name = JSON2STR(JSON_AT_IDX(lib_features_names, i)); + if (strstr(code, feature_name) != NULL) { + char doc_path[PATH_MAX]; + snprintf( + doc_path, + sizeof(doc_path), + "%s/libs/%s/%s.txt", + ar_docs_dir, + lib_name, + feature_name); + + const char *doc = read_doc_by_path(doc_path); + + size_t formatted_doc_size = strlen(doc) + 256; + char *formatted_doc = (char*)malloc(formatted_doc_size); + snprintf( + formatted_doc, + formatted_doc_size, + "doc about '%s':\n%s", + feature_name, + doc + ); + + JSON_A_ADD(docs, STR2JSON(formatted_doc)); + + free(formatted_doc); + free(doc); + } + } + + JSON *lib_direct_mapping; + JSON_REF(direct_mapping, lib_name, &lib_direct_mapping); + + char *title[256]; + snprintf(title, sizeof(title), "%s library dictionary:", lib_name); + + const char *lib_direct_mapping_doc = get_direct_mapping_doc(lib_direct_mapping, code, title); + JSON_A_ADD(docs, STR2JSON(lib_direct_mapping_doc)); + } + + return docs; +} + +const char* prompt_translator( + const char *code, + const char *lang, + const char *ar_docs_dir, + const char *api_key, + JSON *used_libs) +{ + // no need for translation + if (strcmp(lang, "en") == 0) { + return code; + } + + printf("Getting meta data...\n"); + JSON *meta_data = get_mapping_meta_data(ar_docs_dir); + printf("Fetching docs...\n"); + JSON *docs = get_docs(code, used_libs, meta_data, ar_docs_dir); + + if (docs == NULL) { + printf("No docs were fetched!\n"); + } + + // Note: this size if chosen heuristically, better use dynamic size + char *code_sketch = (char*)malloc(strlen(code)*4); + strcpy(code_sketch, code); + + for (int i = 0 ; i < 3 ; ++i) { + printf("#%d Refinement\n", i); + printf("Preparing the prompt...\n"); + const char *prompt = generate_prompt(code_sketch, docs); + printf("Asking AI...\n"); + const char *response = send_request(api_key, prompt, "o3-mini"); + printf("Formatting the output...\n"); + const char *clean_response = clean_and_extract_code(response); + + // refine the code sketch + strcpy(code_sketch, clean_response); + + // clean up + free(prompt); + free(response); + free(clean_response); + } + + return code_sketch; +} diff --git a/c_api/src/WebPlatformEngine.c b/c_api/src/WebPlatformEngine.c index 1bd9ac0..b0c2b13 100644 --- a/c_api/src/WebPlatformEngine.c +++ b/c_api/src/WebPlatformEngine.c @@ -3,6 +3,7 @@ #include "MainAgent.h" #include "AlususExpert.h" #include "KeywordDocsRetriever.h" +#include "Translator.h" #include "common.h" #include "utils.h" #include "llama.h" @@ -203,8 +204,8 @@ static JSON* get_docs_from_code( } char* webplatform_run( - const char *api_key, const char *question, - const char *docs_index_path, const char *rag_index_path, + const char *api_key, const char *question, const char *lang, + const char *docs_index_path, const char *rag_index_path, const char *ar_docs_dir, const char *model_tag, const char *embedding_model_path, const char *alusus_features_mapper_path, const char *docs_root_dir) { // read the index file once @@ -274,7 +275,14 @@ char* webplatform_run( const char *final_answer = prompt_alusus_expert(initial_code, keyword_docs, api_key); printf("\nPrompting Alusus Expert is done successfully\n"); - char *formatted_response = format_final_response(final_answer); + // translate the code + printf("\nPrompting Alusus Translator ...\n"); + JSON *used_libs = json_object_new_array(); + JSON_A_ADD(used_libs, STR2JSON("WebPlatform")); + const char *translated_code = prompt_translator(final_answer, lang, ar_docs_dir, api_key, used_libs); + printf("\nPrompting Alusus Translator is done successfully\n"); + + char *formatted_response = format_final_response(translated_code); //printf("formatted_response:\n%s\n", formatted_response); return formatted_response; } diff --git a/c_api/src/main.c b/c_api/src/main.c index 83482c4..748258a 100644 --- a/c_api/src/main.c +++ b/c_api/src/main.c @@ -14,9 +14,25 @@ void show_result(const char *result) { } } +void log_result(const char *result, const char *question, const char *log_file_path) { + if (result) { + FILE *file = fopen(log_file_path, "w"); + if (file) { + fprintf(file, "======\n%s\n======\n***************\nresult:\n%s\n**************\n", question, result); + fclose(file); + printf("Result written to output.log\n"); + } else { + perror("Failed to open output.log"); + } + free(result); // Free the response buffer + } else { + printf("Failed to get the result.\n"); + } +} + int main(int argc, char *argv[]) { - if (argc != 3) { - fprintf(stderr, "Usage: %s \n", argv[0]); + if (argc != 5) { + fprintf(stderr, "Usage: %s \n", argv[0]); return 1; } @@ -25,6 +41,8 @@ int main(int argc, char *argv[]) { return 1; } const char *question = argv[2]; + const char *lang = argv[3]; + const char *log_file_path = argv[4]; // dispatch the job to the correct engine char *lower_question = str_to_lowercase(question); @@ -32,24 +50,26 @@ int main(int argc, char *argv[]) { if (strstr(lower_question, "webplatform") != NULL) { atexit(webplatform_free_resources); char *result = webplatform_run( - cfg.api_key, question, - cfg.webplatform_docs_index_path, cfg.rag_index_path, + cfg.api_key, question, lang, + cfg.webplatform_docs_index_path, cfg.rag_index_path, cfg.ar_docs_dir, cfg.model_tag, cfg.embedding_model_path, cfg.alusus_features_mapper_path, cfg.docs_root_dir ); - show_result(result); + // show_result(result); + log_result(result, question, log_file_path); } else if (strstr(lower_question, "enalusus") != NULL) { atexit(basic_free_resources); char *result = basic_run( - cfg.api_key, question, - cfg.docs_root_dir, cfg.basic_docs_index_path, + cfg.api_key, question, lang, + cfg.docs_root_dir, cfg.basic_docs_index_path, cfg.ar_docs_dir, cfg.base_model_tag, cfg.model_tag, cfg.basic_vdb_path, cfg.basic_index_path, cfg.alusus_features_mapper_path, cfg.embedding_model_path ); printf("Exited basic_run\n"); - show_result(result); + // show_result(result); + log_result(result, question, log_file_path); } else { fprintf(stderr, "Error: Question cannot be answered by current supported engines.\n"); diff --git a/c_api/src/utils.c b/c_api/src/utils.c index 5429af8..f609afe 100644 --- a/c_api/src/utils.c +++ b/c_api/src/utils.c @@ -237,6 +237,7 @@ int parse_config(const char* filename, Config* config) { else if (strcmp(key, "basic_vdb_path") == 0) strcpy(config->basic_vdb_path, value); else if (strcmp(key, "basic_index_path") == 0) strcpy(config->basic_index_path, value); else if (strcmp(key, "alusus_features_mapper_path") == 0) strcpy(config->alusus_features_mapper_path, value); + else if (strcmp(key, "ar_docs_dir") == 0) strcpy(config->ar_docs_dir, value); } } From c9057dbb4e45553b0f26d1bf874560c42bee6682 Mon Sep 17 00:00:00 2001 From: KaisHasan Date: Tue, 1 Jul 2025 13:30:02 +0300 Subject: [PATCH 7/7] add missing keywords --- doc/ar/direct_mapping.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/ar/direct_mapping.json b/doc/ar/direct_mapping.json index eef6aed..23ec96b 100644 --- a/doc/ar/direct_mapping.json +++ b/doc/ar/direct_mapping.json @@ -81,5 +81,7 @@ "Srl/Console": "مـتم/طـرفية", "Srl/Array": "مـتم/مـصفوفة", "closure": "مغلفة", - "this": "هذا" + "this": "هذا", + "true": "صح", + "false": "خطأ" } \ No newline at end of file