Overleaf i18 Configuration
This document describes how to configure internationalization (i18n) for a self-hosted Overleaf instance.
- Run your Overleaf instance in a single fixed language, or
- Enable multiple languages, allowing users to switch languages dynamically, similar to
www.overleaf.com.
Single Language Configuration
The site language is configured using the environment variableOVERLEAF_SITE_LANGUAGE.
Supported language codes include:
en- English (default)es- Spanishpt- Portuguesede- Germanfr- Frenchcs- Czechnl- Dutchsv- Swedishit- Italiantr- Turkishzh-CN- Chinese (simplified)no- Norwegianda- Danishru- Russianko- Koreanja- Japanesepl- Polishfi- Finnish
config/variables.env:
config/variables.env
Multiple Language Configuration
To allow users to switch languages without logging out, your Overleaf instance must be configured to serve different languages based on domain names. This section assumes:- Your primary domain is
overleaftest.com - You have a wildcard TLS certificate (e.g.
*.overleaftest.com) - You are not using
localhost(since it cannot support subdomain-based language routing)
dev-overleaf.com.
1
TLS Proxy Configuration (Nginx)
Your TLS reverse proxy must forward the original Here is an example Nginx configuration:
Host header so that Overleaf can determine which language domain the user accessed.Make sure the following directive is present:2
Configure Cookie Domain
To prevent users from being logged out when switching languages, cookies must be shared across language subdomains.Add the following line to This ensures that authentication cookies are valid for all subdomains under
config/variables.env:config/variables.env
overleaftest.com.3
Language–Domain Mapping
Next, define how language codes map to subdomains using
With this configuration:
OVERLEAF_LANG_DOMAIN_MAPPING.Example Configuration
config/variables.env
https://www.overleaftest.com→ English interfacehttps://cn.overleaftest.com→ Simplified Chinese interface
4
Redirect the Apex Domain
Finally, redirect the apex domain (
overleaftest.com) to the default language domain (www.overleaftest.com).Q&A
Why does a language in the picker open http://127.0.0.1:3000?
Why does a language in the picker open http://127.0.0.1:3000?
Answer:
OVERLEAF_LANG_DOMAIN_MAPPING has no www key. The mapping is merged into the default one, which has a www entry for English with the internal address http://127.0.0.1:3000. If your mapping uses other keys only, such as cn and en, that default entry is kept and shows up in the picker.Add a www key with the address of OVERLEAF_SITE_URL, and drop a second entry for the same language, then run bin/up -d:
