> 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/it/configurazione/overleaf-toolkit/localization.md).

# Localizzazione

### Configurazione i18n di Overleaf

{% hint style="info" %}
Questo documento descrive come configurare l'internazionalizzazione (i18n) per un'istanza self-hosted di **Overleaf** .
{% endhint %}

Overleaf è stato tradotto in più lingue. Con la configurazione appropriata, puoi:

* Esegui la tua istanza di Overleaf in **una singola lingua fissa**, oppure
* Abilita **più lingue**, consentendo agli utenti di cambiare lingua dinamicamente, come su `www.overleaf.com`.

***

#### Configurazione a lingua singola

La lingua del sito è configurata usando la variabile d'ambiente `OVERLEAF_SITE_LANGUAGE`(o `SHARELATEX_SITE_LANGUAGE` per le versioni di Overleaf **4.x e precedenti**).

I codici lingua supportati includono:

* `en` - Inglese (predefinito)
* `es` - Spagnolo
* `pt` - Portoghese
* `de` - Tedesco
* `fr` - Francese
* `cs` - Ceco
* `nl` - Olandese
* `sv` - Svedese
* `it` - Italiano
* `tr` - Turco
* `zh-CN` - Cinese (semplificato)
* `no` - Norvegese
* `da` - Danese
* `ru` - Russo
* `ko` - Coreano
* `ja` - Giapponese
* `pl` - Polacco
* `fi` - Finlandese

L'inglese è la lingua predefinita. Per cambiare la lingua dell'interfaccia (ad esempio, in cinese semplificato), aggiungi la seguente riga a `config/variables.env`:

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

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

{% endcode %}

Poi applica la configurazione:

```bash
bin/up
```

Dopo il riavvio dei servizi, la lingua dell'interfaccia nei menu della web UI dovrebbe riflettere la nuova impostazione.

#### Configurazione multilingue

Per consentire agli utenti di **cambiare lingua senza disconnettersi**, la tua istanza di Overleaf deve essere configurata per servire lingue diverse in base ai nomi di dominio.

Questa sezione presuppone:

* Il tuo dominio principale è `overleaftest.com`
* Hai un **certificato TLS wildcard** (ad es. `*.overleaftest.com`)
* Stai **non usando `localhost`** (poiché non può supportare il routing della lingua basato su sottodomini)

Per i test locali, puoi usare un dominio come `dev-overleaf.com`.

{% stepper %}
{% step %}

### Configurazione del proxy TLS (Nginx)

Il tuo reverse proxy TLS deve inoltrare l'originale `Host` header, affinché Overleaf possa determinare a quale dominio linguistico ha avuto accesso l'utente.

Assicurati che sia presente la seguente direttiva:&#x20;

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

Ecco un esempio di configurazione Nginx:&#x20;

<pre class="language-nginx"><code class="lang-nginx">server {
    listen 443 ssl;
    server_name    _; # catch-all, vedi 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;
    # usa i cifrari di 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;

    # configurazione per abilitare HSTS (HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
    # per evitare 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; # modifica in base all'host/porta su cui è in ascolto il contenitore 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;
        
        # aggiungilo alla tua configurazione nginx
<strong>        proxy_set_header Host $host;
</strong>    }
}
</code></pre>

{% endstep %}

{% step %}

### Configura il dominio dei cookie

Per evitare che gli utenti vengano disconnessi quando cambiano lingua, i cookie devono essere condivisi tra i sottodomini linguistici.

Aggiungi la seguente riga a `config/variables.env`:

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

```env
# Nota il punto iniziale
COOKIE_DOMAIN=.overleaftest.com
```

{% endcode %}

Questo assicura che i cookie di autenticazione siano validi per tutti i sottodomini sotto `overleaftest.com`.
{% endstep %}

{% step %}

### Mappatura lingua-dominio

Successivamente, definisci come i codici lingua si mappano sui sottodomini usando\
`OVERLEAF_LANG_DOMAIN_MAPPING`.

#### Configurazione di esempio

{% 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 %}

Con questa configurazione:

* `https://www.overleaftest.com` → interfaccia inglese
* `https://cn.overleaftest.com` → interfaccia cinese semplificata

Puoi estendere questa mappatura con altre lingue e sottodomini secondo necessità.
{% endstep %}

{% step %}

### Reindirizza il dominio apex

Infine, reindirizza il dominio apex (`overleaftest.com`) al dominio della lingua predefinita (`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/it/configurazione/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.
