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 }]
[translations]
anchor_link = "Anchor link for"
archived = "Archived"
author = "Author"
blog_post_author = "Blog post author"
boosts_from = "Boosts from"
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_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"
faves_from = "Favorites from"
feed = "Feed"
file_an_issue = "File an Issue"
filter_by_tag = "Filter by tag"
@ -40,6 +44,8 @@ table_of_contents = "Table of Contents"
tags = "Tags"
tags_in_total = "tags in total"
trigger_warning = "Trigger Warning"
view_comment = "View comment at"
view_profile = "View profile at"
[languages.ru]
title = "Duckquill"
@ -49,14 +55,18 @@ generate_feed = true
taxonomies = [{ name = "tags", feed = true }]
[languages.ru.translations]
anchor_link = "Якорная ссылка для"
archived = "Архивировано"
author = "Автор"
blog_post_author = "Автор блог-поста"
boosts_from = "Продвижения с"
comments = "Комментарии"
comments_description = "Вы можете оставить комментарий к этому блог-посту, публично ответив на него с помощью аккаунта Mastodon или другого аккаунта ActivityPub/Fediverse. Известные неприватные ответы отображены ниже."
comments_loading = "Загрузка…"
comments_noscript = "Загрузка комментариев зависит от JavaScript. Попробуйте включить JavaScript и перезагрузить, или посетите оригинальный пост на Mastodon."
disclaimer = "Дисклеймер"
drafted = "Черновик"
faves_from = "Избранное с"
feed = "Лента"
file_an_issue = "Отправить Отчет об Ошибке"
filter_by_tag = "Фильтр по тегам"
@ -76,6 +86,8 @@ table_of_contents = "Оглавление"
tags = "Теги"
tags_in_total = "тегов в общем"
trigger_warning = "Предупреждение о Тревоге"
view_comment = "Показать комментарий на"
view_profile = "Показать профиль на"
[markdown]
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>
<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>
<div id="comments-wrapper">
@ -68,7 +70,7 @@
function loadComments() {
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")
.then(function (response) {
return response.json();
@ -143,7 +145,7 @@
avatar.setAttribute("rel", "external nofollow");
avatar.setAttribute(
"title",
`View profile at @${status.account.username}@${instance}`
`{{ trans(key="view_profile", lang=lang) }} @${status.account.username}@${instance}`
);
avatar.appendChild(avatarPicture);
@ -171,7 +173,7 @@
let permalink = document.createElement("a");
permalink.setAttribute("href", status.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.textContent = new Date(
status.created_at
@ -193,7 +195,7 @@
let boosts = document.createElement("a");
boosts.className = "boosts";
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");
boostsIcon.className = "icon";
@ -204,7 +206,7 @@
let faves = document.createElement("a");
faves.className = "faves";
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");
favesIcon.className = "icon";
@ -229,13 +231,13 @@
avatar.classList.add("op");
avatar.setAttribute(
"title",
"Blog post author; " + avatar.getAttribute("title")
"{{ trans(key="blog_post_author", lang=lang) }}: " + avatar.getAttribute("title")
);
instanceBadge.classList.add("op");
instanceBadge.setAttribute(
"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">
{% 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 %}
{% if config.extra.source_url and config.extra.footer.show_source %}
<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>
{% endif %}

View File

@ -26,7 +26,9 @@
{% 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>
<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 %}
{% if config.extra.show_copy_button %}
@ -55,7 +57,7 @@
{% if config.generate_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 -%}
{% endif %}