Locales and Site Language
TeqCMS supports multilingual websites with user language detection and fallback mechanisms. All locales are configured in the settings and work at the URL level.
1. Locale Detection
The user's locale is determined by the following priority:
- URL prefix —
/en/
,/ru/
, etc. Accept-Language
header — if no prefix is specified- Default locale —
localeBaseDisplay
parameter
If the URL doesn't contain a valid prefix, the CMS automatically redirects the user to the path with the base locale.
2. Configuring Available Locales
Locales are specified via environment variables:
TEQ_CMS_LOCALE_ALLOWED=en,ru,fr
Base locale for display:
TEQ_CMS_LOCALE_BASE_DISPLAY=en
Base locale for translations (e.g., original texts in Russian):
TEQ_CMS_LOCALE_BASE_TRANSLATE=ru
3. Template Directories
A subdirectory is created for each locale:
tmpl/web/
├── en/
│ └── index.html
├── ru/
│ └── index.html
If the required file is missing in the target locale, the CMS uses the version from localeBaseDisplay
.
4. Switching Locales on the Site
To switch languages, you can use a selector with links to /en
, /ru
, etc.
The CMS always renders pages according to the URL locale, making the behavior clear and predictable.