diff --git a/templates/index.html b/templates/index.html index 02bd89f..44f4ed0 100644 --- a/templates/index.html +++ b/templates/index.html @@ -18,7 +18,7 @@ {# TAXONOMY PROBLEM (not needed with Zola > 10.1) need to check if lang exists, do not display anything otherwise #} {% if lang %} {% if config.extra.header and config.extra.header != "disabled" %}{# TAXONOMY: no lang here #} - {% set header = get_page(path=widgets::i18n_path(path=config.extra.header, lang=lang)) %} + {% set header = get_page(path=widgets::i18n_path(path=config.extra.header)) %} {{ header.content | markdown | safe }} {% elif config.extra.header != "disabled" %}

Welcome to water theme!

@@ -53,7 +53,7 @@ {% set cur_path = section.relative_path|default(value=page.relative_path|default(value="")) %} {% if config.extra.forge and cur_path %} diff --git a/templates/page.html b/templates/page.html index eda3905..f6dd217 100644 --- a/templates/page.html +++ b/templates/page.html @@ -7,7 +7,7 @@

{{ page.title }}

- {%- if page.date -%}{%- endif -%} + {%- if page.date -%}{%- endif -%}
{{ page.content | safe }}
diff --git a/templates/widgets.html b/templates/widgets.html index e879fee..e23befe 100644 --- a/templates/widgets.html +++ b/templates/widgets.html @@ -91,18 +91,18 @@ Separate entries with a thematic break: {% set pages = cur_paginator.pages| default(value=cur_section.pages) %} {% if pages|length < 1 %} -

{{ trans(key="nothing_yet", lang=lang) }}

+

{{ self::t(key="nothing_yet") }}

{% endif %} {% for page in pages %}

{{ page.title }}

- {%- if page.date -%}{%- endif -%} + {%- if page.date -%}{%- endif -%}
{% if page.summary %}
{{ page.summary | markdown | safe }} - --> {{ trans(key="readmore", lang=lang) }} <-- + --> {{ self::t(key="readmore") }} <--
{% elif full_articles %}
@@ -114,12 +114,19 @@ Separate entries with a thematic break: {% if cur_paginator and cur_paginator.number_pagers > 1 %} {% endif %} {% endmacro section %} + +{# Translate a string in the current language (lang) by looking +up a key in the config.extra.translations.lang. These translation +strings extend (and potentially replace) those of the theme. #} +{%- macro t(key) -%} +{{ config.extra.translations[lang][key] }} +{%- endmacro t -%} diff --git a/theme.toml b/theme.toml index 5cf918a..fd5413a 100644 --- a/theme.toml +++ b/theme.toml @@ -64,14 +64,14 @@ author = "kognise" homepage = "https://kognise.github.io/water.css/" repo = "https://github.com/kognise/water.css" -[translations.fr] +[extra.translations.fr] source = "Source de cette page" readmore = "Lire la suite" previousPage = "Page précédente" nextPage = "Page suivante" dateFormat = "%d/%m/%Y" nothing_yet = "Il n'y a pas encore d'article dans cette section." -[translations.en] +[extra.translations.en] source = "Source for this page" readmore = "Read more" previousPage = "Previous page"