Skip to content

Language

With the help of contributors, templates are localized into more than 60 languages, making it easy to create documentation sites in your preferred language.

Configuration

Site language

You can set the site language in your configuration file with:

[project.theme]
language = "en"
theme:
  language: en

HTML5 only allows to set a single language per document, which is why Zensical only supports setting a canonical language for the entire project.

The following languages are supported:

  1. 🇿🇦 Afrikaans af Complete
  2. 🇦🇱 Albanian sq Complete
  3. 🇦🇪 Arabic ar Complete
  4. 🇦🇲 Armenian hy Complete
  5. 🇦🇿 Azerbaijani az Complete
  6. 🇲🇾 Bahasa Malaysia ms Complete
  7. 🇪🇸 Basque eu Complete
  8. 🇧🇾 Belarusian be Complete
  9. 🇧🇩 Bengali (Bangla) bn Complete
  10. 🇧🇬 Bulgarian bg Complete
  11. 🇪🇸 Catalan ca Complete
  12. 🇨🇳 Chinese (Simplified) zh Complete
  13. 🇹🇼 Chinese (Taiwanese) zh-TW Complete
  14. 🇨🇳 Chinese (Traditional) zh-Hant Complete
  15. 🇭🇷 Croatian hr Complete
  16. 🇨🇿 Czech cs Complete
  17. 🇩🇰 Danish da Complete
  18. 🇳🇱 Dutch nl Complete
  19. 🇺🇸 English en Complete
  20. 🇪🇺 Esperanto eo Complete
  21. 🇪🇪 Estonian et Complete
  22. 🇫🇮 Finnish fi Complete
  23. 🇫🇷 French fr Complete
  24. 🇪🇸 Galician gl Complete
  25. 🇩🇪 German de Complete
  26. 🇬🇷 Greek el Complete
  27. 🇮🇱 Hebrew he Complete
  28. 🇮🇳 Hindi hi Complete
  29. 🇭🇺 Hungarian hu Complete
  30. 🇮🇸 Icelandic is Complete
  31. 🇮🇩 Indonesian id Complete
  32. 🇮🇹 Italian it Complete
  33. 🇯🇵 Japanese ja Complete
  34. 🇮🇳 Kannada kn Complete
  35. 🇰🇷 Korean ko Complete
  36. 🇮🇶 Kurdish (Soranî) ku-IQ 13 translations missing
  37. 🇱🇻 Latvian lv Complete
  38. 🇱🇹 Lithuanian lt Complete
  39. 🇱🇺 Luxembourgish lb Complete
  40. 🇲🇰 Macedonian mk Complete
  41. 🇲🇳 Mongolian mn Complete
  42. 🇳🇴 Norwegian Bokmål nb Complete
  43. 🇳🇴 Norwegian Nynorsk nn Complete
  44. 🇮🇷 Persian (Farsi) fa Complete
  45. 🇵🇱 Polish pl Complete
  46. 🇵🇹 Portuguese pt Complete
  47. 🇧🇷 Portuguese (Brasilian) pt-BR Complete
  48. 🇷🇴 Romanian ro Complete
  49. 🇷🇺 Russian ru Complete
  50. 🇮🇳 Sanskrit sa Complete
  51. 🇷🇸 Serbian sr Complete
  52. 🇷🇸 Serbo-Croatian sh Complete
  53. 🇸🇰 Slovak sk Complete
  54. 🇸🇮 Slovenian sl Complete
  55. 🇪🇸 Spanish es Complete
  56. 🇸🇪 Swedish sv Complete
  57. 🇮🇳 Tamil ta Complete
  58. 🇮🇳 Telugu te Complete
  59. 🇹🇭 Thai th Complete
  60. 🇹🇷 Turkish tr Complete
  61. 🇺🇦 Ukrainian uk Complete
  62. 🇵🇰 Urdu ur Complete
  63. 🇺🇿 Uzbek uz Complete
  64. 🇻🇳 Vietnamese vi Complete
  65. 🏴󠁧󠁢󠁷󠁬󠁳󠁿 Welsh cy Complete

Site language selector

If your documentation is available in multiple languages, a language selector pointing to those languages can be added to the header. Alternate languages can be defined via configuration:

[project.extra]
alternate = [
  { name = "English", link = "/en/", lang = "en" },
  { name = "Deutsch", link = "/de/", lang = "de" },
]
extra:
  alternate:
    - name: English
      link: /en/ # (1)!
      lang: en
    - name: Deutsch
      link: /de/
      lang: de

The following properties are required for each alternate language:

alternate.name

This value of this property is used inside the language selector as the name of the language and must be set to a non-empty string.

alternate.link

This property must be set to an absolute link, which might also point to another domain or subdomain not necessarily generated with Zensical. If it includes a domain part, it's used as defined. Otherwise the domain part of the site_url as set in your configuration is prepended to the link.

alternate.lang

This property must contain an ISO 639-1 language code and is used for the hreflang attribute of the link, improving discoverability via search engines.

Directionality

While many languages are read ltr (left-to-right), Zensical also supports rtl (right-to-left) directionality which is deduced from the selected language, but can also be set with:

[project.theme]
direction = "ltr"
theme:
  direction: ltr

Click on a tile to change the directionality:

Customization

Custom translations

If you want to customize some of the translations for a language, just follow the guide on theme extension and create a new partial in the overrides folder. Then, import the translations of the language as a fallback and only adjust the ones you want to override:

<!-- Import translations for language and fallback -->
{% import "partials/languages/de.html" as language %}
{% import "partials/languages/en.html" as fallback %} <!-- (1)! -->

<!-- Define custom translations -->
{% macro override(key) %}{{ {
  "source.file.date.created": "Erstellt am", <!-- (2)! -->
  "source.file.date.updated": "Aktualisiert am"
}[key] }}{% endmacro %}

<!-- Re-export translations -->
{% macro t(key) %}{{
  override(key) or language.t(key) or fallback.t(key)
}}{% endmacro %}
  1. Note that en must always be used as a fallback language, as it's the default theme language.

  2. Check the list of available languages, pick the translation you want to override for your language and add them here.

[project.theme]
language = "custom"
theme:
  language: custom