> For the complete documentation index, see [llms.txt](https://ayakaleaf-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://ayakaleaf-pro.ayaka.space/on-premises/ja/she-ding/overleaf-toolkit/localization.md).

# ローカリゼーション

### Overleaf i18n 設定

{% hint style="info" %}
このドキュメントでは、セルフホスト版の国際化（i18n）を設定する方法を説明します **Overleaf** インスタンス。
{% endhint %}

Overleaf は複数の言語に翻訳されています。適切に設定することで、次のことができます：

* Overleaf インスタンスを **単一の固定言語で**、または
* 有効にする **複数言語**を有効にし、ユーザーが動的に言語を切り替えられるようにする。これは次と同様です： `www.overleaf.com`.

***

#### 単一言語構成

サイトの言語は、環境変数を使用して設定します `OVERLEAF_SITE_LANGUAGE`（または `SHARELATEX_SITE_LANGUAGE` Overleaf のバージョン **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
```

サービスの再起動後、Web UI のメニューに表示されるインターフェース言語が新しい設定に反映されるはずです。

#### 複数言語構成

ユーザーが **ログアウトせずに言語を切り替えられるようにするには**、Overleaf インスタンスをドメイン名に基づいて異なる言語を提供するように設定する必要があります。

このセクションでは、次の前提を置きます：

* メインドメインは `overleaftest.com`
* 次のものを用意していること： **ワイルドカード TLS 証明書** （例： `*.overleaftest.com`)
* あなたは **使用していない `localhost`** （サブドメインベースの言語ルーティングをサポートできないため）

ローカルテストでは、次のようなドメインを使用できます： `dev-overleaf.com`.

{% stepper %}
{% step %}

### TLS プロキシ設定（Nginx）

TLS リバースプロキシは元の `Host` ヘッダーを転送して、Overleaf がユーザーがアクセスした言語ドメインを判定できるようにする必要があります。

次のディレクティブが存在することを確認してください：

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

以下は Nginx 設定の例です：

<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 Strict Transport Security）を有効にする設定 https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
    # SSL ストリッピングを避けるため 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 %}

### Cookie ドメインの設定

言語を切り替えてもユーザーがログアウトされないようにするには、Cookie を言語サブドメイン間で共有する必要があります。

次の行を追加してください `config/variables.env`:

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

```env
# 先頭のドットに注意
COOKIE_DOMAIN=.overleaftest.com
```

{% endcode %}

これにより、次の下にあるすべてのサブドメインで認証 Cookie が有効になります `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     /path/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 %}


---

# 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://ayakaleaf-pro.ayaka.space/on-premises/ja/she-ding/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.
