From 13448cb567c0e8536a77bea113ba5c775560c37d Mon Sep 17 00:00:00 2001 From: Awiteb Date: Wed, 14 Feb 2024 00:28:43 +0300 Subject: [PATCH] Update `translate` macro call for plural forms translates --- templates/page.html | 2 +- templates/partials/search_modal.html | 6 ++++++ templates/tags/list.html | 18 +++++------------- templates/taxonomy_list.html | 18 ++++-------------- 4 files changed, 16 insertions(+), 28 deletions(-) diff --git a/templates/page.html b/templates/page.html index 0256016f9..4ee8a3c8d 100644 --- a/templates/page.html +++ b/templates/page.html @@ -99,7 +99,7 @@

{# page settings override config settings #} {% if macros_settings::evaluate_setting_priority(setting="show_reading_time", page=page, default_global_value=true) == "true" %} - {{ separator }}
  • {{ macros_translate::translate(key="min_read", number=page.reading_time, default=page.reading_time ~ " min read", language_strings=language_strings) }}
  • + {{ separator }}
  • {{ macros_translate::translate(key="min_read", number=page.reading_time, default=page.reading_time ~ " min read", language_strings=language_strings) }}
  • {% endif %} {%- if page.taxonomies and page.taxonomies.tags -%} diff --git a/templates/partials/search_modal.html b/templates/partials/search_modal.html index 2bca8eda0..3b995511e 100644 --- a/templates/partials/search_modal.html +++ b/templates/partials/search_modal.html @@ -15,6 +15,12 @@

    {{ macros_translate::translate(key='
    +
    0 {{ macros_translate::translate(key='result', default='result', language_strings=language_strings) }} {{ macros_translate::translate(key='results', default='results', language_strings=language_strings) }} diff --git a/templates/tags/list.html b/templates/tags/list.html index a42dc5026..2d98f2b29 100644 --- a/templates/tags/list.html +++ b/templates/tags/list.html @@ -16,23 +16,15 @@ + {{- macros_translate::translate(key="posts", number=length, default="posts", language_strings=language_strings) -}} + "> {{ term.name }} {{ term.pages | length }} {% else %} - {{ term.name }} - – {{ term.pages | length }}{%- if term.pages | length == 1 %} - {# Only one post. Singular. #} - {{- macros_translate::translate(key="post", default="post", language_strings=language_strings) -}} - {% elif term.pages | length > 1 %} - {# More than one post per tag. Plural. #} - {{- macros_translate::translate(key="posts", default="posts", language_strings=language_strings) -}} - {%- endif -%} + {{ term.name }} + + {{- macros_translate::translate(key="posts", number=term.pages | length, default="posts", language_strings=language_strings) -}} {% endif %} {%- endfor -%} diff --git a/templates/taxonomy_list.html b/templates/taxonomy_list.html index 7eb4923e0..d87930ec8 100644 --- a/templates/taxonomy_list.html +++ b/templates/taxonomy_list.html @@ -15,24 +15,14 @@ {# Shows the number of posts per tag as a superscript #} - {{ term.name }} + {{- macros_translate::translate(key="posts", number=length, default="posts", language_strings=language_strings) -}} + {{ term.name }} {{ term.pages | length }} {% else %} {{ term.name }} - – {{ term.pages | length }}{%- if term.pages | length == 1 %} - {# Only one post. Singular. #} - {{- macros_translate::translate(key="post", default="post", language_strings=language_strings) -}} - {% elif term.pages | length > 1 %} - {# More than one post per tag. Plural. #} - {{- macros_translate::translate(key="posts", default="posts", language_strings=language_strings) -}} - {%- endif -%} + – {{ term.pages | length }} + {{- macros_translate::translate(key="posts", number=length, default="posts", language_strings=language_strings) -}} {% endif %} {%- endfor -%}