|
| 1 | +# تعدد الأشكال |
1 | 2 |
|
2 | | -# Polyfills |
| 3 | +تتطور لغة جافاسكريبت بثبات. تظهر مقترحات جديدة للغة بانتظام, يتم تحليلها و, إذا كانت جديرة بالإهتمام, يتم إضافتها إلى القائمة في <https://tc39.github.io/ecma262/> و من ثم التقدم في [specification](http://www.ecma-international.org/publications/standards/Ecma-262.htm). |
3 | 4 |
|
4 | | -The JavaScript language steadily evolves. New proposals to the language appear regularly, they are analyzed and, if considered worthy, are appended to the list at <https://tc39.github.io/ecma262/> and then progress to the [specification](http://www.ecma-international.org/publications/standards/Ecma-262.htm). |
| 5 | +الفرق خلف محركات جافاسكريبت لديهم افكارهم الخاصه عن ماذا يقوموا بتنفيذه اولاً. قد يقررون تنفيذ المقترحات الموجودة في المسودة وتأجيل الأشياء الموجودة بالفعل في المواصفات, لأنهم أقل إثارة للاهتمام أو يصعب القيام بهم. |
5 | 6 |
|
6 | | -Teams behind JavaScript engines have their own ideas about what to implement first. They may decide to implement proposals that are in draft and postpone things that are already in the spec, because they are less interesting or just harder to do. |
| 7 | +لذا فمن الشائع تمامًا أن يقوم المحرك بتطبيق الجزء القياسي فقط. |
7 | 8 |
|
8 | | -So it's quite common for an engine to implement only the part of the standard. |
9 | | - |
10 | | -A good page to see the current state of support for language features is <https://kangax.github.io/compat-table/es6/> (it's big, we have a lot to study yet). |
| 9 | +صفحة جيدة لمعرفة الحالة الحالية لدعم ميزات اللغة هي <https://kangax.github.io/compat-table/es6/> (إنها ضخمه, لدينا الكثير لندرسه بعد). |
11 | 10 |
|
12 | 11 | ## Babel |
13 | 12 |
|
14 | | -When we use modern features of the language, some engines may fail to support such code. Just as said, not all features are implemented everywhere. |
| 13 | +عندما نستخدم الميزات الحديثة للغة, قد تفشل بعض المحركات في دعم مثل هذا الكود. كما يقال, لا يتم تنفيذ جميع الميزات في كل مكان. |
15 | 14 |
|
16 | | -Here Babel comes to the rescue. |
| 15 | +هنا `Babel` تأتي لإنقاذ الموقف. |
17 | 16 |
|
18 | | -[Babel](https://babeljs.io) is a [transpiler](https://en.wikipedia.org/wiki/Source-to-source_compiler). It rewrites modern JavaScript code into the previous standard. |
| 17 | +[Babel](https://babeljs.io) هي [transpiler](https://en.wikipedia.org/wiki/Source-to-source_compiler). إنها تعيد كتابة كود جافاسكريبت الحديث إلى معايير سابقة. |
19 | 18 |
|
20 | | -Actually, there are two parts in Babel: |
| 19 | +فعلياً, يوجد قسمين في `Babel`: |
21 | 20 |
|
22 | | -1. First, the transpiler program, which rewrites the code. The developer runs it on their own computer. It rewrites the code into the older standard. And then the code is delivered to the website for users. Modern project build systems like [webpack](http://webpack.github.io/) provide means to run transpiler automatically on every code change, so that it's very easy to integrate into development process. |
| 21 | +1. الأول, برنامج المترجم, الذي يعيد كتابة الكود. يقوم المطور بتشغيله على جهاز الكمبيوتر الخاص به. إنه يعيد كتابة الكود للمعايير القديمة. ثم يتم تسليم الكود إلى الموقع الإلكتروني للمستخدمين. أنظمة بناء المشاريع الحديثة مثل [webpack](http://webpack.github.io/) توفير وسائل لتشغيل الترجمة تلقائيًا عند كل تغيير للكود, بحيث يسهل الاندماج في عملية التطوير. |
23 | 22 |
|
24 | | -2. Second, the polyfill. |
| 23 | +2. الثاني, تعدد الأشكال. |
25 | 24 |
|
26 | | - New language features may include new built-in functions and syntax constructs. |
27 | | - The transpiler rewrites the code, transforming syntax constructs into older ones. But as for new built-in functions, we need to implement them. JavaScript is a highly dynamic language, scripts may add/modify any functions, so that they behave according to the modern standard. |
| 25 | + قد تتضمن ميزات اللغة الجديدة وظائف مضمنة جديدة وتركيبات بناء جملة. |
| 26 | + المترجم يقوم بإعادة بناء الكود, تحويل بناء الجملة إلى التركيبات القديمة. و لكن بالنسبة للدوال المُضمنه الجديدة, نريد تنفيذهم. جافاسكريبت هى لغه ديناميكيه للغايه, الـ سكريبتات يمكن ان تقول بـ إضافة/تعديل أي دوال, بحيث يتصرفون وفقًا للمعايير الحديثة. |
28 | 27 |
|
29 | | - A script that updates/adds new functions is called "polyfill". It "fills in" the gap and adds missing implementations. |
| 28 | + الـ سكريبت الذي يقوم بـ تعديل/إضافة الدوال الجديده يسمى "polyfill". إنه "يملأ" الفجوة و يضيف كل الدوال المفقودة. |
30 | 29 |
|
31 | | - Two interesting polyfills are: |
32 | | - - [core js](https://github.com/zloirock/core-js) that supports a lot, allows to include only needed features. |
33 | | - - [polyfill.io](http://polyfill.io) service that provides a script with polyfills, depending on the features and user's browser. |
| 30 | + إثنان مهمان من `polyfills` هما: |
34 | 31 |
|
35 | | -So, if we're going to use modern language features, a transpiler and a polyfill are necessary. |
| 32 | + - [core js](https://github.com/zloirock/core-js) الذي يوفر الكثير, يسمح بتضمين الميزات المطلوبة فقط. |
| 33 | + - [polyfill.io](http://polyfill.io) خدمة توفر سكريبت مع `polyfills`, اعتمادًا على الميزات ومتصفح المستخدم. |
36 | 34 |
|
37 | | -## Examples in the tutorial |
| 35 | +لذا, إذا كنا سنستخدم ميزات اللغة الحديثة, الـ `transpiler` و `polyfill` ضروريان. |
38 | 36 |
|
| 37 | +## أمثلة في البرنامج التعليمي |
39 | 38 |
|
40 | 39 | ````online |
41 | | -Most examples are runnable at-place, like this: |
| 40 | +يمكن تشغيل معظم الأمثلة في مكانها, مثل ذلك: |
42 | 41 |
|
43 | 42 | ```js run |
44 | | -alert('Press the "Play" button in the upper-right corner to run'); |
| 43 | +alert('إضغط زر "Play" في الجزء الأيمن العلوي للتشغيل'); |
45 | 44 | ``` |
46 | 45 |
|
47 | | -Examples that use modern JS will work only if your browser supports it. |
| 46 | +لن تعمل الأمثلة التي تستخدم جافاسكريبت الحديثة إلا إذا كان متصفحك يدعمها. |
48 | 47 | ```` |
49 | 48 |
|
50 | 49 | ```offline |
51 | | -As you're reading the offline version, in PDF examples are not runnable. In EPUB some of them can run. |
| 50 | +بما أنك تقرأ النسخة بلا إنترنت, الأمثله غير قابلة للتشغيل في `PDF`. في `EPUB` يمكن لبعضهم أن يعمل. |
52 | 51 | ``` |
53 | 52 |
|
54 | | -Google Chrome is usually the most up-to-date with language features, good to run bleeding-edge demos without any transpilers, but other modern browsers also work fine. |
| 53 | +عادةً ما يكون `Google Chrome` هو الأحدث مع ميزات اللغة, جيد فى تشغيل العروض التوضيحيه بدون اى مترجمات `transpilers`, ولكن المتصفحات الحديثة الأخرى تعمل أيضًا بشكل جيد. |
0 commit comments