> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/on-premises/ar/aliadadat/overleaf-toolkit/localization.md).

# التعريب

### تهيئة i18 في أوفرليف

{% hint style="info" %}
تشرح هذه الوثيقة كيفية تهيئة التدويل (i18n) لنسخة مستضافة ذاتيًا من **أوفرليف** النسخة.
{% endhint %}

تمت ترجمة أوفرليف إلى عدة لغات. ومع التهيئة المناسبة، يمكنك:

* تشغيل نسخة أوفرليف الخاصة بك بـ **لغة ثابتة واحدة**، أو
* تمكين **عدة لغات**، مما يتيح للمستخدمين تبديل اللغات ديناميكيًا، على غرار `www.overleaf.com`.

***

#### تهيئة لغة واحدة

يتم تهيئة لغة الموقع باستخدام متغير البيئة `OVERLEAF_SITE_LANGUAGE`(أو `SHARELATEX_SITE_LANGUAGE` لإصدارات أوفرليف **4.x وما قبلها**).

تشمل رموز اللغات المدعومة:

* `en` - الإنجليزية (الافتراضية)
* `es` - الإسبانية
* `pt` - البرتغالية
* `de` - الألمانية
* `fr` - الفرنسية
* `cs` - التشيكية
* `nl` - الهولندية
* `sv` - السويدية
* `it` - الإيطالية
* `tr` - التركية
* `zh-CN` - الصينية (المبسطة)
* `no` - النرويجية
* `da` - الدنماركية
* `ru` - الروسية
* `ko` - الكورية
* `ja` - اليابانية
* `pl` - البولندية
* `fi` - الفنلندية

الإنجليزية هي اللغة الافتراضية. لتغيير لغة الواجهة (على سبيل المثال، إلى الصينية المبسطة)، أضف السطر التالي إلى `config/variables.env`:

{% code title="config/variables.env" %}

```bash
OVERLEAF_SITE_LANGUAGE=zh-CN
```

{% endcode %}

ثم طبّق التهيئة:

```bash
bin/up
```

بعد إعادة تشغيل الخدمات، ينبغي أن تعكس لغة الواجهة في قوائم واجهة الويب الإعداد الجديد.

#### تهيئة عدة لغات

لسماح للمستخدمين بـ **تبديل اللغات دون تسجيل الخروج**، يجب تهيئة نسخة أوفرليف لديك لتقديم لغات مختلفة بناءً على أسماء النطاقات.

يفترض هذا القسم ما يلي:

* نطاقك الأساسي هو `overleaftest.com`
* لديك **شهادة TLS شاملة للنطاقات الفرعية** (مثل `*.overleaftest.com`)
* أنت **لا تستخدم `localhost`** (لأنه لا يمكنه دعم توجيه اللغات المستند إلى النطاقات الفرعية)

للاختبار المحلي، يمكنك استخدام نطاق مثل `dev-overleaf.com`.

{% stepper %}
{% step %}

### تهيئة وكيل TLS (Nginx)

يجب على وكيل TLS العكسي تمرير `Host` الترويسة الأصلية حتى يتمكن Overleaf من تحديد نطاق اللغة الذي وصل إليه المستخدم.

تأكد من وجود التوجيه التالي:&#x20;

```nginx
proxy_set_header Host $host;
```

فيما يلي مثال على تهيئة Nginx:&#x20;

<pre class="language-nginx"><code class="lang-nginx">server {
    listen 443 ssl;
    server_name    _; # التقاط الكل، راجع http://nginx.org/en/docs/http/server_names.html
    server_name *.overleaftest.com;
    ssl_certificate /etc/nginx/ssl/nginx.crt;
    ssl_certificate_key /etc/nginx/ssl/nginx.key;
    ssl_protocols               TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers   on;
    # تُستخدم تشفيرات Cloudflare https://github.com/cloudflare/sslconfig/blob/master/conf
    ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;

    # تهيئة لتمكين HSTS (أمان النقل الصارم عبر HTTP) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
    # لتجنب SSL stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_stripping	
    add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
    server_tokens off;
    add_header X-Frame-Options SAMEORIGIN;
    add_header X-Content-Type-Options nosniff;
    client_max_body_size 50M;

    location / {
        proxy_pass http://localhost:5000; # غيّر إلى أي مضيف/منفذ تستمع إليه حاوية Docker.
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_read_timeout 3m;
        proxy_send_timeout 3m;
        
        # أضف هذا إلى إعدادات nginx الخاصة بك
<strong>        proxy_set_header Host $host;
</strong>    }
}
</code></pre>

{% endstep %}

{% step %}

### تهيئة نطاق ملفات تعريف الارتباط

لمنع تسجيل خروج المستخدمين عند تبديل اللغات، يجب مشاركة ملفات تعريف الارتباط عبر النطاقات الفرعية للغات.

أضف السطر التالي إلى `config/variables.env`:

{% code title="config/variables.env" %}

```env
# لاحظ النقطة في البداية
COOKIE_DOMAIN=.overleaftest.com
```

{% endcode %}

يضمن هذا أن ملفات تعريف الارتباط الخاصة بالمصادقة صالحة لجميع النطاقات الفرعية تحت `overleaftest.com`.
{% endstep %}

{% step %}

### ربط اللغة بالنطاق

بعد ذلك، عرّف كيفية ربط رموز اللغات بالنطاقات الفرعية باستخدام\
`OVERLEAF_LANG_DOMAIN_MAPPING`.

#### تهيئة مثال

{% code title="config/variables.env" overflow="wrap" %}

```dotenv
OVERLEAF_LANG_DOMAIN_MAPPING='{"www": {"lngCode": "en","url": "https:\/\/www.overleaftest.com"},"cn": {"lngCode": "zh-CN","url": "https:\/\/cn.overleaftest.com"}}'
```

{% endcode %}

مع هذه التهيئة:

* `https://www.overleaftest.com` → واجهة إنجليزية
* `https://cn.overleaftest.com` → واجهة صينية مبسطة

يمكنك توسيع هذا الربط بإضافة لغات ونطاقات فرعية إضافية حسب الحاجة.
{% endstep %}

{% step %}

### إعادة توجيه النطاق الجذري

أخيرًا، أعد توجيه النطاق الجذري (`overleaftest.com`) إلى نطاق اللغة الافتراضي (`www.overleaftest.com`).

<pre class="language-nginx"><code class="lang-nginx">server{
    listen 80;
    server_name overleaftest.com;
<strong>    return 301 https://www.overleaftest.com$request_uri;
</strong>}

server {
    listen 443 ssl http2;
    server_name overleaftest.com;
    ssl_certificate     /<a data-footnote-ref href="#user-content-fn-1">p</a>ath/to/fullchain.cer;
    ssl_certificate_key /path/to/overleaftest.com.key;
<strong>    return 301 https://www.overleaftest.com$request_uri;
</strong>}
</code></pre>

{% endstep %}
{% endstepper %}

[^1]:


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/on-premises/ar/aliadadat/overleaf-toolkit/localization.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
