Skip to content

Commit db43c24

Browse files
feat: add Vietnamese language support for reports and updates
1 parent ad621f9 commit db43c24

File tree

6 files changed

+653
-158
lines changed

6 files changed

+653
-158
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.DS_Store
33
node_modules/
44
dist/
5+
.idea

index.html

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,19 @@
286286
const LABELS = {
287287
'ai-cli': 'AI CLI 工具',
288288
'ai-cli-en': 'AI CLI Tools',
289+
'ai-cli-vi': 'Công cụ AI CLI',
289290
'ai-agents': 'AI Agents 生态',
290291
'ai-agents-en': 'AI Agents Ecosystem',
292+
'ai-agents-vi': 'Hệ sinh thái AI Agents',
291293
'ai-web': 'OpenAI & Anthropic 官网动态',
292294
'ai-web-en': 'OpenAI & Anthropic Updates',
295+
'ai-web-vi': 'Cập nhật OpenAI & Anthropic',
293296
'ai-trending': 'GitHub AI 趋势',
294297
'ai-trending-en': 'GitHub AI Trends',
298+
'ai-trending-vi': 'Xu hướng AI GitHub',
295299
'ai-hn': 'HN 社区动态',
296300
'ai-hn-en': 'HN Community Digest',
301+
'ai-hn-vi': 'Cộng đồng HN',
297302
};
298303

299304
// ── Theme ──
@@ -458,14 +463,16 @@
458463
const list = document.createElement('div');
459464
list.className = 'rpt-list';
460465

461-
// Filter out -en reports from base list, process as pairs
462-
const baseReports = reports.filter(r => !r.endsWith('-en'));
466+
// Filter out -en and -vi reports from base list, process as groups
467+
const baseReports = reports.filter(r => !r.endsWith('-en') && !r.endsWith('-vi'));
463468
baseReports.forEach(r => {
464469
const enKey = r + '-en';
470+
const viKey = r + '-vi';
465471
const hasEn = reports.includes(enKey);
472+
const hasVi = reports.includes(viKey);
466473

467-
if (hasEn) {
468-
// Render as a row with label + [ZH][EN] buttons
474+
if (hasEn || hasVi) {
475+
// Render as a row with label + language buttons
469476
const row = document.createElement('div');
470477
row.className = 'rpt-row';
471478

@@ -483,18 +490,30 @@
483490
zhBtn.dataset.key = `${date}/${r}`;
484491
zhBtn.textContent = 'ZH';
485492
zhBtn.onclick = () => loadReport(date, r);
493+
btns.append(zhBtn);
494+
495+
if (hasEn) {
496+
const enBtn = document.createElement('button');
497+
enBtn.className = 'lang-btn';
498+
enBtn.dataset.key = `${date}/${enKey}`;
499+
enBtn.textContent = 'EN';
500+
enBtn.onclick = () => loadReport(date, enKey);
501+
btns.append(enBtn);
502+
}
503+
504+
if (hasVi) {
505+
const viBtn = document.createElement('button');
506+
viBtn.className = 'lang-btn';
507+
viBtn.dataset.key = `${date}/${viKey}`;
508+
viBtn.textContent = 'VI';
509+
viBtn.onclick = () => loadReport(date, viKey);
510+
btns.append(viBtn);
511+
}
486512

487-
const enBtn = document.createElement('button');
488-
enBtn.className = 'lang-btn';
489-
enBtn.dataset.key = `${date}/${enKey}`;
490-
enBtn.textContent = 'EN';
491-
enBtn.onclick = () => loadReport(date, enKey);
492-
493-
btns.append(zhBtn, enBtn);
494513
row.append(label, btns);
495514
list.appendChild(row);
496515
} else {
497-
// No EN variant — render as current single button
516+
// No variants — render as single button
498517
const btn = document.createElement('button');
499518
btn.className = 'rpt-btn';
500519
btn.dataset.key = `${date}/${r}`;

src/generate-manifest.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,36 +9,50 @@ const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
99
const REPORT_FILES = [
1010
"ai-cli",
1111
"ai-cli-en",
12+
"ai-cli-vi",
1213
"ai-agents",
1314
"ai-agents-en",
15+
"ai-agents-vi",
1416
"ai-web",
1517
"ai-web-en",
18+
"ai-web-vi",
1619
"ai-trending",
1720
"ai-trending-en",
21+
"ai-trending-vi",
1822
"ai-hn",
1923
"ai-hn-en",
24+
"ai-hn-vi",
2025
"ai-weekly",
2126
"ai-weekly-en",
27+
"ai-weekly-vi",
2228
"ai-monthly",
2329
"ai-monthly-en",
30+
"ai-monthly-vi",
2431
] as const;
2532
const MAX_FEED_ITEMS = 30;
2633

2734
const REPORT_LABELS: Record<string, string> = {
2835
"ai-cli": "AI CLI 工具社区动态日报",
2936
"ai-cli-en": "AI CLI Tools Digest",
37+
"ai-cli-vi": "Bản tin Công cụ AI CLI",
3038
"ai-agents": "AI Agents 生态日报",
3139
"ai-agents-en": "AI Agents Ecosystem Digest",
40+
"ai-agents-vi": "Bản tin Hệ sinh thái AI Agents",
3241
"ai-web": "AI 官方内容追踪报告",
3342
"ai-web-en": "Official AI Content Report",
43+
"ai-web-vi": "Báo cáo Nội dung AI Chính thức",
3444
"ai-trending": "AI 开源趋势日报",
3545
"ai-trending-en": "AI Open Source Trends",
46+
"ai-trending-vi": "Xu hướng AI Mã nguồn mở",
3647
"ai-hn": "Hacker News AI 社区动态日报",
3748
"ai-hn-en": "Hacker News AI Community Digest",
49+
"ai-hn-vi": "Bản tin Cộng đồng AI Hacker News",
3850
"ai-weekly": "AI 工具生态周报",
3951
"ai-weekly-en": "AI Tools Weekly Digest",
52+
"ai-weekly-vi": "Bản tin Tuần AI",
4053
"ai-monthly": "AI 工具生态月报",
4154
"ai-monthly-en": "AI Tools Monthly Digest",
55+
"ai-monthly-vi": "Bản tin Tháng AI",
4256
};
4357

4458
interface DateEntry {

0 commit comments

Comments
 (0)