From 7bb9b19e77ff61f6d2c170fae67627fc390598bc Mon Sep 17 00:00:00 2001 From: daudix Date: Sun, 16 Jun 2024 04:57:51 +0300 Subject: [PATCH] Make previous commit actually work This is a huge mess, Zola is really not i18n-friendly --- config.toml | 31 ++++++++++++++++++++++- templates/article.html | 18 ++++++------- templates/article_list.html | 10 ++++---- templates/base.html | 12 +++++---- templates/page.html | 2 +- templates/partials/comments.html | 10 ++++---- templates/partials/footer.html | 4 +-- templates/partials/head.html | 4 +-- templates/partials/language_switcher.html | 12 --------- templates/partials/nav.html | 4 +-- templates/taxonomy_list.html | 4 +-- templates/taxonomy_single.html | 6 ++--- 12 files changed, 68 insertions(+), 49 deletions(-) delete mode 100644 templates/partials/language_switcher.html diff --git a/config.toml b/config.toml index b4f1221..80f1555 100644 --- a/config.toml +++ b/config.toml @@ -2,6 +2,7 @@ title = "Duckquill" base_url = "https://daudix.codeberg.page/duckquill" description = "Modern, pretty, and clean theme." +default_language = "en" compile_sass = true minify_html = true generate_feed = true @@ -10,7 +11,35 @@ build_search_index = false author = "Duck Quack" taxonomies = [{ name = "tags", feed = true }] -default_language = "en" + +[translations] +archived = "Archived" +author = "Author" +comments = "Comments" +comments_description = "You can comment on this blog post by publicly replying to this post using a Mastodon or other ActivityPub/Fediverse account. Known non-private replies are displayed below." +comments_loading = "Loading…" +comments_noscript = "Loading comments relies on JavaScript. Try enabling JavaScript and reloading, or visit the original post on Mastodon." +disclaimer = "Disclaimer" +drafted = "Drafted" +feed = "Feed" +file_an_issue = "File an Issue" +filter_by_tag = "Filter by tag" +footer_powered_by = "Powered by" +footer_powered_by_and = "and" +footer_source = "Website source" +go_to_top = "Go to Top" +load_comments = "Load Comments" +newest_to_oldest = "From newest to oldest" +page_next = "Next" +page_previous = "Previous" +posts_in_total = "posts in total" +posts_with_tag = "Posts with tag" +see_all_tags = "See all tags" +skip_to_content = "Skip to main content" +table_of_contents = "Table of Contents" +tags = "Tags" +tags_in_total = "tags in total" +trigger_warning = "Trigger Warning" [languages.ru] title = "Duckquill" diff --git a/templates/article.html b/templates/article.html index 734b675..c7d13ea 100644 --- a/templates/article.html +++ b/templates/article.html @@ -11,7 +11,7 @@ {%- if page.authors %} - {{ trans(key="author", default="Author", lang=lang) }}: {{ page.authors[0] }} + {{ trans(key="author", lang=lang) | default(value="Author") }}: {{ page.authors[0] }} {%- endif %} {%- if page.taxonomies %} {%- for name, taxon in page.taxonomies %} @@ -32,7 +32,7 @@
- {{ trans(key="archived", default="Archived", lang=lang) }} + {{ trans(key="archived", lang=lang) | default(value="Archived") }} {{ page.extra.archive | markdown | safe }}
@@ -42,7 +42,7 @@
- {{ trans(key="trigger_warning", default="Trigger Warning", lang=lang) }} + {{ trans(key="trigger_warning", lang=lang) | default(value="Trigger Warning") }} {{ page.extra.trigger | markdown | safe }}
@@ -52,14 +52,14 @@
- {{ trans(key="disclaimer", default="Disclaimer", lang=lang) }} + {{ trans(key="disclaimer", lang=lang) | default(value="Disclaimer") }} {{ page.extra.disclaimer | markdown | safe }}
{% endif %} {% if page.extra.toc %} -

{{ trans(key="table_of_contents", default="Table of Contents", lang=lang) }}

+

{{ trans(key="table_of_contents", lang=lang) | default(value="Table of Contents") }}