diff --git a/.agents/logs/ai_changelog.md b/.agents/logs/ai_changelog.md
index 1fa92e4..b7b3438 100644
--- a/.agents/logs/ai_changelog.md
+++ b/.agents/logs/ai_changelog.md
@@ -1,5 +1,25 @@
# AI Changelog
+## [Snapshot] 2026-08-06 - Migrate main workflow import and share-code i18n
+
+**Implemented**
+
+- Migrated `web/main.js` preflight workflow import UI to the shared translator.
+- Migrated workflow share-code export, import, and unified modal labels, status messages, placeholders, and node-count interpolation.
+- Composed preflight result headings and empty states with DOM nodes while keeping workflow/model/node data dynamic.
+- Kept the locale conditional used by the translation API only for the backend `zh-CN`/`en` service code mapping; it is not a user-facing copy branch.
+
+**Validation**
+
+- JavaScript syntax checks passed for every file under `web/`.
+- All 218 static translator calls in the migrated UI modules resolve in both `zh` and `en` dictionaries.
+- `node tests/recipe_parser_roundtrip.mjs` passed.
+- Targeted `git diff --check` passed; the existing user change in `README.md` was kept outside this snapshot.
+
+**Next**
+
+- Migrate `web/modules/ui_sidebar.js` as its own reviewable snapshot; Recipe and hash-resolver branches remain untouched.
+
## [Snapshot] 2026-08-06 - Migrate detail, doctor, assistant, picker, and notebook i18n
**Implemented**
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index c87dbd7..f434c89 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -58,6 +58,8 @@ The second migration snapshot extends the shared translation contract to `ui_gri
The third migration snapshot extends the same contract to `ui_detail.js`, `ui_doctor.js`, and `ui_notebooks.js`. Detail editing, model selection, Doctor diagnostics, the Node Assistant, the model picker, and Notebook validation now resolve user-facing strings through `translate` with parameter interpolation for counts, paths, model names, and scan status. Dynamic model/path/node data remains outside the locale dictionaries; rich UI state is composed with DOM nodes where translated text replaced previously formatted status HTML.
+The fourth migration snapshot applies the contract to `web/main.js` for preflight workflow import and workflow share-code export/import. These modal surfaces use shared keys for labels, status messages, and count interpolation; the remaining locale conditional in `translateText` only maps the active locale to the backend service's `zh-CN` or `en` code and is not a UI copy branch. `ui_sidebar.js` remains a separate pending snapshot because its scan wizard, settings hub, language toggle, and folder manager require their own key extraction review.
+
## 2. Directory Structure (核心文件结构)
```text
diff --git a/web/main.js b/web/main.js
index 75dfb76..f115469 100644
--- a/web/main.js
+++ b/web/main.js
@@ -173,13 +173,13 @@ class AnomalousBrowser {
const header = document.createElement('h2');
header.style.margin = '0';
header.style.color = '#fff';
- header.innerText = window.anomalous_browser_lang === 'zh' ? '📥 导入工作流 (预检海关)' : '📥 Pre-flight Import Workflow';
+ header.textContent = t('mainPreflightTitle');
modal.appendChild(header);
const desc = document.createElement('div');
desc.style.color = '#aaa';
desc.style.fontSize = '14px';
- desc.innerText = window.anomalous_browser_lang === 'zh' ? '请在此处粘贴工作流的 JSON 代码(未来将支持分享码)。我们将为您提取并校验所有模型依赖。' : 'Paste the workflow JSON here. We will extract and validate all model dependencies before loading.';
+ desc.textContent = t('mainPreflightDesc');
modal.appendChild(desc);
const textarea = document.createElement('textarea');
@@ -215,7 +215,7 @@ class AnomalousBrowser {
btnRow.style.gap = '10px';
const closeBtn = document.createElement('button');
- closeBtn.innerText = window.anomalous_browser_lang === 'zh' ? '取消' : 'Cancel';
+ closeBtn.textContent = t('mainCancel');
closeBtn.style.padding = '8px 16px';
closeBtn.style.background = 'transparent';
closeBtn.style.color = '#ccc';
@@ -226,7 +226,7 @@ class AnomalousBrowser {
const analyzeBtn = document.createElement('button');
analyzeBtn.id = 'anomalous-import-analyze-btn';
- analyzeBtn.innerText = window.anomalous_browser_lang === 'zh' ? '🔍 解析并预检' : '🔍 Analyze & Pre-flight';
+ analyzeBtn.textContent = t('mainAnalyzePreflight');
analyzeBtn.style.padding = '8px 16px';
analyzeBtn.style.background = '#1a73e8';
analyzeBtn.style.color = '#fff';
@@ -236,7 +236,7 @@ class AnomalousBrowser {
const loadBtn = document.createElement('button');
loadBtn.id = 'anomalous-import-load-btn';
- loadBtn.innerText = window.anomalous_browser_lang === 'zh' ? '🚀 强制载入画布' : '🚀 Force Load to Canvas';
+ loadBtn.textContent = t('mainForceLoad');
loadBtn.style.padding = '8px 16px';
loadBtn.style.background = '#28a745';
loadBtn.style.color = '#fff';
@@ -279,11 +279,19 @@ class AnomalousBrowser {
loadBtn.style.display = 'block';
if (models.length === 0) {
- resultArea.innerHTML = `
${window.anomalous_browser_lang === 'zh' ? '✅ 未检测到任何模型依赖。' : '✅ No model dependencies detected.'}