- Go 后端 handler 错误消息统一中文化(middleware/repos/generate/review/settings) - 前端 JS 加载和错误消息中文化(diff-viewer.js, graph.js) - 模板页面错误 fallback 和静态文本中文化(index/generate/review/base) - 消除中英文混杂,提升中文用户体验
This commit is contained in:
@@ -298,7 +298,7 @@ const DiffViewer = {
|
||||
this._onRenderComplete = options.onComplete || null;
|
||||
|
||||
if (!files || files.length === 0) {
|
||||
this.container.innerHTML = '<div class="text-gray-500 p-4">No changes</div>';
|
||||
this.container.innerHTML = '<div class="text-gray-500 p-4">暂无变更</div>';
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -664,12 +664,12 @@ const DiffViewer = {
|
||||
async loadDiff(repoId, base, head, options = {}) {
|
||||
if (!this.container) return;
|
||||
|
||||
this.container.innerHTML = '<div class="text-center p-8"><div class="spinner inline-block"></div><p class="mt-2 text-gray-500">Loading diff...</p></div>';
|
||||
this.container.innerHTML = '<div class="text-center p-8"><div class="spinner inline-block"></div><p class="mt-2 text-gray-500">加载 Diff 中...</p></div>';
|
||||
|
||||
try {
|
||||
const url = `/api/repos/${repoId}/diff?base=${encodeURIComponent(base)}&head=${encodeURIComponent(head)}`;
|
||||
const resp = await fetch(url, { credentials: 'same-origin' });
|
||||
if (!resp.ok) throw new Error('Failed to load diff');
|
||||
if (!resp.ok) throw new Error('加载 Diff 失败');
|
||||
|
||||
const data = await resp.json();
|
||||
|
||||
@@ -679,24 +679,24 @@ const DiffViewer = {
|
||||
this.renderFiles(data, options);
|
||||
}
|
||||
} catch (err) {
|
||||
this.container.innerHTML = `<div class="text-red-500 p-4">Error loading diff: ${err.message}</div>`;
|
||||
this.container.innerHTML = `<div class="text-red-500 p-4">加载 Diff 失败: ${err.message}</div>`;
|
||||
}
|
||||
},
|
||||
|
||||
async loadFiles(repoId, base, head) {
|
||||
if (!this.container) return;
|
||||
|
||||
this.container.innerHTML = '<div class="text-center p-8"><div class="spinner inline-block"></div><p class="text-gray-500">Loading files...</p></div>';
|
||||
this.container.innerHTML = '<div class="text-center p-8"><div class="spinner inline-block"></div><p class="text-gray-500">加载文件列表中...</p></div>';
|
||||
|
||||
try {
|
||||
const url = `/api/repos/${repoId}/diff?base=${encodeURIComponent(base)}&head=${encodeURIComponent(head)}&per_file=true`;
|
||||
const resp = await fetch(url, { credentials: 'same-origin' });
|
||||
if (!resp.ok) throw new Error('Failed to load diff');
|
||||
if (!resp.ok) throw new Error('加载 Diff 失败');
|
||||
|
||||
const files = await resp.json();
|
||||
this.renderFiles(files);
|
||||
} catch (err) {
|
||||
this.container.innerHTML = `<div class="text-red-500 p-4">Error: ${err.message}</div>`;
|
||||
this.container.innerHTML = `<div class="text-red-500 p-4">加载失败: ${err.message}</div>`;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user