Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 67 additions & 25 deletions Doc/asset_routes.ar.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,59 @@

[[رجوع]](../README.ar.md)

<div dir=rtl>

## إنشاء مسارات الموارد في الخادم

يمكن القيام بذلك ببساطة عن طريق كتابة:

<div dir=rtl>

```
@مسار_موارد عرف مسار_الموارد: "Assets/"؛
```

</div>
<div dir=ltr>

```
@assetsRoute def assetsRoute: "Assets/";
```

</div>

المسار في هذه الحالة في نظام الملفات سيطابق `./Assets/` بينما في الخادم سيكون `/Assets/`.

ويمكنك تحديد مسار في الخادم مختلف عن المسار في نظام الملفات عبر تمرير مسار الخادم كمعطى
للمبدل `@مسار_موارد` (`@assetsRoute`):

<div dir=rtl>

```
@مسار_موارد["/images/"] عرف مسار_الموارد: "Assets/Images/"؛
```

</div>
<div dir=ltr>

```
@assetsRoute["/images/"] def assetsRoute: "Assets/Images/";
```

</div>

في المثال أعلاه استخدام المسار `/images/` في المتصفح سيوصلك إلى الملفات التي في المجلد `Assets/Images/`.

مـنصة_ويب تدعم أيضًا تحديد مسارين ضمن نظام الملفات، أحدهما يستخدم عند تنفيذ البرنامج مباشرة من الشفرة
المصدرية، والآخر يستخدم عند تنفيذ البرنامج من نسخة مبنية مسبقًا. تسمح هذه الخاصية للمستخدم بتحديد المكان
الذي ستنسخ إليه المفات عند بناء النسخة الرقمية من البرنامج. على سبيل المثال:

<div dir=rtl>

```
@مسار_موارد["/images/"] عرف مسار_الموارد: ("Assets/Images/"، "الصور/")؛
```

</div>
<div dir=ltr>

```
@assetsRoute["/images/"] def assetsRoute: ("Assets/Images/", "Images/");
```

</div>

في هذا المثال ستستخدم مـنصة_ويب المسار "Assets/Images" عند تشغيل الخادم باستخدام
الدالة `ابن_وابدأ_الخادم` (`buildAndStartServer`) أو الدالة `ابن_وشغل_الخادم` (`buildAndRunServer`)
وستستخدم المسار الآخر (`الصور` أو `Images`) عند تشغيل الخادم باستخدام `ابدأ_الخادم` (`startServer`)
Expand All @@ -67,18 +69,18 @@
المكتبات والإشارة إلى مكان هذه الموارد ضمن المكتبة بغض النظر عن مكان المكتبة في نظام الملفات.
على سبيل المثال:

<div dir=rtl>

```
@مسار_موارد["/images/"] عرف مسار_الموارد: ("$الصور/"، "الصور/")؛
```

</div>
<div dir=ltr>

```
@assetsRoute["/images/"] def assetsRoute: ("$Images/", "Images/");
```

</div>

في هذا المثال نخبر مـنصة_ويب أن الصور موجودة ضمن المكتبة الحالية ومسارها هو `<مسار_المكتبة>/الصور`
وعند بناء النسخة الرقمية من المشروع ستُنسخ هذه الملفات إلى المجلد `الصور/` ضمن مجلد البناء، أي
المجلد الذي ستُبنى فيه النسخة الرقمية. فأثناء التطوير تُتسخدم الملفات مباشرة من مكانها ضمن المكتبة
Expand All @@ -87,29 +89,27 @@

### دالة هات_مسارات_الموارد_لوحدات (getAssetsRoutesFromModules)

<div dir=rtl>

```
دالة هات_مسارات_الموارد_لوحدات (
سند_وحدات: سند[الـقلب.أسـاسيات.كـائن_بهوية]
): مـصفوفة[مـسار_سواكن]؛
```

</div>
<div dir=ltr>

```
func getAssetsRoutesFromModules (
modulesRef: ref[Core.Basic.TiObject]
): Array[StaticRoute];
): Array[StaticRoute]
```

</div>

تجلب معلومات مسارات الموارد المعرفة ضمن الوحدات المشار إليها.


### الصنف مـسار_سواكن (StaticRoute)

<div dir=rtl>

```
صنف مـسار_سواكن {
عرف مسار_الخادم: نـص؛
Expand All @@ -118,7 +118,7 @@ func getAssetsRoutesFromModules (
}
```

</div>
<div dir=ltr>

```
class StaticRoute {
Expand All @@ -128,14 +128,56 @@ class StaticRoute {
}
```

</div>

يحتوي هذا الصنف على معلومات حول مسار موارد محدد.

`مسار_الخادم` (`uri`) مسار الموارد على خادم HTTP، أي المسار الذي يمكن من خلاله الوصول إلى الموارد
عبر طلب HTTP.
#### مسار_الخادم (uri)

`مسار_المصدر` (`srcPath`) المسار المصدري لهذه الموارد في نظام الملفات. هذا المسار هو المسار الذي
يستخدم عند تشغيل الخادم مباشرة دون بناء مسبق. يشير هذا في العادة إلى مكان الموارد ضمن الشفرة
المصدرية.
```
عرف مسار_الخادم: نـص؛
```

<div dir=ltr>

```
def uri: String
```

</div>

`مسار_البناء` (`buildPath`) المسار في نظام الملفات الذي سيستخدم عند إنشاء نسخة رقمية من المشروع.
مسار الموارد على خادم HTTP، أي المسار الذي يمكن من خلاله الوصول إلى الموارد عبر طلب HTTP.

#### مسار_المصدر (srcPath)

```
عرف مسار_المصدر: نـص؛
```

<div dir=ltr>

```
def srcPath: String
```

</div>

المسار المصدري لهذه الموارد في نظام الملفات. هذا المسار هو المسار الذي يستخدم عند تشغيل الخادم مباشرة دون بناء مسبق. يشير هذا في العادة إلى مكان الموارد ضمن الشفرة المصدرية.

#### مسار_البناء (buildPath)

```
عرف مسار_البناء: نـص؛
```

<div dir=ltr>

```
def buildPath: String
```

</div>

المسار في نظام الملفات الذي سيستخدم عند إنشاء نسخة رقمية من المشروع.

</div>
31 changes: 21 additions & 10 deletions Doc/asset_routes.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,16 @@ copied to the `Images/` folder within the build directory, i.e., the directory w
will be built. During development, the files are used directly from their location within the library,
while after building, WebPlatform looks for these files in a different path specific to the binary version.


### Function getAssetsRoutesFromModules

```
func getAssetsRoutesFromModules (
modulesRef: ref[Core.Basic.TiObject]
): Array[StaticRoute];
): Array[StaticRoute]
```

Retrieves information about resource routes defined within the referenced modules.


### Class StaticRoute

```
Expand All @@ -79,13 +77,26 @@ class StaticRoute {

This class contains information about a specific resources route.

`uri` is the resource path on the HTTP server, i.e., the path through which resources can be
accessed via an HTTP request.
#### uri

`srcPath` is the source path of these resources in the file system. This path is used when
running the server directly without prior building. It typically points to the location of
the resources within the source code.
```
def uri: String
```

`buildPath` is the path in the file system that will be used when creating a digital version
of the project.
The resource path on the HTTP server, i.e., the path through which resources can be accessed via an HTTP request.

#### srcPath

```
def srcPath: String
```

The source path of these resources in the file system. This path is used when running the server directly without prior building. It typically points to the location of the resources within the source code.

#### buildPath

```
def buildPath: String
```

The path in the file system that will be used when creating a digital version of the project.
Loading