docs/languages-configuration.md
This document explains how to configure and override the available languages in the Docs application.
By default, the application supports the following languages (in priority order):
The default configuration is defined in src/backend/impress/settings.py:
LANGUAGES = values.SingleNestedTupleValue(
(
("en-us", "English"),
("fr-fr", "Français"),
("de-de", "Deutsch"),
("nl-nl", "Nederlands"),
("es-es", "Español"),
)
)
You can override the available languages by setting the DJANGO_LANGUAGES environment variable. This is the recommended approach for customizing language support without modifying the source code.
The DJANGO_LANGUAGES variable expects a semicolon-separated list of language configurations, where each language is defined as code,Display Name:
DJANGO_LANGUAGES=code1,Name1;code2,Name2;code3,Name3
Example 1: English and French only
DJANGO_LANGUAGES=en-us,English;fr-fr,Français
Example 2: Add Italian and Chinese
DJANGO_LANGUAGES=en-us,English;fr-fr,Français;de-de,Deutsch;it-it,Italiano;zh-cn,中文
Example 3: Custom subset of languages
DJANGO_LANGUAGES=fr-fr,Français;de-de,Deutsch;es-es,Español
For local development, you can set the DJANGO_LANGUAGES variable in your environment configuration file:
File: env.d/development/common.local
DJANGO_LANGUAGES=en-us,English;fr-fr,Français;de-de,Deutsch;it-it,Italiano;zh-cn,中文;
For production deployments, add the variable to your production environment configuration:
File: env.d/production.dist/common
DJANGO_LANGUAGES=en-us,English;fr-fr,Français
When using Docker Compose, you can set the environment variable in your compose.yml or compose.override.yml file:
services:
app:
environment:
- DJANGO_LANGUAGES=en-us,English;fr-fr,Français;de-de,Deutsch
language-region (e.g., en-us, fr-fr, de-de)Languages are listed in priority order. The first language in the list is used as the fallback language throughout the application when a specific translation is not available.
Before adding a new language, ensure that:
src/backend/locale/ directoryThe following languages have translation files available in src/backend/locale/:
br_FR - Breton (France)cn_CN - Chinese (China) - Note: Use zh-cn in DJANGO_LANGUAGESde_DE - German (Germany) - Use de-deen_US - English (United States) - Use en-uses_ES - Spanish (Spain) - Use es-esfr_FR - French (France) - Use fr-frit_IT - Italian (Italy) - Use it-itnl_NL - Dutch (Netherlands) - Use nl-nlpt_PT - Portuguese (Portugal) - Use pt-ptru_RU - Russian (Russia) - Use ru-rusl_SI - Slovenian (Slovenia) - Use sl-sisv_SE - Swedish (Sweden) - Use sv-setr_TR - Turkish (Turkey) - Use tr-truk_UA - Ukrainian (Ukraine) - Use uk-uazh_CN - Chinese (China) - Use zh-cnNote: When configuring DJANGO_LANGUAGES, use lowercase with hyphens (e.g., pt-pt, ru-ru) rather than the directory name format.
We use Crowdin to manage translations for the Docs application. Crowdin allows our community to contribute translations and helps maintain consistency across all supported languages.
Want to add a new language or improve existing translations?
If you would like us to support a new language or want to contribute to translations, please get in touch with the project maintainers. We can add new languages to our Crowdin project and coordinate translation efforts with the community.
The application stores the user's language preference in a cookie named docs_language. The cookie path is set to / by default.
After changing the language configuration:
If you add a new language but see untranslated text:
src/backend/locale/<language_code>/LC_MESSAGES/makemessages and compilemessages commands to generate/update translationsLANGUAGE_CODE: Default language code (default: en-us)LANGUAGE_COOKIE_NAME: Cookie name for storing user language preference (default: docs_language)LANGUAGE_COOKIE_PATH: Cookie path (default: /)