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(or SHARELATEX_SITE_LANGUAGE for Overleaf versions 4.x and earlier).
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).
