Skip to content

Commit edb5008

Browse files
Merge pull request vuejs#59 from boussadjra/feat/template-syntax
Translate template syntax
2 parents cbd9ad7 + d2233b7 commit edb5008

14 files changed

+850
-730
lines changed

.vitepress/config.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ export const sidebar: ThemeConfig['sidebar'] = {
154154
link: '/guide/essentials/reactivity-fundamentals'
155155
},
156156
{
157-
text: 'الخصائص المحسوبة',
157+
text: 'الخاصيات المحسوبة',
158158
link: '/guide/essentials/computed'
159159
},
160160
{
@@ -170,12 +170,12 @@ export const sidebar: ThemeConfig['sidebar'] = {
170170
text: 'معالجة الأحداث',
171171
link: '/guide/essentials/event-handling'
172172
},
173-
{ text: 'ربط مداخل النموذج', link: '/guide/essentials/forms' },
173+
{ text: 'ربط إدخالات النموذج', link: '/guide/essentials/forms' },
174174
{
175175
text: 'خطافات دورة الحياة',
176176
link: '/guide/essentials/lifecycle'
177177
},
178-
{ text: 'الخصائص المراقبة', link: '/guide/essentials/watchers' },
178+
{ text: 'الخاصيات المراقبة', link: '/guide/essentials/watchers' },
179179
{
180180
text: 'Refs مراجع القالب',
181181
link: '/guide/essentials/template-refs'

.vitepress/theme/components/PreferenceSwitch.vue

+8-7
Original file line numberDiff line numberDiff line change
@@ -61,38 +61,38 @@ function useToggleFn(
6161
<div v-if="show" class="preference-switch">
6262
<button
6363
class="toggle"
64-
aria-label="preference switches toggle"
64+
aria-label="تفضيلات زر التبديل"
6565
aria-controls="preference-switches"
6666
:aria-expanded="isOpen"
6767
@click="toggleOpen"
6868
@mousedown="removeOutline"
6969
@blur="restoreOutline"
7070
>
71-
<span>API Preference</span>
71+
<span>تفضيلات واجهة البرمجة</span>
7272
<VTIconChevronDown class="vt-link-icon" :class="{ open: isOpen }" />
7373
</button>
7474
<div id="preference-switches" :hidden="!isOpen" :aria-hidden="!isOpen">
7575
<div class="switch-container">
7676
<label class="options-label" @click="toggleCompositionAPI(false)"
77-
>Options</label
77+
>الخيارات</label
7878
>
7979
<VTSwitch
8080
class="api-switch"
81-
aria-label="prefer composition api"
81+
aria-label="تفضيل الواجهة التركيبية"
8282
:aria-checked="preferComposition"
8383
@click="toggleCompositionAPI()"
8484
/>
8585
<label
8686
class="composition-label"
8787
@click="toggleCompositionAPI(true)"
88-
>Composition</label
88+
>التركيبية</label
8989
>
9090
<a
9191
class="switch-link"
92-
title="About API preference"
92+
title="حول تفضيلات الواجهة البرمجية"
9393
href="/guide/introduction.html#api-styles"
9494
@click="closeSideBar"
95-
>?</a
95+
>؟</a
9696
>
9797
</div>
9898
<div class="switch-container" v-if="showSFC">
@@ -169,6 +169,7 @@ function useToggleFn(
169169
.switch-container {
170170
display: flex;
171171
align-items: center;
172+
direction: ltr ;
172173
}
173174
174175
.switch-container:nth-child(2) {

.vitepress/theme/styles/overrides.css

+23
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,26 @@ pre {
4747
position: absolute;
4848
right: -24px;
4949
}
50+
51+
.vt-doc ol > li:before {
52+
left: auto;
53+
right: 2px;
54+
}
55+
56+
.vt-doc ol > li p {
57+
padding-right: 1.25rem;
58+
}
59+
60+
.vt-badge.experimental:before {
61+
content: 'تجريبي';
62+
}
63+
64+
.demo label {
65+
margin: 0 0.3em 0 1em;
66+
}
67+
.vt-doc blockquote {
68+
border-left:none!important;
69+
border-right: 0.2rem solid var(--vt-c-divider);
70+
padding-right: 1rem;
71+
}
72+

glossary.md

+5
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,8 @@
5757
| container | مُستوعِب |
5858
| CSS selector | مُحدِّد CSS |
5959
| assets | ملحقات |
60+
| modifier | مُعدِّل |
61+
| tick | نبضة |
62+
| unwrap | فك |
63+
| lazy | خامل |
64+
| index | مؤشر |

src/guide/essentials/application.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const app = createApp({
1212
})
1313
```
1414

15-
## The Root Component {#the-root-component}
15+
## المكون الجذر {#the-root-component}
1616

1717
الكائن الذي نمرره إلى دالة `createApp` هو في الأصل مكون. يتطلب كل تطبيق "مكوِّنًا جذريًا" الذي بدوره يمكن أن يحتوي على مكونات أخرى مثل مكوناته الفرعية.
1818

src/guide/essentials/class-and-style.md

+56-52
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
# Class and Style Bindings {#class-and-style-bindings}
1+
# ربط التنسيقات و الأصناف {#class-and-style-bindings}
22

3-
A common need for data binding is manipulating an element's class list and inline styles. Since `class` and `style` are both attributes, we can use `v-bind` to assign them a string value dynamically, much like with other attributes. However, trying to generate those values using string concatenation can be annoying and error-prone. For this reason, Vue provides special enhancements when `v-bind` is used with `class` and `style`. In addition to strings, the expressions can also evaluate to objects or arrays.
4-
5-
## Binding HTML Classes {#binding-html-classes}
3+
احتياج شائع لربط البيانات هو التحكم في قائمة الأصناف وتنسيقات العنصر. بما أن `class` و `style` عبارة عن سمتين، يمكننا استخدام `v-bind` لاعطائهما سلسلة نصية كقيمة بشكل ديناميكي، على غرار السمات الأخرى. ومع ذلك، يمكن أن يكون توليد هذه القيم عن طريق ربط سلاسل مزعجًا ومُحتملًا للأخطاء. لهذا السبب، توفر Vue تحسينات خاصة عند استخدام `v-bind` مع `class` و `style`. بالإضافة إلى السلاسل النصية، يمكن أن تُقيّم العبارات أيضًا إلى كائنات أو مصفوفات.
4+
## ربط أصناف الـHTML {#binding-html-classes}
65

76
<div class="options-api">
87
<VueSchoolLink href="https://vueschool.io/lessons/dynamic-css-classes-with-vue-3" title="Free Vue.js Dynamic CSS Classes Lesson"/>
@@ -12,17 +11,18 @@ A common need for data binding is manipulating an element's class list and inlin
1211
<VueSchoolLink href="https://vueschool.io/lessons/vue-fundamentals-capi-dynamic-css-classes-with-vue" title="Free Vue.js Dynamic CSS Classes Lesson"/>
1312
</div>
1413

15-
### Binding to Objects {#binding-to-objects}
14+
### الربط بالكائنات {#binding-to-objects}
1615

17-
We can pass an object to `:class` (short for `v-bind:class`) to dynamically toggle classes:
16+
يمكننا تمرير كائن إلى `:class` (الإختصار لـ `v-bind:class`) لتبديل الأصناف بشكل ديناميكي:
1817

1918
```vue-html
2019
<div :class="{ active: isActive }"></div>
2120
```
2221

23-
The above syntax means the presence of the `active` class will be determined by the [truthiness](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) of the data property `isActive`.
2422

25-
You can have multiple classes toggled by having more fields in the object. In addition, the `:class` directive can also co-exist with the plain `class` attribute. So given the following state:
23+
الصيغة أعلاه تعني أن وجود الصنف `active` سيتم تحديده بواسطة [صحة](https://developer.mozilla.org/en-US/docs/Glossary/Truthy) الخاصية `isActive` من البيانات.
24+
25+
يمكن أن يكون لديك عدة أصناف تتبدل بواسطة وجود العديد من الخاصيات في الكائن. بالإضافة إلى ذلك، يمكن للسمة المربوطة `:class` أيضًا أن تكون موجودة بجانب السمة `class` العادية. لذا، بالنظر إلى الحالة التالية:
2626

2727
<div class="composition-api">
2828

@@ -46,7 +46,7 @@ data() {
4646

4747
</div>
4848

49-
And the following template:
49+
و القالب الموالي:
5050

5151
```vue-html
5252
<div
@@ -55,15 +55,15 @@ And the following template:
5555
></div>
5656
```
5757

58-
It will render:
58+
سيتم تصيير العنصر التالي:
5959

6060
```vue-html
6161
<div class="static active"></div>
6262
```
6363

64-
When `isActive` or `hasError` changes, the class list will be updated accordingly. For example, if `hasError` becomes `true`, the class list will become `"static active text-danger"`.
64+
عند تغيير `isActive` أو `hasError`، سيتم تحديث قائمة الصنف بناءً على ذلك. على سبيل المثال، إذا أصبح `hasError` `true`، فسيصبح قائمة الصنف `"static active text-danger"`.
6565

66-
The bound object doesn't have to be inline:
66+
الكائن المربوط لا يحتاج أن يكون مُضمَّنا:
6767

6868
<div class="composition-api">
6969

@@ -95,7 +95,7 @@ data() {
9595
<div :class="classObject"></div>
9696
```
9797

98-
This will render the same result. We can also bind to a [computed property](./computed) that returns an object. This is a common and powerful pattern:
98+
سيقوم هذا الربط بتصيير نفس النتيجة. يمكننا أيضًا الربط بخاصية [محسوبة](./computed) تعيد كائنًا. و هو نمط شائع وقوي:
9999

100100
<div class="composition-api">
101101

@@ -136,9 +136,9 @@ computed: {
136136
<div :class="classObject"></div>
137137
```
138138

139-
### Binding to Arrays {#binding-to-arrays}
139+
### الربط بالمصفوفات {#binding-to-arrays}
140140

141-
We can bind `:class` to an array to apply a list of classes:
141+
يمكننا ربط `:class` بمصفوفة لتطبيق قائمة من الأصناف:
142142

143143
<div class="composition-api">
144144

@@ -166,90 +166,91 @@ data() {
166166
<div :class="[activeClass, errorClass]"></div>
167167
```
168168

169-
Which will render:
169+
نتيجة التصيير :
170170

171171
```vue-html
172172
<div class="active text-danger"></div>
173173
```
174174

175-
If you would like to also toggle a class in the list conditionally, you can do it with a ternary expression:
175+
إذا كنت ترغب أيضًا في تبديل صنف في القائمة بشكل شرطي، يمكنك القيام بذلك باستخدام تعبير ثلاثي:
176176

177177
```vue-html
178178
<div :class="[isActive ? activeClass : '', errorClass]"></div>
179179
```
180180

181-
This will always apply `errorClass`, but `activeClass` will only be applied when `isActive` is truthy.
181+
هذا الربط سيطبق دائمًا `errorClass`، ولكن `activeClass` سيتم تطبيقه فقط عندما يكون `isActive` صحيحًا.
182182

183-
However, this can be a bit verbose if you have multiple conditional classes. That's why it's also possible to use the object syntax inside array syntax:
183+
لكن قد يكون هذا طويلا نوعا ما إذا كان لديك أصناف شرطية متعددة. لهذا السبب، يمكنك أيضًا استخدام صيغة الكائن داخل صيغة المصفوفة :
184184

185185
```vue-html
186186
<div :class="[{ active: isActive }, errorClass]"></div>
187187
```
188188

189-
### With Components {#with-components}
189+
### مع المكونات {#with-components}
190190

191-
> This section assumes knowledge of [Components](/guide/essentials/component-basics). Feel free to skip it and come back later.
191+
> هذا القسم يفترض أن لديك معرفة [بالمكونات](/guide/essentials/component-basics). لا تتردد في تخطيه والعودة إليه لاحقًا.
192192
193-
When you use the `class` attribute on a component with a single root element, those classes will be added to the component's root element, and merged with any existing class already on it.
193+
لما تستخدم السمة `class` على مكون يحتوي على عنصر واحد فقط، سيتم إضافة هذه الصنف إلى العنصر الجذري للمكون، وسيتم دمجها مع أي صنف موجود عليه من قبل.
194194

195-
For example, if we have a component named `MyComponent` with the following template:
195+
على سبيل المثال، إذا كان لدينا مكون يسمى `MyComponent` مع القالب التالي:
196196

197197
```vue-html
198-
<!-- child component template -->
199-
<p class="foo bar">Hi!</p>
198+
<!-- قالب المكون الابن -->
199+
<p class="foo bar">مرحبا!</p>
200200
```
201201

202-
Then add some classes when using it:
202+
ثم اضف بعض الأصناف عند استخدامه:
203203

204204
```vue-html
205-
<!-- when using the component -->
205+
<!-- عند استخدام المكون -->
206206
<MyComponent class="baz boo" />
207207
```
208208

209-
The rendered HTML will be:
209+
الـHTML المصيّر سيكون بالشكل الموالي :
210210

211211
```vue-html
212-
<p class="foo bar baz boo">Hi</p>
212+
<p class="foo bar baz boo">مرحبا</p>
213213
```
214214

215-
The same is true for class bindings:
215+
نفس الشيء ينطبق على ربط الصنف:
216216

217217
```vue-html
218218
<MyComponent :class="{ active: isActive }" />
219219
```
220220

221-
When `isActive` is truthy, the rendered HTML will be:
221+
لما يكون `isActive` صحيحًا، سيكون الـHTML المصيّر بالشكل الموالي :
222222

223223
```vue-html
224-
<p class="foo bar active">Hi</p>
224+
<p class="foo bar active">مرحبا</p>
225225
```
226226

227-
If your component has multiple root elements, you would need to define which element will receive this class. You can do this using the `$attrs` component property:
227+
إذا كان لديك مكون يحتوي على عناصر جذرية متعددة، ستحتاج إلى تحديد أي عنصر سيتلقى هذا الصنف. يمكنك القيام بذلك باستخدام خاصية المكون `attrs$`:
228228

229229
```vue-html
230-
<!-- MyComponent template using $attrs -->
231-
<p :class="$attrs.class">Hi!</p>
232-
<span>This is a child component</span>
230+
<!-- قالب MyComponent باستخدام $attrs -->
231+
<p :class="$attrs.class">مرحبا!</p>
232+
<span>هذا هو المكون الابن</span>
233233
```
234234

235235
```vue-html
236236
<MyComponent class="baz" />
237237
```
238238

239-
Will render:
239+
النتيجة المصيرة ستكون:
240240

241241
```html
242-
<p class="baz">Hi!</p>
243-
<span>This is a child component</span>
242+
<p class="baz">مرحبا!</p>
243+
<span>هذا هو المكون الابن</span>
244244
```
245245

246246
You can learn more about component attribute inheritance in [Fallthrough Attributes](/guide/components/attrs.html) section.
247247

248-
## Binding Inline Styles {#binding-inline-styles}
248+
يمكنك معرفة المزيد عن توريث سمات المكون في قسم [Fallthrough Attributes](/guide/components/attrs.html).
249+
## ربط التنسيقات السطرية {#binding-inline-styles}
249250

250-
### Binding to Objects
251+
### الربط بالكائنات
251252

252-
`:style` supports binding to JavaScript object values - it corresponds to an [HTML element's `style` property](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style):
253+
`:style` يدعم ربط قيم كائنات JavaScript - يُوافق مع [خاصية `style` لعنصر HTML](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style):
253254

254255
<div class="composition-api">
255256

@@ -277,13 +278,15 @@ data() {
277278
<div :style="{ color: activeColor, fontSize: fontSize + 'px' }"></div>
278279
```
279280

280-
Although camelCase keys are recommended, `:style` also supports kebab-cased CSS property keys (corresponds to how they are used in actual CSS) - for example:
281+
282+
رغم أن الأسماء المكتوبة باستخدام نمط سنام الجمل camelCase موصى بها، إلا أن `style:` يدعم أيضًا أسماء الخاصيات CSS مكتوبة باستخدام نمط أسياخ الشواء kebab-case (وهي ما يتم استخدامه في CSS الفعلي) - على سبيل المثال:
283+
281284

282285
```vue-html
283286
<div :style="{ 'font-size': fontSize + 'px' }"></div>
284287
```
285288

286-
It is often a good idea to bind to a style object directly so that the template is cleaner:
289+
غالبا ما يكون من الأفضل ربط كائن التنسيقات مباشرة حتى يكون محتوى القالب أنقى:
287290

288291
<div class="composition-api">
289292

@@ -315,26 +318,27 @@ data() {
315318
<div :style="styleObject"></div>
316319
```
317320

318-
Again, object style binding is often used in conjunction with computed properties that return objects.
321+
مرة أخرى، يتم استخدام ربط كائن التنسيقات عادةً مع خاصيات محسوبة تُعيد كائنات.
319322

320-
### Binding to Arrays
323+
### الربط بالمصفوفات
321324

322-
We can bind `:style` to an array of multiple style objects. These objects will be merged and applied to the same element:
325+
يمكننا ربط `:style` بمصفوفة من كائنات متعددة من التنسيقات . سيتم دمج هذه الكائنات وتطبيقها على نفس العنصر:
323326

324327
```vue-html
325328
<div :style="[baseStyles, overridingStyles]"></div>
326329
```
327330

328-
### Auto-prefixing {#auto-prefixing}
331+
### البادئة التلقائية {#auto-prefixing}
329332

330-
When you use a CSS property that requires a [vendor prefix](https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix) in `:style`, Vue will automatically add the appropriate prefix. Vue does this by checking at runtime to see which style properties are supported in the current browser. If the browser doesn't support a particular property then various prefixed variants will be tested to try to find one that is supported.
333+
لما تستخدم خاصية CSS والتي تتطلب [بادئة](https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix) في `:style`، ستُضِيف Vue البادئة المناسبة تلقائيًا. تقوم Vue بذلك من خلال التحقق في وقت التشغيل لمعرفة أي خاصيات النمط المدعومة في المتصفح الحالي. إذا لم يدعم المتصفح خاصية معينة سيختبر بعدها مختلف أنواع البادئات للحصول على أحد البادئات المدعومة.
331334

332-
### Multiple Values {#multiple-values}
335+
### قيم متعددة {#multiple-values}
333336

334-
You can provide an array of multiple (prefixed) values to a style property, for example:
337+
يمكنك امداد مصفوفة من القيم المتعددة (ذات بادئة) إلى خاصية التنسيق، على سبيل المثال:
335338

336339
```vue-html
337340
<div :style="{ display: ['-webkit-box', '-ms-flexbox', 'flex'] }"></div>
338341
```
342+
هذه الشيفرة ستصير القيمة الأخيرة فقط في المصفوفة التي يدعمها المتصفح. في هذا المثال، ستقوم بتصيير `display: flex` للمتصفحات التي تدعم نسخة بدون بادئة من flexbox.
343+
339344

340-
This will only render the last value in the array which the browser supports. In this example, it will render `display: flex` for browsers that support the unprefixed version of flexbox.

0 commit comments

Comments
 (0)