Hugo I18n 添加中文繁體翻譯

警告
本文最后更新于 2021-12-19,文中内容可能已过时。

工作上一直常用繁體,最近臨帖也都寫的繁體,所以博客的語言也想換成繁體,但是 LoveIt 主題沒有支持中文繁體。就只好自己添加了。

更新说明:FixIt 主题已支持中文繁體。

1 翻譯

屬於直譯,有些詞語可能並不符合現在臺灣或者香港那邊的說法。比如,分類好像臺灣常說歸類

新建 i18n/zh-TW.toml

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# Translations for Traditional Chinese
# 繁體中文的翻譯
# https://gohugo.io/content-management/multilingual/#translation-of-strings

# === baseof ==
[backToTop]
other = "回到頂部"

[viewComments]
other = "查看評論"
# === baseof ==

# === Post ===
[posts]
other = "文章"
# === Post ===

# === Taxonomy ===
[allSome]
other = "所有{{ .Some }}"

[tag]
other = "標籤"

[tags]
other = "標籤"

[category]
other = "分類"

[categories]
other = "分類"

[years]
other = "年度總結"
# === Taxonomy ===

# === Pagination ===
[more]
other = "更多"
# === Pagination ===

# === partials/header.html ===
[selectLanguage]
other = "選擇語言"

[switchTheme]
other = "切換主題"
# === partials/header.html ===

# === partials/footer.html ===
[poweredBySome]
other = "由 {{ .Hugo }} 強力驅動 | 主題 - {{ .Theme }}"
# === partials/footer.html ===

# === partials/comment.html ===
[valineLang]
other = "zh-TW"

[valinePlaceholder]
other = "你的評論 ..."

[facebookLanguageCode]
other = "zh-TW"
# === partials/comment.html ===

# === partials/assets.html ===
[search]
other = "搜索"

[searchPlaceholder]
other = "搜索文章標題或內容 ..."

[clear]
other = "清空"

[cancel]
other = "取消"

[noResultsFound]
other = "沒有找到結果"

[lunrLanguageCode]
other = "zh"

[lunrLanguageLib]
other = "lib/lunr/lunr.zh.js"

[lunrSegmentitLib]
other = "lib/lunr/lunr.segmentit.js"

[copyToClipboard]
other = "複製到剪貼板"

[cookieconsentMessage]
other = "本網站使用 Cookies 來改善您的流覽體驗。"

[cookieconsentDismiss]
other = "同意"

[cookieconsentLink]
other = "瞭解更多"
# === partials/assets.html ===

# === partials/plugin/share.html ===
[shareOn]
other = "分享到"
# === partials/plugin/share.html ===

# === posts/single.html ===
[contents]
other = "目錄"

[publishedOnDate]
other = "發佈於 {{ .Date }}"

[includedInCategories]
other = "收錄於 {{ .Categories }}"

[wordCount]
other = "約 {{ .Count }} 字"

[readingTime]
other = "預計閱讀 {{ .Count }} 分鐘"

[views]
other = "次閱讀"

[author]
other = "作者"

[updatedOnDate]
other = "更新於 {{ .Date }}"

[readMarkdown]
other = "閱讀原始文檔"

[back]
other = "返回"

[home]
other = "主頁"

[readMore]
other = "閱讀全文"
# === posts/single.html ===

# === 404.html ===
[pageNotFound]
other = "頁面沒找到"

[pageNotFoundText]
other = "抱歉,您要查找的頁面不存在。"
# === 404.html ===

# === shortcodes/admonition.html ===
[note]
other = "注意"

[abstract]
other = "摘要"

[info]
other = "信息"

[tip]
other = "技巧"

[success]
other = "成功"

[question]
other = "問題"

[warning]
other = "警告"

[failure]
other = "失敗"

[danger]
other = "危險"

[bug]
other = "Bug"

[example]
other = "示例"

[quote]
other = "引用"
# === shortcodes/admonition.html ===

# === shortcodes/version.html ===
[new]
other = "新增"

[changed]
other = "更改"

[deleted]
other = "刪除"
# === shortcodes/version.html ===

2 配置

打開 config.toml

1
defaultContentLanguage = "zh-tw"

相关内容

Buy me a coffee~
Lruihao 支付宝支付宝
Lruihao 微信微信
0%