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
+8 -2
View File
@@ -2,6 +2,12 @@ page.archives.title=Archives
page.links.title=Links
page.moments.title=Moments
page.tags.title=Tags
page.tag.title=Tag: {0}
page.tag.title=Tag
page.categories.title=Categories
page.category.title=Category: {0}
page.category.title=Category
page.pagination.prev=Prev
page.pagination.next=Next
page.post.more=READ MORE
page.post.pagination=READ MORE POSTS
page.post.comment=Comment
page.error.back=Back to home page
+13
View File
@@ -0,0 +1,13 @@
page.archives.title=Archives
page.links.title=Links
page.moments.title=Moments
page.tags.title=Tags
page.tag.title=Tag
page.categories.title=Categories
page.category.title=Category
page.pagination.prev=Prev
page.pagination.next=Next
page.post.more=READ MORE
page.post.pagination=READ MORE POSTS
page.post.comment=Comment
page.error.back=Back to home page
+13
View File
@@ -0,0 +1,13 @@
page.archives.title=Archivos
page.links.title=Enlaces
page.moments.title=Momentos
page.tags.title=Etiquetas
page.tag.title=Etiqueta
page.categories.title=Categorías
page.category.title=Categoría
page.pagination.prev=Anterior
page.pagination.next=Siguiente
page.post.more=LEER MÁS
page.post.pagination=LEER MÁS PUBLICACIONES
page.post.comment=Comentario
page.error.back=Volver a la página principal
+13
View File
@@ -0,0 +1,13 @@
page.archives.title=アーカイブ
page.links.title=リンク
page.moments.title=モーメント
page.tags.title=タグ
page.tag.title=タグ
page.categories.title=カテゴリ
page.category.title=カテゴリ
page.pagination.prev=前へ
page.pagination.next=次へ
page.post.more=続きを読む
page.post.pagination=さらに記事を読む
page.post.comment=コメント
page.error.back=ホームページに戻る
+13
View File
@@ -0,0 +1,13 @@
page.archives.title=归档
page.links.title=链接
page.moments.title=瞬间
page.tags.title=标签
page.tag.title=标签
page.categories.title=分类
page.category.title=分类
page.pagination.prev=上一页
page.pagination.next=下一页
page.post.more=阅读更多
page.post.pagination=更多文章
page.post.comment=评论
page.error.back=返回首页
+13
View File
@@ -0,0 +1,13 @@
page.archives.title=歸檔
page.links.title=連結
page.moments.title=瞬間
page.tags.title=標籤
page.tag.title=標籤
page.categories.title=分類
page.category.title=分類
page.pagination.prev=上一頁
page.pagination.next=下一頁
page.post.more=閱讀更多
page.post.pagination=閱讀更多文章
page.post.comment=評論
page.error.back=返回首頁
-1
View File
@@ -17,7 +17,6 @@
background: var(--color-theme-background);
color: color-mix(in srgb, var(--color-theme-foreground) 65%, transparent);
font-size: calc(var(--font-theme-size) * 0.8);
text-transform: uppercase;
text-decoration: none;
letter-spacing: 0.1em;
z-index: 1;
+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">