Skip to content

Commit 5f66a66

Browse files
[Added] Arabic Language (axios#84)
* Adding Arabic Language * Arabic Config * Arabic Config params * fixes for Arabic Config * fixing typos * adding intro Arabic --------- Co-authored-by: Jay <[email protected]>
1 parent a2a0463 commit 5f66a66

16 files changed

+1070
-0
lines changed

ar.lang.js

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
/**
2+
* Configuration for the Arabic translation
3+
*/
4+
5+
module.exports = {
6+
display: "Arabic",
7+
prefix: "/ar/",
8+
dir: "rtl",
9+
lang: "ar",
10+
p: {
11+
headline: ",تعهد مبني على اساس عميل اتش تي بي بي للمتصفح و نود جي أس",
12+
subhead: `,أكسيوس عبارة عن تعهد بسيط لل أتش تي بي بي للمتصفح و نود جي أس
13+
.كما أن أكسيوي يوفر مكتبة بسيطة و صغيرة و واجهة قابلة للتوسع`,
14+
},
15+
t: {
16+
"Get Started":"هيا بنا نبدأ",
17+
"View on GitHub": "اعرض في غيت هب",
18+
"Languages": "اللغات",
19+
"Open Source": "مصدر مفوح",
20+
"Contribute": "ساهم",
21+
"Source on GitHub": "المصدر على غيت هب",
22+
"Issues": "معضلات",
23+
"Pull Requests": "طلبات السحب",
24+
"Code of Conduct": "القواعد السلوكية",
25+
"Fork on GitHub": "تفرع على غيت هب",
26+
"Fork the Website": "تفرع على الموقع",
27+
"Create an Issue": "أنشاء معضلة",
28+
"Next": "التالي",
29+
"Previous": "السابق",
30+
"Website Copy Right Footer": "تذييل حقوق الملكية للموقع",
31+
"View On Github": "اعرض على غيت هب",
32+
"Axios Project Copy Right Footer": "تذييل مشروع أكسيويس حقوق النسخ",
33+
"License Label Footer": "تزييل شهادة ملصق"
34+
},
35+
sidebar: [
36+
{
37+
type: "heading",
38+
text: "البداية",
39+
},
40+
{
41+
type: "link",
42+
href: "/docs/intro",
43+
text: "المقدمة",
44+
},
45+
{
46+
type: "link",
47+
href: "/docs/example",
48+
text: "مثال",
49+
},
50+
{
51+
type: "link",
52+
href: "/docs/post_example",
53+
text: "طلبات بوست",
54+
},
55+
{
56+
type: "heading",
57+
text: "أكسيوس إي بي أي",
58+
},
59+
{
60+
type: "link",
61+
href: "/docs/api_intro",
62+
text: "أكسيوس إي بي أي",
63+
},
64+
{
65+
type: "link",
66+
href: "/docs/instance",
67+
text: "نموذج الأكسيوس",
68+
},
69+
{
70+
type: "link",
71+
href: "/docs/req_config",
72+
text: "إعدادات الطلب",
73+
},
74+
{
75+
type: "link",
76+
href: "/docs/res_schema",
77+
text: "مخطط الطلب",
78+
},
79+
{
80+
type: "link",
81+
href: "/docs/config_defaults",
82+
text: "إعدادات افتراضية",
83+
},
84+
{
85+
type: "link",
86+
href: "/docs/interceptors",
87+
text: "المعترضون",
88+
},
89+
{
90+
type: "link",
91+
href: "/docs/handling_errors",
92+
text: "معالجة الأخطاء",
93+
},
94+
{
95+
type: "link",
96+
href: "/docs/cancellation",
97+
text: "الإلغاء",
98+
},
99+
{
100+
type: "link",
101+
href: "/docs/urlencoded",
102+
text: "مجسمات ترميز يو أر إل",
103+
},
104+
{
105+
type: "heading",
106+
text: "أخرى",
107+
},
108+
{
109+
type: "link",
110+
href: "/docs/notes",
111+
text: "ملاحظات",
112+
},
113+
{
114+
type: "heading",
115+
text: "المساهمون",
116+
},
117+
{
118+
type: "link",
119+
href: "https://github.com/axios/axios/blob/master/CODE_OF_CONDUCT.md",
120+
text: "القواعد السلوكية",
121+
},
122+
{
123+
type: "link",
124+
href: "https://github.com/axios/axios/blob/master/COLLABORATOR_GUIDE.md",
125+
text: "دليل المساهمون",
126+
},
127+
{
128+
type: "link",
129+
href: "https://github.com/axios/axios/blob/master/CONTRIBUTING.md",
130+
text: "مساهمة في أكسيوس"
131+
},
132+
{
133+
type: "link",
134+
href: "/docs/translating",
135+
text: "ترجمة هذه الوثائق"
136+
}
137+
],
138+
};

inert.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const {
1414
halt,
1515
} = inert;
1616

17+
const arConfig = require("./ar.lang.js");
1718
const enConfig = require("./en.lang.js");
1819
const deConfig = require("./de.lang.js");
1920
const zhConfig = require("./zh.lang.js");
@@ -109,6 +110,12 @@ const langs = [
109110
name: "Русский",
110111
prefix: "/ru/",
111112
config: ruConfig
113+
},{
114+
dir: "rtl",
115+
name: "Arabic",
116+
prefix: "/ar/",
117+
postsDir: "ar",
118+
config: arConfig,
112119
},
113120
{
114121
dir: "ltr",

posts/ar/api_intro.md

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: 'أكسيوس إي بي أي'
3+
description: 'المرجع لأكسيوس إي بي أي'
4+
prev_title: 'طلبات بوست'
5+
prev_link: 'ar/docs/post_example'
6+
next_title: 'نموذج الأكسيوس'
7+
next_link: 'ar/docs/instance'
8+
---
9+
10+
يمكن للطلبات أن تمرر التي لها صلة بالإعدادات`axios`.
11+
12+
##### axios(config)
13+
14+
```js
15+
// إرسال طلب بوست
16+
axios({
17+
method: 'post',
18+
url: '/user/12345',
19+
data: {
20+
firstName: 'Fred',
21+
lastName: 'Flintstone'
22+
}
23+
});
24+
```
25+
26+
```js
27+
// طلب غيت لصورة في نود جي إس
28+
axios({
29+
method: 'get',
30+
url: 'http://bit.ly/2mTM3nY',
31+
responseType: 'stream'
32+
})
33+
.then(function (response) {
34+
response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
35+
});
36+
```
37+
38+
##### axios(url[, config])
39+
40+
```js
41+
// إرسال طلب غيت (فونكشن إفتراضي)
42+
axios('/user/12345');
43+
```
44+
45+
### Request method aliases
46+
47+
.قدمت كافة الفونكشن المدهومة لملائمة الاسماء المستعارة
48+
49+
##### axios.request(config)
50+
##### axios.get(url[, config])
51+
##### axios.delete(url[, config])
52+
##### axios.head(url[, config])
53+
##### axios.options(url[, config])
54+
##### axios.post(url[, data[, config]])
55+
##### axios.put(url[, data[, config]])
56+
##### axios.patch(url[, data[, config]])
57+
58+
###### ملاحظة
59+
When using the alias methods `url`, `method`, and `data` properties don't need to be specified in config.
60+
.`data`و `url`, `method` ليس هنالك حاجة لتوصيف الاسماء المستعارة للفونكشنز عند استخدام

posts/ar/cancellation.md

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
title: 'Cancellation'
3+
prev_title: 'Handling Errors'
4+
prev_link: '/docs/handling_errors'
5+
next_title: 'URL-Encoding Bodies'
6+
next_link: '/docs/urlencoded'
7+
---
8+
9+
## AbortController
10+
11+
Starting from `v0.22.0` Axios supports [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to cancel requests in fetch API way:
12+
13+
```js
14+
const controller = new AbortController();
15+
16+
axios.get('/foo/bar', {
17+
signal: controller.signal
18+
}).then(function(response) {
19+
//...
20+
});
21+
// cancel the request
22+
controller.abort()
23+
```
24+
25+
## CancelToken `deprecated`
26+
27+
You can also cancel a request using a *CancelToken*.
28+
29+
> The axios cancel token API is based on the withdrawn [cancelable promises proposal](https://github.com/tc39/proposal-cancelable-promises).
30+
31+
> This API is deprecated since `v0.22.0` and shouldn't be used in new projects
32+
33+
You can create a cancel token using the `CancelToken.source` factory as shown below:
34+
35+
```js
36+
const CancelToken = axios.CancelToken;
37+
const source = CancelToken.source();
38+
39+
axios.get('/user/12345', {
40+
cancelToken: source.token
41+
}).catch(function (thrown) {
42+
if (axios.isCancel(thrown)) {
43+
console.log('Request canceled', thrown.message);
44+
} else {
45+
// handle error
46+
}
47+
});
48+
49+
axios.post('/user/12345', {
50+
name: 'new name'
51+
}, {
52+
cancelToken: source.token
53+
})
54+
55+
// cancel the request (the message parameter is optional)
56+
source.cancel('Operation canceled by the user.');
57+
```
58+
59+
You can also create a cancel token by passing an executor function to the `CancelToken` constructor:
60+
61+
```js
62+
const CancelToken = axios.CancelToken;
63+
let cancel;
64+
65+
axios.get('/user/12345', {
66+
cancelToken: new CancelToken(function executor(c) {
67+
// An executor function receives a cancel function as a parameter
68+
cancel = c;
69+
})
70+
});
71+
72+
// cancel the request
73+
cancel();
74+
```
75+
76+
> Note: you can cancel several requests with the same cancel token / signal.
77+
78+
During the transition period, you can use both cancellation APIs, even for the same request:
79+
80+
```js
81+
const controller = new AbortController();
82+
83+
const CancelToken = axios.CancelToken;
84+
const source = CancelToken.source();
85+
86+
axios.get('/user/12345', {
87+
cancelToken: source.token,
88+
signal: controller.signal
89+
}).catch(function (thrown) {
90+
if (axios.isCancel(thrown)) {
91+
console.log('Request canceled', thrown.message);
92+
} else {
93+
// handle error
94+
}
95+
});
96+
97+
axios.post('/user/12345', {
98+
name: 'new name'
99+
}, {
100+
cancelToken: source.token
101+
})
102+
103+
// cancel the request (the message parameter is optional)
104+
source.cancel('Operation canceled by the user.');
105+
// OR
106+
controller.abort(); // the message parameter is not supported
107+
```

posts/ar/config_defaults.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: 'Config Defaults'
3+
prev_title: 'Response Schema'
4+
prev_link: '/docs/res_schema'
5+
next_title: 'Interceptors'
6+
next_link: '/docs/interceptors'
7+
---
8+
9+
## Config Defaults
10+
11+
You can specify config defaults that will be applied to every request.
12+
13+
### Global axios defaults
14+
15+
```js
16+
axios.defaults.baseURL = 'https://api.example.com';
17+
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
18+
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
19+
```
20+
21+
### Custom instance defaults
22+
23+
```js
24+
// Set config defaults when creating the instance
25+
const instance = axios.create({
26+
baseURL: 'https://api.example.com'
27+
});
28+
29+
// Alter defaults after instance has been created
30+
instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;
31+
```
32+
33+
### Config order of precedence
34+
35+
Config will be merged with an order of precedence. The order is library defaults found in [lib/defaults.js](https://github.com/axios/axios/blob/master/lib/defaults.js#L28), then `defaults` property of the instance, and finally `config` argument for the request. The latter will take precedence over the former. Here's an example.
36+
37+
```js
38+
// Create an instance using the config defaults provided by the library
39+
// At this point the timeout config value is `0` as is the default for the library
40+
const instance = axios.create();
41+
42+
// Override timeout default for the library
43+
// Now all requests using this instance will wait 2.5 seconds before timing out
44+
instance.defaults.timeout = 2500;
45+
46+
// Override timeout for this request as it's known to take a long time
47+
instance.get('/longRequest', {
48+
timeout: 5000
49+
});
50+
```

0 commit comments

Comments
 (0)