Make more strings translatable (I hate how i18n is handled in Zola)

This commit is contained in:
daudix
2024-06-17 07:33:32 +03:00
parent 2abb4d234c
commit dab00bd98c
5 changed files with 34 additions and 14 deletions

View File

@ -13,14 +13,18 @@ author = "Duck Quack"
taxonomies = [{ name = "tags", feed = true }] taxonomies = [{ name = "tags", feed = true }]
[translations] [translations]
anchor_link = "Anchor link for"
archived = "Archived" archived = "Archived"
author = "Author" author = "Author"
blog_post_author = "Blog post author"
boosts_from = "Boosts from"
comments = "Comments" 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_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_loading = "Loading"
comments_noscript = "Loading comments relies on JavaScript. Try enabling JavaScript and reloading, or visit the original post on Mastodon." comments_noscript = "Loading comments relies on JavaScript. Try enabling JavaScript and reloading, or visit the original post on Mastodon."
disclaimer = "Disclaimer" disclaimer = "Disclaimer"
drafted = "Drafted" drafted = "Drafted"
faves_from = "Favorites from"
feed = "Feed" feed = "Feed"
file_an_issue = "File an Issue" file_an_issue = "File an Issue"
filter_by_tag = "Filter by tag" filter_by_tag = "Filter by tag"
@ -40,6 +44,8 @@ table_of_contents = "Table of Contents"
tags = "Tags" tags = "Tags"
tags_in_total = "tags in total" tags_in_total = "tags in total"
trigger_warning = "Trigger Warning" trigger_warning = "Trigger Warning"
view_comment = "View comment at"
view_profile = "View profile at"
[languages.ru] [languages.ru]
title = "Duckquill" title = "Duckquill"
@ -49,14 +55,18 @@ generate_feed = true
taxonomies = [{ name = "tags", feed = true }] taxonomies = [{ name = "tags", feed = true }]
[languages.ru.translations] [languages.ru.translations]
anchor_link = "Якорная ссылка для"
archived = "Архивировано" archived = "Архивировано"
author = "Автор" author = "Автор"
blog_post_author = "Автор блог-поста"
boosts_from = "Продвижения с"
comments = "Комментарии" comments = "Комментарии"
comments_description = "Вы можете оставить комментарий к этому блог-посту, публично ответив на него с помощью аккаунта Mastodon или другого аккаунта ActivityPub/Fediverse. Известные неприватные ответы отображены ниже." comments_description = "Вы можете оставить комментарий к этому блог-посту, публично ответив на него с помощью аккаунта Mastodon или другого аккаунта ActivityPub/Fediverse. Известные неприватные ответы отображены ниже."
comments_loading = "Загрузка…" comments_loading = "Загрузка…"
comments_noscript = "Загрузка комментариев зависит от JavaScript. Попробуйте включить JavaScript и перезагрузить, или посетите оригинальный пост на Mastodon." comments_noscript = "Загрузка комментариев зависит от JavaScript. Попробуйте включить JavaScript и перезагрузить, или посетите оригинальный пост на Mastodon."
disclaimer = "Дисклеймер" disclaimer = "Дисклеймер"
drafted = "Черновик" drafted = "Черновик"
faves_from = "Избранное с"
feed = "Лента" feed = "Лента"
file_an_issue = "Отправить Отчет об Ошибке" file_an_issue = "Отправить Отчет об Ошибке"
filter_by_tag = "Фильтр по тегам" filter_by_tag = "Фильтр по тегам"
@ -76,6 +86,8 @@ table_of_contents = "Оглавление"
tags = "Теги" tags = "Теги"
tags_in_total = "тегов в общем" tags_in_total = "тегов в общем"
trigger_warning = "Предупреждение о Тревоге" trigger_warning = "Предупреждение о Тревоге"
view_comment = "Показать комментарий на"
view_profile = "Показать профиль на"
[markdown] [markdown]
highlight_code = true highlight_code = true

View File

@ -1 +1 @@
<a class="zola-anchor" href="#{{ id }}" aria-label="Anchor link for: {{ id }}"><i class="icon"></i></a> <a class="zola-anchor" href="#{{ id }}" aria-label="{{ trans(key="anchor_link", lang=lang) }}: {{ id }}"><i class="icon"></i></a>

View File

