feat: localize interface messages

This commit is contained in:
Erzbir
2026-08-07 14:45:14 +08:00
parent b556dd9a74
commit e83853ba34
22 changed files with 188 additions and 41 deletions
+3 -3
View File
@@ -7,7 +7,7 @@
<article class="post">
<header>
<h1 class="post-title"
th:with="title=${theme.config.archives_page.title ?: page.archives.title ?: 'Archives'}"
th:with="title=${theme.config.archives_page.title ?: #messages.msg('page.archives.title')}"
th:text="${title}">
Archives
</h1>
@@ -37,12 +37,12 @@
<div class="pagination-buttons">
<span th:if="${archives.hasPrevious()}">
<a data-pjax th:href="@{${archives.prevUrl}}" class="button prev inline">
<span class="button-text">&lt;&nbsp;Prev</span>
<span class="button-text" th:text="'< ' + #{page.pagination.prev}">&lt;&nbsp;Prev</span>
</a>
</span>
<span th:if="${archives.hasNext()}">
<a data-pjax th:href="@{${archives.nextUrl}}" class="button inline next">
<span class="button-text">Next&nbsp;&gt;</span>
<span class="button-text" th:text="#{page.pagination.next} + ' >'">Next&nbsp;&gt;</span>
</a>
</span>
</div>
+1 -1
View File
@@ -7,7 +7,7 @@
<article class="post">
<header>
<h1 class="post-title"
th:with="title=${theme.config.categories_page.title_s ?: page.categories.title ?: 'Categories'}"
th:with="title=${theme.config.categories_page.title_s ?: #messages.msg('page.categories.title')}"
th:text="${title}">
Categories
</h1>
+1 -1
View File
@@ -7,7 +7,7 @@
<article class="post">
<header>
<h1 class="post-title"
th:with="title=${theme.config.categories_page.title ?: page.category.title ?: 'Category'}"
th:with="title=${theme.config.categories_page.title ?: #messages.msg('page.category.title')}"
th:text="|${title}: ${category.spec.displayName} [${category.status.visiblePostCount ?: 0}]|">
Category: Category name [n]
</h1>
+1 -1
View File
@@ -1,7 +1,7 @@
<!doctype html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{modules/layout :: html(title = 'Error - ' + ${site.title}, header = null, content = ~{::content}, footer = null)}"
th:replace="~{modules/layout :: html(title = |#{page.error.title} - ${site.title}|, header = null, content = ~{::content}, footer = null)}"
>
<th:block th:fragment="content">
<div class="content">
+2 -2
View File
@@ -5,14 +5,14 @@
<article class="post">
<header>
<h1 class="post-title"
th:with="title=${theme.config.links_page.title ?: page.links.title ?: 'Links'}"
th:with="title=${theme.config.links_page.title ?: #messages.msg('page.links.title')}"
th:text="${title}">
Links
</h1>
</header>
<section class="post-content link-section" th:each="group : ${groups}">
<div class="link-section-header">
<h2 th:text="${!#strings.isEmpty(group.spec.displayName) ? group.spec.displayName:'links'}">
<h2 th:text="${!#strings.isEmpty(group.spec.displayName) ? group.spec.displayName : #messages.msg('page.links.title')}">
Links
</h2>
</div>
+4 -2
View File
@@ -1,12 +1,14 @@
<th:block th:fragment="footer">
<div class="footer-inner">
<div class="footer-copyright-engine">
<span>Powered by&nbsp;</span>
<span th:text="#{footer.powered_by}">Powered by</span>
<span>&nbsp;</span>
<span>
<a target="_blank" href="http://www.halo.run">Halo</a>
</span>
<span>&nbsp;::&nbsp;</span>
<span>Theme&nbsp;</span>
<span th:text="#{footer.theme}">Theme</span>
<span>&nbsp;</span>
<a target="_blank" href="https://github.com/Erzbir/halo-theme-terminal">Terminal</a>
</div>
<div class="footer-copyright-site">
+5 -5
View File
@@ -10,7 +10,7 @@
</div>
<button
id="search-button"
aria-label="Open Search"
th:attr="aria-label=#{header.search.open}"
type="button"
data-header-action="open-search"
th:if="${pluginFinder.available('PluginSearchWidget')}">
@@ -33,7 +33,7 @@
id="color-scheme-trigger"
class="color-scheme-trigger"
type="button"
aria-label="Selector Scheme"
th:attr="aria-label=#{header.color_scheme.open}"
aria-haspopup="listbox"
aria-expanded="false"
aria-controls="color-scheme-menu">
@@ -49,7 +49,7 @@
id="color-scheme-menu"
class="color-scheme-menu"
role="listbox"
aria-label="Color Scheme List"
th:attr="aria-label=#{header.color_scheme.list}"
hidden>
<button
class="color-scheme-option"
@@ -61,7 +61,7 @@
</button>
</div>
</div>
<button id="theme-toggle" aria-label="Toggle Theme" type="button">
<button id="theme-toggle" th:attr="aria-label=#{header.theme.toggle}" type="button">
<svg class="icon-regular button-icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg"
preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24">
<path
@@ -74,7 +74,7 @@
d="M11 0h2v4h-2zm1 12H8v2H4v2H2v4h2v2h10v-2h2v-4h-2v-2h-2zm0 2v2h2v4H4v-4h4v2h2v-2H8v-2zM8 6h6v2H8zm0 2v2H6V8zm8 2h-2V8h2zm0 0h2v2h-2zm4-8h2v2h-2zm0 2v2h-2V4zM2 2h2v2H2zm2 2h2v2H4zm20 7h-4v2h4z"/>
</svg>
</button>
<button id="pixel-toggle" aria-label="Toggle Pixel Style" type="button">
<button id="pixel-toggle" th:attr="aria-label=#{header.pixel_style.toggle}" type="button">
<svg class="icon-pixel button-icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path fill="currentColor"
d="M22 17h2v2h-2Zm-1 2h1v2h-1Zm1-6V9h1V6h-4v3h2v4h1zm-3 8h2v1h-2Zm0-8h2v1h-2Zm-1 9h1v2h-1Zm0-8h1v1h-1Zm-1 1h1v1h-1Zm-1 1h1v8h-1Zm1-3V3h1V0h-3v3h1v10ZM16 1h1v1h-1Zm-1 12h1v1h-1Zm-1 1h1v10h-1Zm-4-3h1v13h2V11h1V8h-4v3zm-1 3h1v10H9Zm-1-1h1v1H8Zm-1 5h1v6H7ZM8 7h1V3H6v4h1v6h1V7zM6 17h1v1H6Zm-1 5h1v2H5Zm0-6h1v1H5Zm1-1v-4H2v4h1v1h2v-1Zm-3-1v-1h2v1Zm0 7h2v1H3Zm-1-2h1v2H2Zm-2-2h2v2H0Z"/>
+9 -9
View File
@@ -2,7 +2,7 @@
<div class="sns-container">
<!-- Email -->
<a class="sns-icon"
aria-label="Find me on Email"
th:attr="aria-label=#{sns.email}"
target="_blank"
th:href="'mailto:'+${theme.config.sns.email}"
th:if="${not #strings.isEmpty(theme.config.sns.email)}">
@@ -20,7 +20,7 @@
<!-- GitHub -->
<a class="sns-icon"
target="_blank"
aria-label="Find me on GitHub"
th:attr="aria-label=#{sns.github}"
th:href="'https://github.com/'+${theme.config.sns.github}"
th:if="${not #strings.isEmpty(theme.config.sns.github)}">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="icon-regular" viewBox="0 0 24 24">
@@ -34,7 +34,7 @@
<!-- Discord -->
<a class="sns-icon"
target="_blank"
aria-label="Find me on Discord"
th:attr="aria-label=#{sns.discord}"
th:href="${theme.config.sns.discord}"
th:if="${not #strings.isEmpty(theme.config.sns.discord)}">
<svg class="icon-regular" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
@@ -48,7 +48,7 @@
<!-- Telegram -->
<a class="sns-icon"
target="_blank"
aria-label="Find me on Telegram"
th:attr="aria-label=#{sns.telegram}"
th:href="'https://t.me/'+${theme.config.sns.telegram}"
th:if="${not #strings.isEmpty(theme.config.sns.telegram)}">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="icon-regular" viewBox="0 0 24 24">
@@ -62,7 +62,7 @@
<!-- Facebook -->
<a class="sns-icon"
target="_blank"
aria-label="Find me on Facebook"
th:attr="aria-label=#{sns.facebook}"
th:href="'https://www.facebook.com/'+${theme.config.sns.facebook}"
th:if="${not #strings.isEmpty(theme.config.sns.facebook)}">
<svg class="icon-regular" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
@@ -76,7 +76,7 @@
<!-- Instagram -->
<a class="sns-icon"
target="_blank"
aria-label="Find me on Instagram"
th:attr="aria-label=#{sns.instagram}"
th:href="'https://www.instagram.com/'+${theme.config.sns.instagram}"
th:if="${not #strings.isEmpty(theme.config.sns.instagram)}">
<svg class="icon-regular" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
@@ -91,7 +91,7 @@
<!-- X -->
<a class="sns-icon"
target="_blank"
aria-label="Find me on X"
th:attr="aria-label=#{sns.x}"
th:href="'https://x.com/'+${theme.config.sns.x}"
th:if="${not #strings.isEmpty(theme.config.sns.x)}">
<svg class="icon-regular" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
@@ -109,7 +109,7 @@
<a class="sns-icon"
target="_blank"
th:href="@{/rss.xml}"
aria-label="Find me on RSS"
th:attr="aria-label=#{sns.rss}"
th:if="${theme.config.sns.rss}">
<svg class="icon-regular" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -123,4 +123,4 @@
</a>
</div>
</th:block>
</th:block>
+8 -1
View File
@@ -10,7 +10,14 @@
preferTTL: /*[[${theme.config.style.prefer_ttl ?: 24}]]*/ 24,
pixelStyle: /*[[${theme.config.style.pixel_style}]]*/ false,
pixelCssHref: /*[[@{/assets/dist/pixel.css?v={version}(version=${theme.spec.version})}]]*/ "",
customCss: /*[[${theme.config.style.custom}]]*/ ""
customCss: /*[[${theme.config.style.custom}]]*/ "",
messages: {
currentColorScheme: /*[[#{header.color_scheme.current}]]*/ "Current color scheme",
defaultColorScheme: /*[[#{header.color_scheme.default}]]*/ "Default",
showToc: /*[[#{toc.show}]]*/ "Show table of contents",
hideToc: /*[[#{toc.hide}]]*/ "Hide table of contents",
networkError: /*[[#{moment.network_error}]]*/ "Network error. Please try again."
}
};
</script>
<script no-pjax>
+5 -5
View File
@@ -46,7 +46,7 @@
<img th:if="${media.type == 'PHOTO'}"
class="transform-gpu rounded-lg object-cover"
th:src="${media.url}"
alt="photo"/>
th:alt="#{media.photo}"/>
</a>
<video th:if="${media.type == 'VIDEO'}"
@@ -58,7 +58,7 @@
<footer class="moment-footer">
<button class="moment-action-btn moment-upvote-btn"
th:attr="data-moment-action='upvote',data-moment-name=${name},data-count=${upvoteCount}">
th:attr="data-moment-action='upvote',data-moment-name=${name},data-count=${upvoteCount},aria-label=#{moment.upvote}">
<svg class="icon-regular" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
fill="currentColor" width="16" height="16">
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
@@ -74,7 +74,7 @@
</button>
<button class="moment-action-btn moment-comment-btn"
th:attr="data-moment-action='toggle-comment',data-comment-target=${commentId}">
th:attr="data-moment-action='toggle-comment',data-comment-target=${commentId},aria-label=#{moment.comments}">
<svg class="icon-regular" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
fill="currentColor" width="16" height="16">
<path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z"/>
@@ -102,12 +102,12 @@
<div class="pagination-buttons">
<span th:if="${moments.hasPrevious()}">
<a data-pjax th:href="@{${moments.prevUrl}}" class="button inline prev">
<span class="button-text"><&nbsp;Prev</span>
<span class="button-text" th:text="'< ' + #{page.pagination.prev}">&lt;&nbsp;Prev</span>
</a>
</span>
<span th:if="${moments.hasNext()}">
<a data-pjax th:href="@{${moments.nextUrl}}" class="button inline next">
<span class="button-text">Next&nbsp;</span>
<span class="button-text" th:text="#{page.pagination.next} + ' >'">Next&nbsp;&gt;</span>
</a>
</span>
</div>
+1 -1
View File
@@ -22,7 +22,7 @@
<nav id="toc" th:if="${theme.config.post_page.show_toc}" class="toc"
th:with="tocDefaultOpen=${theme.config.post_page.toc_default_open ?: 'auto'}"
th:attr="data-default-open=${tocDefaultOpen == 'open' ? 'true' : (tocDefaultOpen == 'closed' ? 'false' : (theme.config.style.fullscreen_layout ? 'false' : 'true'))}">
<button id="toc-toggle" class="toc-toggle" aria-label="Hide Table of Contents"></button>
<button id="toc-toggle" class="toc-toggle" th:attr="aria-label=#{toc.hide}"></button>
<div id="toc-content" class="toc-content"></div>
</nav>
<nav class="pagination">
+3 -3
View File
@@ -7,7 +7,7 @@
<article class="post">
<header>
<h1 class="post-title"
th:with="title=${theme.config.tags_page.title ?: page.tag.title ?: 'Tag'}"
th:with="title=${theme.config.tags_page.title ?: #messages.msg('page.tag.title')}"
th:text="|${title}: ${tag.spec.displayName} [${tag.status.visiblePostCount ?: 0}]|">
Tag: Tag name [n]
</h1>
@@ -28,12 +28,12 @@
<div class="pagination-buttons">
<span th:if="${posts.hasPrevious()}">
<a data-pjax th:href="@{${posts.prevUrl}}" class="button inline prev">
<span class="button-text"><&nbsp;Prev</span>
<span class="button-text" th:text="'< ' + #{page.pagination.prev}">&lt;&nbsp;Prev</span>
</a>
</span>
<span th:if="${posts.hasNext()}">
<a data-pjax th:href="@{${posts.nextUrl}}" class="button inline next">
<span class="button-text">Next&nbsp;></span>
<span class="button-text" th:text="#{page.pagination.next} + ' >'">Next&nbsp;&gt;</span>
</a>
</span>
</div>
+1 -1
View File
@@ -7,7 +7,7 @@
<article class="post">
<header>
<h1 class="post-title"
th:with="title=${theme.config.tags_page.title_s ?: page.tags.title ?: 'Tags'}"
th:with="title=${theme.config.tags_page.title_s ?: #messages.msg('page.tags.title')}"
th:text="${title}">
Tags
</h1>