Skip to content

Commit 5ee90ff

Browse files
committed
feat: remove English translation support
1 parent e4e74d2 commit 5ee90ff

40 files changed

Lines changed: 43 additions & 5925 deletions

.github/workflows/pages.yml

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
workflow_dispatch:
77

88
permissions:
9-
contents: write
9+
contents: read
1010
pages: write
1111
id-token: write
1212

@@ -18,45 +18,24 @@ jobs:
1818
deploy:
1919
name: Build and deploy
2020
runs-on: ubuntu-latest
21-
timeout-minutes: 45
21+
timeout-minutes: 15
2222
environment:
2323
name: github-pages
2424
url: ${{ steps.deployment.outputs.page_url }}
2525

2626
steps:
2727
- name: Check out repository
2828
uses: actions/checkout@v6
29-
with:
30-
fetch-depth: 0
3129

3230
- name: Set up Node.js
3331
uses: actions/setup-node@v6
3432
with:
3533
node-version: 24
3634
cache: yarn
3735

38-
- name: Set up Python
39-
uses: actions/setup-python@v6
40-
with:
41-
python-version: "3.12"
42-
cache: pip
43-
cache-dependency-path: requirements-i18n.txt
44-
4536
- name: Install dependencies
4637
run: corepack yarn install --frozen-lockfile
4738

48-
- name: Install offline translation engine
49-
run: python -m pip install --disable-pip-version-check -r requirements-i18n.txt
50-
51-
- name: Restore Argos language model
52-
uses: actions/cache@v5
53-
with:
54-
path: ~/.local/share/argos-translate
55-
key: argos-${{ runner.os }}-zh-en-1.9
56-
57-
- name: Synchronize English documentation
58-
run: corepack yarn translate
59-
6039
- name: Build site
6140
run: corepack yarn build
6241

@@ -71,17 +50,3 @@ jobs:
7150
- name: Deploy to GitHub Pages
7251
id: deployment
7352
uses: actions/deploy-pages@v4
74-
75-
- name: Save generated English documentation
76-
run: |
77-
git add -- docs/uk
78-
if [ -f .i18n-cache/argos-zh-en.json ]; then
79-
git add -- .i18n-cache/argos-zh-en.json
80-
fi
81-
if git diff --cached --quiet; then
82-
exit 0
83-
fi
84-
git config user.name "github-actions[bot]"
85-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
86-
git commit -m "chore(i18n): sync generated English documentation"
87-
git push

.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
node_modules/
22
dist/
3-
__pycache__/
4-
.venv*/
5-
.argos-runtime/
63
*.log
7-
.env
8-
.env.*
9-
!.env.example

.i18n-cache/argos-zh-en.json

Lines changed: 0 additions & 1399 deletions
This file was deleted.

TRANSLATING.md

Lines changed: 0 additions & 44 deletions
This file was deleted.

docs/_navbar.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/index.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
})();
7171
</script>
7272
<link rel="stylesheet" href="./vendor/gitalk.css" />
73-
<link rel="stylesheet" href="./styles/theme.css?v=20260716-8" />
73+
<link rel="stylesheet" href="./styles/theme.css?v=20260716-9" />
7474
</head>
7575
<body>
7676
<a class="skip-link" href="#main">跳到正文</a>
@@ -93,9 +93,6 @@
9393
>
9494
GitHub
9595
</a>
96-
<a class="icon-button language-switch" href="#/uk/" aria-label="Switch to English">
97-
EN
98-
</a>
9996
<button class="icon-button theme-toggle" type="button" aria-label="切换深色主题">
10097
<span aria-hidden="true"></span>
10198
</button>
@@ -122,7 +119,7 @@
122119
</noscript>
123120

124121
<script src="./vendor/gitalk.min.js"></script>
125-
<script src="./scripts/site.js?v=20260716-9"></script>
122+
<script src="./scripts/site.js?v=20260716-10"></script>
126123
<script src="./vendor/docsify.min.js"></script>
127124
<script src="./vendor/prism-bash.min.js"></script>
128125
<script src="./vendor/search.min.js"></script>

docs/scripts/site.js

Lines changed: 23 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
admin: ["ryosukeeeeee"],
1616
distractionFreeMode: false,
1717
id: decodeURI(window.location.hash.split("?")[0]),
18-
language: "en",
18+
language: "zh-CN",
1919
});
2020