@ -24,7 +24,9 @@
<p>{{ trans(key="comments_description", lang=lang) }}</p> <p>{{ trans(key="comments_description", lang=lang) }}</p>
<p> <p>
<a id="load-comments" class="inline-button" onclick="loadComments()" onkeypress="loadComments()" tabindex="0">{{ trans(key="load_comments", lang=lang) }}</a> <a id="load-comments" class="inline-button" onclick="loadComments()" onkeypress="loadComments()" tabindex="0">
{{ trans(key="load_comments", lang=lang) }}
</a>
</p> </p>
<div id="comments-wrapper"> <div id="comments-wrapper">
@ -68,7 +70,7 @@
function loadComments() { function loadComments() {
let commentsWrapper = document.getElementById("comments-wrapper"); let commentsWrapper = document.getElementById("comments-wrapper");
document.getElementById("load-comments").innerHTML = "{{ trans(key='comments_loading', lang=lang) }}"; document.getElementById("load-comments").innerHTML = "{{ trans(key='comments_loading', lang=lang) }}";
fetch("https://{{ host }}/api/v1/statuses/{{ id }}/context") fetch("https://{{ host }}/api/v1/statuses/{{ id }}/context")
.then(function (response) { .then(function (response) {
return response.json(); return response.json();
@ -143,7 +145,7 @@
avatar.setAttribute("rel", "external nofollow"); avatar.setAttribute("rel", "external nofollow");
avatar.setAttribute( avatar.setAttribute(
"title", "title",
`View profile at @${status.account.username}@${instance}` `{{ trans(key="view_profile", lang=lang) }} @${status.account.username}@${instance}`
); );
avatar.appendChild(avatarPicture); avatar.appendChild(avatarPicture);
@ -171,7 +173,7 @@
let permalink = document.createElement("a"); let permalink = document.createElement("a");
permalink.setAttribute("href", status.url); permalink.setAttribute("href", status.url);
permalink.setAttribute("itemprop", "url"); permalink.setAttribute("itemprop", "url");
permalink.setAttribute("title", `View comment at ${instance}`); permalink.setAttribute("title", `{{ trans(key="view_comment", lang=lang) }} ${instance}`);
permalink.setAttribute("rel", "external nofollow"); permalink.setAttribute("rel", "external nofollow");
permalink.textContent = new Date( permalink.textContent = new Date(
status.created_at status.created_at
@ -193,7 +195,7 @@
let boosts = document.createElement("a"); let boosts = document.createElement("a");
boosts.className = "boosts"; boosts.className = "boosts";
boosts.setAttribute("href", `${status.url}/reblogs`); boosts.setAttribute("href", `${status.url}/reblogs`);
boosts.setAttribute("title", `Boosts from ${instance}`); boosts.setAttribute("title", `{{ trans(key="boosts_from", lang=lang) }} ${instance}`);
let boostsIcon = document.createElement("i"); let boostsIcon = document.createElement("i");
boostsIcon.className = "icon"; boostsIcon.className = "icon";
@ -204,7 +206,7 @@
let faves = document.createElement("a"); let faves = document.createElement("a");
faves.className = "faves"; faves.className = "faves";
faves.setAttribute("href", `${status.url}/favourites`); faves.setAttribute("href", `${status.url}/favourites`);
faves.setAttribute("title", `Favorites from ${instance}`); faves.setAttribute("title", `{{ trans(key="faves_from", lang=lang) }} ${instance}`);
let favesIcon = document.createElement("i"); let favesIcon = document.createElement("i");
favesIcon.className = "icon"; favesIcon.className = "icon";
@ -229,13 +231,13 @@
avatar.classList.add("op"); avatar.classList.add("op");
avatar.setAttribute( avatar.setAttribute(
"title", "title",
"Blog post author; " + avatar.getAttribute("title") "{{ trans(key="blog_post_author", lang=lang) }}: " + avatar.getAttribute("title")
); );
instanceBadge.classList.add("op"); instanceBadge.classList.add("op");
instanceBadge.setAttribute( instanceBadge.setAttribute(
"title", "title",
"Blog post author: " + instanceBadge.getAttribute("title") "{{ trans(key="blog_post_author", lang=lang) }}: " + instanceBadge.getAttribute("title")
); );
} }

View File

@ -1,11 +1,15 @@
<footer id="site-footer"> <footer id="site-footer">
{% if config.extra.footer.show_copyright %} {% if config.extra.footer.show_copyright %}
<p title="Last built at {{ now() | date(format='%F %a %R') }}">&copy; {{ config.title }}, {{ now() | date(format="%Y") }}</p> <p title="Last built at {{ now() | date(format='%F %a %R') }}">
&copy; {{ config.title }}, {{ now() | date(format="%Y") }}
</p>
{% endif %} {% endif %}
{% if config.extra.source_url and config.extra.footer.show_source %} {% if config.extra.source_url and config.extra.footer.show_source %}
<p> <p>
<a href="{{ config.extra.source_url }}">{{ trans(key='footer_source', lang=lang) }}</a> <a href="{{ config.extra.source_url }}">
{{ trans(key='footer_source', lang=lang) }}
</a>
</p> </p>
{% endif %} {% endif %}

View File

@ -26,7 +26,9 @@
{% if config.extra.goatcounter %} {% if config.extra.goatcounter %}
<script data-goatcounter="https://{{ config.extra.goatcounter.user }}.{{ config.extra.goatcounter.host | default(value='goatcounter.com') }}/count" async src="//gc.zgo.at/count.js"></script> <script data-goatcounter="https://{{ config.extra.goatcounter.user }}.{{ config.extra.goatcounter.host | default(value='goatcounter.com') }}/count" async src="//gc.zgo.at/count.js"></script>
<noscript><img src="https://{{ config.extra.goatcounter.user }}.{{ config.extra.goatcounter.host | default(value='goatcounter.com') }}/count?p={{ current_path | default(value='/') | safe }}"></noscript> <noscript>
<img src="https://{{ config.extra.goatcounter.user }}.{{ config.extra.goatcounter.host | default(value='goatcounter.com') }}/count?p={{ current_path | default(value='/') | safe }}" />
</noscript>
{% endif %} {% endif %}
{% if config.extra.show_copy_button %} {% if config.extra.show_copy_button %}
@ -55,7 +57,7 @@
{% if config.generate_feed %} {% if config.generate_feed %}
{% block feed -%} {% block feed -%}
<link rel="alternate" type={% if config.feed_filename == "atom.xml" %}"application/atom+xml"{% else %}"application/rss+xml"{% endif %} title="{{ config.title }}" href="{{ get_url(path=config.feed_filename) | safe }}"> <link rel="alternate" type={% if config.feed_filename == "atom.xml" %}"application/atom+xml"{% else %}"application/rss+xml"{% endif %} title="{{ config.title }}" href="{{ get_url(path=config.feed_filename) | safe }}" />
{% endblock -%} {% endblock -%}
{% endif %} {% endif %}