From 19750d2c7c43fb350b149fda55aa9167baa9a119 Mon Sep 17 00:00:00 2001
From: chaosarium <38693485+chaosarium@users.noreply.github.com>
Date: Thu, 22 Dec 2022 13:34:21 -0500
Subject: [PATCH] feat: Added simplified Chinese translations (#257)

---
 i18n/zh-cn.toml                      | 65 ++++++++++++++++++++++++++++
 layouts/partials/textprocessing.html | 19 +++++++-
 2 files changed, 83 insertions(+), 1 deletion(-)
 create mode 100644 i18n/zh-cn.toml

diff --git a/i18n/zh-cn.toml b/i18n/zh-cn.toml
new file mode 100644
index 0000000..ca8c1b1
--- /dev/null
+++ b/i18n/zh-cn.toml
@@ -0,0 +1,65 @@
+[404_message]
+other = "喔哦...... 你是不是迷路了呀..... (⌯' '⌯ ) 这个页面并不存在(也许它还未被发布)。"
+
+[404_back]
+other = "↳ 回到主页"
+
+[all_posts]
+other = "所有 {{.Title}}"
+
+[last_updated]
+other = "最后更新于"
+
+[notes_count]
+other = "带有此标签的笔记"
+
+[first_10]
+other = "正在展示前10个结果"
+
+[tag]
+other = "标签"
+
+[backlinks]
+other = "反向链接"
+
+[no_backlinks]
+other = "没有找到反向链接"
+
+[home]
+other = "主页"
+
+[light_mode]
+other = "明亮模式"
+
+[dark_mode]
+other = "黑暗模式"
+
+[edit_source]
+other = "编辑源码"
+
+[interactive_graph]
+other = "互动图"
+
+[search]
+other = "搜索"
+
+[search_icon]
+other = "搜索图标"
+
+[icon_search]
+other = "打开搜索图标"
+
+[recent_notes]
+other = "近期笔记"
+
+[first_3_notes]
+other = "前3个 {{ .notes }}"
+
+[search_for_something]
+other = "进行搜索......"
+
+[toc]
+other = "目录"
+
+[copyright]
+other = "由 {{ .name }} 用 <a href=\"https://github.com/jackyzha0/quartz\">Quartz</a> 创造, © {{ .year }}"
diff --git a/layouts/partials/textprocessing.html b/layouts/partials/textprocessing.html
index 7b82f32..dbcc053 100644
--- a/layouts/partials/textprocessing.html
+++ b/layouts/partials/textprocessing.html
@@ -42,7 +42,24 @@
     <!-- remove subfolder from title -->
     {{$display := index (last 1 (split $display "/")) 0}}
 
-    {{$curpage := $page.GetPage $title}}
+    <!-- attempt to get title -->
+    {{$searchtitle := $title }}
+    {{$curpage := $page.GetPage $searchtitle }}
+    <!-- attempt to search md file instead  -->
+    {{ if (eq $curpage.String "nopPage") }}
+      {{$searchtitle = (add $title ".md") }}
+      {{$curpage = $page.GetPage $searchtitle }}
+    {{ end }}
+    <!-- attempt to reverse typographer behaviour  -->
+    {{ if (eq $curpage.String "nopPage") }}
+      {{$searchtitle = (replace $searchtitle "&amp;" "&") }}
+      {{$searchtitle = (replace $searchtitle "&quot;" "\"") }}
+      {{$searchtitle = (replace $searchtitle "&rdquo;" "\"") }}
+      {{$searchtitle = (replace $searchtitle "&ldquo;" "\"") }}
+      {{$searchtitle = (replace $searchtitle "&rsquo;" "'") }}
+      {{$searchtitle = (replace $searchtitle "&lsquo;" "'") }}
+      {{$curpage = $page.GetPage $searchtitle }}
+    {{ end }}
     {{$relpath := relURL $path}}
 
     <!-- If path to Hugo page -->