zensical-i18n
Multi-language sites for Zensical, configured like mkdocs-static-i18n.
- One project, many languages – keep translations in
docs/<locale>/folders and build all of them into a single site, with the default language at the root and every other language below/<locale>/. - Language selector – a selector in the header that matches Zensical's modern and classic variants, light and dark color schemes, and takes readers to the same page in the other language when it exists.
- Fallback to the default language – pages that aren't translated yet are taken from the default language and marked with a short notice in the reader's language.
- Translated navigation – titles in
navare translated per language, and each language can override settings likesite_nameorcopyright. - Translated admonitions – default titles of admonitions like
!!! noteare translated, e.g., to "Nota" in Portuguese, out of the box for over 20 languages. - Search engines and LLMs – translations are declared in hreflang sitemaps, untranslated pages point to their originals, and the llms.txt files of all languages link to each other.
Quick start
Install zensical-i18n with:
pip install zensical-i18n
Put the sources of each language in a folder named after its locale. Files outside of locale folders, like images, are shared by all languages:
.
├─ docs/
│ ├─ assets/
│ │ └─ logo.svg
│ ├─ en/
│ │ ├─ index.md
│ │ └─ guide.md
│ └─ pt/
│ └─ index.md
└─ zensical.toml
Each locale folder is treated as the docs root, so docs/pt/index.md links to
assets/logo.svg and guide.md. Then, add the languages to zensical.toml:
[project]
site_name = "Documentation"
site_url = "https://example.com/"
nav = [
{ "Get started" = "index.md" },
{ "Guide" = "guide.md" },
]
[project.plugins.i18n]
[[project.plugins.i18n.languages]]
locale = "en"
name = "English"
default = true
[[project.plugins.i18n.languages]]
locale = "pt"
name = "Português"
site_name = "Documentação"
[project.plugins.i18n.languages.nav_translations]
"Get started" = "Comece aqui"
"Guide" = "Guia"
Build the site with:
zensical-i18n build
This builds site/ with English at the root and Portuguese in site/pt/. As
docs/pt/guide.md doesn't exist, the English guide is used instead, with a
notice that it hasn't been translated yet.
While writing, preview a language with live reload:
zensical-i18n serve --lang pt
Using mkdocs.yml
Projects using mkdocs.yml are supported as well, using the same settings as
mkdocs-static-i18n:
plugins:
- search
- i18n:
docs_structure: folder
languages:
- locale: en
name: English
default: true
- locale: pt
name: Português
site_name: Documentação
nav_translations:
Get started: Comece aqui
Commands
| Command | Description |
|---|---|
zensical-i18n build |
Build all languages into a single site |
zensical-i18n serve |
Build and serve a language with live reload |
Options of zensical-i18n build:
| Option | Description |
|---|---|
-f, --config-file |
Path to the config file |
-c, --clean |
Clean the cache |
-s, --strict |
Abort the build on warnings |
-l, --lang <locale> |
Build only the given language, which can be repeated. The other languages in site/ are left untouched |
Options of zensical-i18n serve:
| Option | Description |
|---|---|
-f, --config-file |
Path to the config file |
-l, --lang <locale> |
Language to serve, instead of the default |
-a, --dev-addr |
IP address and port, e.g. localhost:8000 |
-o, --open |
Open the preview in the default browser |
Settings
Plugin settings:
| Setting | Default | Description |
|---|---|---|
languages |
– | Languages of the project, see below |
docs_structure |
folder |
Only folder is supported |
fallback_to_default |
true |
Use pages of the default language when missing |
reconfigure_theme |
true |
Add the language selector and untranslated page notice. reconfigure_material is supported as an alias |
translate_admonitions |
true |
Use built-in translations for default admonition titles |
Language settings:
| Setting | Description |
|---|---|
locale |
Language tag and folder name, e.g. en, pt-BR or zh_TW. Also sets theme.language, falling back to the primary language, e.g. fr for fr_CA, if the theme has no translations for the locale |
name |
Name shown in the language selector |
default |
Whether this is the default language, built to the site root. Defaults to the first language |
build |
Whether to build the language, defaults to true. Languages that aren't built are still listed in the language selector if they have a link |
link |
Link in the language selector, e.g., to an external site. Must be an http(s) URL or a path |
nav_translations |
Mapping of nav titles to their translations |
admonition_translations |
Mapping of admonition types to their default titles, taking precedence over built-in translations |
untranslated_notice |
Notice on pages that fall back to the default language, with {language} replaced by its name. Plain text, HTML is escaped |
site_name, site_description, site_author, copyright, nav |
Override the project setting |
theme, extra |
Merged into the project setting |
Admonitions
Admonitions without a title get one derived from their type, e.g., "Note"
for !!! note. zensical-i18n translates these default titles for each
language, for all admonition syntaxes (!!!, ??? and ///), while titles
given explicitly are left untouched:
!!! note
Rendered with the title "Nota" in Portuguese.
!!! note "Leia isto"
Rendered with the title "Leia isto".
Built-in translations cover the types of the theme – note, abstract,
info, tip, success, question, warning, failure, danger, bug,
example and quote. Translate other types, or change the built-in
translations, with admonition_translations:
[[project.plugins.i18n.languages]]
locale = "pt"
name = "Português"
[project.plugins.i18n.languages.admonition_translations]
note = "Observação"
todo = "Tarefa"
An explicit title that equals the default title, like !!! note "Note", is
indistinguishable from a default title, and thus translated as well.
Search engines and LLMs
When site_url is set, zensical-i18n makes the translations of a site
discoverable by search engines, crawlers and LLMs:
- hreflang sitemaps – the sitemap of each language lists the
translations of every page, including an
x-defaultpointing to the default language, which search engines treat like hreflang links in the head of pages. - Canonical URLs – pages falling back to the default language are copies of the original, so their canonical URL points to it, avoiding duplicate content. They have no hreflang alternates, but stay in sitemaps, which the theme uses for instant navigation.
- Links without JavaScript – the language selector links to the same page in other languages in the HTML itself, so crawlers follow them.
- llms.txt – with Zensical's
llmstxtplugin enabled, each language gets its own llms.txt, and zensical-i18n adds a "Languages" section linking to the llms.txt of all other languages.
Independent of site_url:
- Language of content – the content of fallback pages is marked with the
language and direction it's written in, e.g.,
lang="en" dir="ltr"on an Arabic site, for screen readers, crawlers and LLMs. - Edit links – "edit this page" links point to the sources of the language, and to the sources of the default language on fallback pages.
- Head links – the theme adds links to the home pages of all languages to the head of every page, which would declare every page a translation of a home page. As sitemaps declare the actual translations, they're removed.
Using with coding agents
This repository has an llms.txt summarizing how to use and configure zensical-i18n, which you can give to your coding agent, and an AGENTS.md for agents working on zensical-i18n itself.
How it works
Zensical doesn't have plugin hooks yet, so zensical-i18n runs Zensical once per language:
- Staging – the sources of each language are mirrored into
.zensical-i18n/docs/<locale>/, layering the language's files over those of the default language and the shared files. - Building – Zensical builds each language in a separate process, with
the language's settings merged in after Zensical has parsed the config file,
so YAML tags,
INHERITand relative paths keep working. Each language has its own cache, so incremental builds stay fast. - Assembling – the outputs are merged into
site_dir, with the default language at the root and all others below their locale.
The language selector reads zensical-i18n.json, a manifest of the pages of
all languages written to each language's root, to keep readers on the same
page while navigating.
Add .zensical-i18n to your .gitignore.
Safety
The site folder is cleaned before the site is written to it, so site_dir
must be a folder within the project, and must not overlap with docs_dir or
.zensical-i18n. Hidden files in it, like .git or .nojekyll, are kept.
zensical-i18n refuses to follow symbolic links in its work folder, and runs
Zensical so that Python files in the project root can't shadow installed
modules.
Limitations
- Only the folder structure is supported, not suffixes like
index.pt.md. - Search covers the language that is currently shown.
servepreviews one language at a time.- The language selector and notice replace the theme's
partials/alternate.htmland wrappartials/content.html. A customalternate.htmlincustom_diris ignored whilereconfigure_themeis enabled.
Contributing
Commit messages follow the format <type>: <summary>, where type is one of
feature, fix, performance, refactor, docs, test, chore, build
or ci. Run the checks with:
uv sync --all-groups
uv run ruff check . && uv run ruff format --check .
uv run ty check .
uv run pytest
Releasing
New versions are released through pull requests:
- Create a branch named
release/v<version>, e.g.,release/v0.2.0. - Bump
versioninpyproject.toml, runuv lock, and commit both with the messagechore: release v<version>– the branch must contain exactly this one commit. - Open a pull request against
master. Once it's merged, the tag, the GitHub release and the upload to PyPI are created automatically.
License
MIT License
Copyright (c) 2026 Humberto Sandmann and contributors
Metadata
Release files for zensical-i18n 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zensical_i18n-0.2.0.tar.gz | 35.2 kB | With provenance | Details for zensical_i18n-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zensical_i18n-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for zensical_i18n-0.2.0-py3-none-any.whl |
Total release size: 84.5 kB
Release files / zensical_i18n-0.2.0.tar.gz
| Download URL | zensical_i18n-0.2.0.tar.gz |
|---|---|
| Size | 35.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e274d377b585b1fb8be908b65925e4e3e7de4280c9c538a0c9b25d0d7de4a2c6
|
|
BLAKE2b-256 checksum How to use checksums |
0bd3e475c623e0c92897603ad62fe303b2913b3c830f590600bbeca011ef8a9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logRelease files / zensical_i18n-0.2.0-py3-none-any.whl
| Download URL | zensical_i18n-0.2.0-py3-none-any.whl |
|---|---|
| Size | 49.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a1b6013e26712fec26df6f6538354433da87c9aff1f96b04ab81bb8e89bff7cf
|
|
BLAKE2b-256 checksum How to use checksums |
4359e113ac5787855176d0d47a35001be48db10d99f697ba8430bb689870cdb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logSecurity for zensical-i18n 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for zensical_i18n-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.