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

@ -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 %}