2121
function normalizeFile(file) {
@@ -26,10 +26,6 @@
2626
return decodeURI(window.location.hash.split("?")[0].replace(/^#/, "") || "/");
2727
}
2828

29-
function isEnglishRoute() {
30-
return currentRoute() === "/uk" || currentRoute().startsWith("/uk/");
31-
}
32-
3329
function readingMinutes(markdown) {
3430
const clean = markdown
3531
.replace(/```[\s\S]*?```/g, " ")
@@ -49,51 +45,31 @@
4945
}
5046

5147
function editUrl(file) {
52-
const sourceFile = normalizeFile(file).replace(/^uk\//, "");
53-
return `${REPOSITORY}/edit/master/docs/${encodedFilePath(sourceFile)}`;
48+
return `${REPOSITORY}/edit/master/docs/${encodedFilePath(file)}`;
5449
}
5550

5651
function articleChrome() {
57-
const english = isEnglishRoute();
5852
const minutes = readingMinutes(activeMarkdown);
59-
const readingLabel = english ? `${minutes} min read` : `约 ${minutes} 分钟阅读`;
60-
const updateLabel = english ? "Updated: fetching…" : "更新于:正在获取…";
61-
const editLabel = english ? "Edit this page on GitHub" : "在 GitHub 上编辑此页";
62-
const discussionTitle = english ? "Community discussion" : "社区讨论";
63-
const discussionText = english
64-
? "Sign in with GitHub to join the discussion for this page."
65-
: "使用 GitHub 登录,参与当前页面的讨论。";
66-
const chineseRoute = currentRoute().replace(/^\/uk(?=\/|$)/, "") || "/";
67-
const translationNotice = english
68-
? `
69-
<aside class="translation-notice" aria-label="Translation notice">
70-
<strong>Machine-translated from Chinese.</strong>
71-
<span>The Chinese page is authoritative.</span>
72-
<a href="#${chineseRoute}">Read the source</a>
73-
</aside>
74-
`
75-
: "";
7653

7754
return {
7855
before: `
79-
<div class="article-meta" aria-label="Page information">
80-
<span class="article-meta__item article-reading-time">${readingLabel}</span>
56+
<div class="article-meta" aria-label="页面信息">
57+
<span class="article-meta__item article-reading-time">${minutes} 分钟阅读</span>
8158
<span class="article-meta__separator" aria-hidden="true"></span>
82-
<span class="article-meta__item article-updated" data-file="${normalizeFile(activeFile)}">${updateLabel}</span>
59+
<span class="article-meta__item article-updated" data-file="${normalizeFile(activeFile)}">更新于:正在获取…</span>
8360
</div>
84-
${translationNotice}
8561
`,
8662
after: `
8763
<footer class="article-footer">
88-
<p>${english ? "Found a problem or an outdated step?" : "发现错误或过时步骤?"}</p>
89-
<a href="${editUrl(activeFile)}" target="_blank" rel="noopener noreferrer">${editLabel} <span aria-hidden="true">↗</span></a>
64+
<p>发现错误或过时步骤?</p>
65+
<a href="${editUrl(activeFile)}" target="_blank" rel="noopener noreferrer">在 GitHub 上编辑此页 <span aria-hidden="true">↗</span></a>
9066
</footer>
91-
<nav class="page-navigation" aria-label="${english ? "Previous and next pages" : "上一篇与下一篇"}"></nav>
67+
<nav class="page-navigation" aria-label="上一篇与下一篇"></nav>
9268
<section class="comments-section" aria-labelledby="comments-title">
9369
<div class="comments-heading">
94-
<p class="eyebrow">${english ? "GitHub Comments" : "GitHub Comments"}</p>
95-
<h2 id="comments-title">${discussionTitle}</h2>
96-
<p>${discussionText}</p>
70+
<p class="eyebrow">GitHub 评论</p>
71+
<h2 id="comments-title">社区讨论</h2>
72+
<p>使用 GitHub 登录,参与当前页面的讨论。</p>
9773
</div>
9874
<div id="gitalk-container" aria-live="polite"></div>
9975
</section>
@@ -134,13 +110,12 @@
134110
if (!element) return;
135111

136112
const file = element.dataset.file;
137-
const english = isEnglishRoute();
138113
fetchLastUpdated(file)
139114
.then((date) => {
140-
element.textContent = english ? `Updated: ${date}` : `更新于:${date}`;
115+
element.textContent = `更新于:${date}`;
141116
})
142117
.catch(() => {
143-
element.textContent = english ? "Update date unavailable" : "更新日期暂不可用";
118+
element.textContent = "更新日期暂不可用";
144119
});
145120
}
146121

@@ -151,18 +126,18 @@
151126
const button = document.createElement("button");
152127
button.className = "copy-code";
153128
button.type = "button";
154-
button.textContent = isEnglishRoute() ? "Copy" : "复制";
155-
button.setAttribute("aria-label", isEnglishRoute() ? "Copy code" : "复制代码");
129+
button.textContent = "复制";
130+
button.setAttribute("aria-label", "复制代码");
156131
button.addEventListener("click", async () => {
157132
const code = block.querySelector("code")?.textContent || "";
158133
try {
159134
await navigator.clipboard.writeText(code);
160-
button.textContent = isEnglishRoute() ? "Copied" : "已复制";
135+
button.textContent = "已复制";
161136
} catch {
162-
button.textContent = isEnglishRoute() ? "Failed" : "复制失败";
137+
button.textContent = "复制失败";
163138
}
164139
window.setTimeout(() => {
165-
button.textContent = isEnglishRoute() ? "Copy" : "复制";
140+
button.textContent = "复制";
166141
}, 1600);
167142
});
168143
block.append(button);
@@ -176,7 +151,7 @@
176151
wrapper.className = "table-scroll";
177152
wrapper.tabIndex = 0;
178153
wrapper.setAttribute("role", "region");
179-
wrapper.setAttribute("aria-label", isEnglishRoute() ? "Scrollable table" : "可横向滚动的表格");
154+
wrapper.setAttribute("aria-label", "可横向滚动的表格");
180155
table.before(wrapper);
181156
wrapper.append(table);
182157
});
@@ -205,10 +180,9 @@
205180
});
206181
if (currentIndex < 0) return;
207182

208-
const english = isEnglishRoute();
209183
const items = [
210-
{ source: links[currentIndex - 1], className: "previous", label: english ? "Previous" : "上一篇", arrow: "←" },
211-
{ source: links[currentIndex + 1], className: "next", label: english ? "Next" : "下一篇", arrow: "→" },
184+
{ source: links[currentIndex - 1], className: "previous", label: "上一篇", arrow: "←" },
185+
{ source: links[currentIndex + 1], className: "next", label: "下一篇", arrow: "→" },
212186
];
213187

214188
for (const item of items) {
@@ -230,35 +204,15 @@
230204
const container = document.getElementById("gitalk-container");
231205
if (!container) return;
232206
if (typeof window.Gitalk !== "function") {
233-
container.textContent = isEnglishRoute()
234-
? "Comments are temporarily unavailable."
235-
: "评论暂时无法加载。";
207+
container.textContent = "评论暂时无法加载。";
236208
return;
237209
}
238210

239211
try {
240212
const gitalk = new window.Gitalk(commentOptions());
241213
gitalk.render("gitalk-container");
242214
} catch {
243-
container.textContent = isEnglishRoute()
244-
? "Comments are temporarily unavailable."
245-
: "评论暂时无法加载。";
246-
}
247-
}
248-
249-
function updateLanguageControls() {
250-
const english = isEnglishRoute();
251-
const route = currentRoute();
252-
const languageLink = document.querySelector(".language-switch");
253-
254-
document.documentElement.lang = english ? "en" : "zh-CN";
255-
if (languageLink) {
256-
const target = english
257-
? route.replace(/^\/uk(?=\/|$)/, "") || "/"
258-
: `/uk${route === "/" ? "/" : route}`;
259-
languageLink.href = `#${target}`;
260-
languageLink.textContent = english ? "中" : "EN";
261-
languageLink.setAttribute("aria-label", english ? "切换到中文" : "Switch to English");
215+
container.textContent = "评论暂时无法加载。";
262216
}
263217
}
264218

@@ -342,7 +296,6 @@
342296
});
343297

344298
hook.doneEach(() => {
345-
updateLanguageControls();
346299
updateLastModified();
347300
enhanceCodeBlocks();
348301
enhanceTables();

docs/styles/theme.css

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1203,31 +1203,6 @@ main:has(> .sidebar.show) > .content {
12031203
background: var(--line-strong);
12041204
}
12051205

1206-
.translation-notice {
1207-
display: flex;
1208-
flex-wrap: wrap;
1209-
align-items: baseline;
1210-
gap: 5px 9px;
1211-
margin: 0 0 28px;
1212-
padding: 11px 14px;
1213-
border: 1px solid color-mix(in srgb, var(--arch-blue) 30%, var(--line));
1214-
border-radius: var(--radius-sm);
1215-
color: var(--ink-secondary);
1216-
background: var(--arch-blue-soft);
1217-
font-size: 13px;
1218-
line-height: 1.55;
1219-
}
1220-
1221-
.translation-notice strong {
1222-
color: var(--ink);
1223-
}
1224-
1225-
.translation-notice a {
1226-
margin-left: auto;
1227-
font-weight: 700;
1228-
white-space: nowrap;
1229-
}
1230-
12311206
.article-footer {
12321207
display: flex;
12331208
align-items: center;

0 commit comments

Comments
 (0)