Óscar 32a2d5094b
🌐 feat(i18n): overhaul translation system & add languages (#145)
Revamp the existing translation system, simplifying
management and adding several new languages. The new system reads from
TOML files in the `/i18n` directory and improves template structures.
It also enhances customisation options and robustness by providing
fallbacks and modularity.

- Implement a new, streamlined translation macro.
- Load translations from `/i18n` TOML files.
- Remove redundant configuration requirements.
- Refactor templates to align with new i18n system.
- Add support for Hindi, Japanese, Russian, Portuguese, Chinese,
  Italian, German, Ukranian, Korean, and French languages.
- Credit Thomas Weitzel (@thomasweitzel) for inspiration.
2023-09-12 18:58:58 +02:00

38 lines
1.7 KiB
HTML

<header>
<nav class="navbar">
<div class="nav-title">
<a class="home-title" href={{ get_url(path="/", lang=lang) }}>{{ config.title }}</a>
</div>
{%- if config.extra.menu %}
<div class="nav-navs">
<ul>
{%- if config.extra.menu %}
{% for menu in config.extra.menu %}
<li>
{% set trailing_slash = menu.trailing_slash | default(value=true) %}
<a class="nav-links no-hover-padding" href="{{ get_url(path=menu.url, lang=lang, trailing_slash=trailing_slash) }}"/>
{{ macros_translate::translate(key=menu.name, default=menu.name, language_strings=language_strings) }}
</a>
</li>
{% endfor %}
{%- endif -%}
{# Language switcher #}
{# Display the language switcher only if more than one language is available #}
{%- if config.languages | length > 0 %}
{% include "partials/language_switcher.html" %}
{%- endif %}
{# Theme switcher #}
{%- if config.extra.theme_switcher and config.extra.theme_switcher == true -%}
<li class="theme-switcher-wrapper js">
<div class="theme-switcher" title="Toggle dark/light theme"></div>
</li>
{%- endif -%}
</ul>
</div>
{% endif %}
</nav>
</header>