feat: support i18n

This commit is contained in:
Erzbir
2025-08-05 20:18:50 +08:00
parent 41d2408359
commit b80650db3b
19 changed files with 95 additions and 27 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
<th:block th:fragment="content">
<article class="post">
<header>
<h1 class="post-title">Archives</h1>
<h1 class="post-title" th:text="#{page.archives.title}">Archives</h1>
</header>
<section>
<th:block th:each="archive : ${archives.items}">
+1 -1
View File
@@ -6,7 +6,7 @@
<th:block th:fragment="content">
<article class="post">
<header>
<h1 class="post-title">Categories</h1>
<h1 class="post-title" th:text="#{page.categories.title}">Categories</h1>
</header>
<section class="post-content">
<ul>
+3 -4
View File
@@ -1,14 +1,13 @@
<!DOCTYPE html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{modules/layout :: html(title = |#{page.category.title(${category.spec.displayName})} - ${site.title}|, header = null, content = ~{::content}, footer = null)}"
th:replace="~{modules/layout :: html(title = |#{page.category.title}: ${category.spec.displayName} - ${site.title}|, header = null, content = ~{::content}, footer = null)}"
>
<th:block th:fragment="content">
<article class="post">
<header>
<h1
class="post-title"
th:text="'Category: '+${category.spec.displayName}+' ['+${category.status.visiblePostCount?:0}+']'">
<h1 class="post-title"
th:text="|#{page.category.title}: ${category.spec.displayName} [${category.status.visiblePostCount ?: 0}]|">
Category: Category name [n]
</h1>
</header>
+2 -2
View File
@@ -1,7 +1,7 @@
<!doctype html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{modules/layout :: html(title = |${singlePage.spec.title} - ${site.title}|, header = null, content = ~{::content}, footer = null)}"
th:replace="~{modules/layout :: html(title = '404 - ' + ${site.title}, header = null, content = ~{::content}, footer = null)}"
>
<th:block th:fragment="content">
<div class="content">
@@ -10,7 +10,7 @@
<div class="post-content">
<p th:text="${error?.detail}"></p>
</div>
<button th:onclick="'location.href=\'' + @{/} + '\''">
<button th:onclick="'location.href=\'' + @{/} + '\''" th:text="#{page.error.back}">
Back to home page
</button>
</div>
+2 -2
View File
@@ -1,7 +1,7 @@
<!doctype html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{modules/layout :: html(title = |${singlePage.spec.title} - ${site.title}|, header = null, content = ~{::content}, footer = null)}"
th:replace="~{modules/layout :: html(title = '5xx - ' + ${site.title}, header = null, content = ~{::content}, footer = null)}"
>
<th:block th:fragment="content">
<div class="content">
@@ -10,7 +10,7 @@
<div class="post-content">
<p th:text="${error?.detail}"></p>
</div>
<button th:onclick="'location.href=\'' + @{/} + '\''">
<button th:onclick="'location.href=\'' + @{/} + '\''" th:text="#{page.error.back}">
Back to home page
</button>
</div>
+3 -3
View File
@@ -34,7 +34,7 @@
<span th:text="${post.status.excerpt}">Post Excerpt...</span>
</section>
<section>
<a data-pjax class="read-more button inline" th:href="@{${post.status.permalink}}">[Read more]</a>
<a data-pjax class="read-more button inline" th:href="@{${post.status.permalink}}" th:text="#{page.post.more} + ' >'">READ MORE ></a>
</section>
</article>
</section>
@@ -42,12 +42,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
@@ -4,7 +4,7 @@
<th:block th:fragment="content">
<article class="post">
<header>
<h1 class="post-title">Links</h1>
<h1 class="post-title" th:text="#{page.links.title}">Links</h1>
</header>
<section class="post-content link-section" th:each="group : ${groups}">
<h2 th:text="${!#strings.isEmpty(group.spec.displayName) ? group.spec.displayName:'links'}">
+1 -2
View File
@@ -2,8 +2,7 @@
<html
xmlns:th="https://www.thymeleaf.org"
th:lang="${#locale.toLanguageTag}"
th:fragment="html (header, content, footer)"
lang="en">
th:fragment="html (header, content, footer)">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
+2 -2
View File
@@ -15,8 +15,8 @@
Moment CreateTime
</span>
<span class="post-author" th:with="owner = ${moment.owner}" th:text="${owner.displayName}">
Author
</span>
Author
</span>
</div>
</header>
<section class="post-content" th:utext="${content.html}">Moment Content...</section>
+2 -2
View File
@@ -33,7 +33,7 @@
</nav>
<section class="pagination">
<div class="pagination__title">
<span class="pagination__title-h">Read other posts</span>
<span class="pagination__title-h" th:text="#{page.post.pagination}">READ OTHER POSTS</span>
<hr/>
</div>
<div class="pagination__buttons" th:with="postCursor=${postFinder.cursor(post.metadata?.name)}">
@@ -50,7 +50,7 @@
</div>
</section>
<section class="comment" th:if="${haloCommentEnabled}">
<h2>Comments</h2>
<h2 th:text="#{page.post.comment}">Comments</h2>
<halo:comment group="content.halo.run" kind="Post" th:attr="name=${post.metadata.name}"/>
</section>
</th:block>
+3 -3
View File
@@ -1,14 +1,14 @@
<!DOCTYPE html>
<html
xmlns:th="https://www.thymeleaf.org"
th:replace="~{modules/layout :: html(title = |#{page.tag.title(${tag.spec.displayName})} - ${site.title}|, header = null, content = ~{::content}, footer = null)}"
th:replace="~{modules/layout :: html(title = |#{page.tag.title}: ${tag.spec.displayName} - ${site.title}|, header = null, content = ~{::content}, footer = null)}"
>
<th:block th:fragment="content">
<article class="post">
<header>
<h1 class="post-title"
th:text="'Tag:'+${tag.spec.displayName}+' ['+${tag.status.visiblePostCount?:0}+']'">
Tag: [n]
th:text="|#{page.tag.title}: ${tag.spec.displayName} [${tag.status.visiblePostCount ?: 0}]|">
Tag: Tag name [n]
</h1>
</header>
<section class="post-content">
+1 -1
View File
@@ -6,7 +6,7 @@
<th:block th:fragment="content">
<article class="post">
<header>
<h1 class="post-title">Tags</h1>
<h1 class="post-title" th:text="#{page.tag.title}">Tags</h1>
</header>
<section class="post-content">
<ul class="post-tags">