From c28ae761acf126f1d033067382051d5444bd2890 Mon Sep 17 00:00:00 2001 From: Chin Rock Date: Tue, 20 Oct 2026 09:09:41 +0000 Subject: [PATCH] fix(web): format migration diagnostics and tolerate wrapped translations Co-authored-by: multica-agent --- .../i18n/locales/pipeline-migration/en-US.ts | 6 ++-- .../i18n/locales/pipeline-migration/es-ES.ts | 6 ++-- .../i18n/locales/pipeline-migration/ja-JP.ts | 9 ++++-- .../i18n/locales/pipeline-migration/ru-RU.ts | 9 ++++-- .../i18n/locales/pipeline-migration/th-TH.ts | 3 +- .../i18n/locales/pipeline-migration/vi-VN.ts | 3 +- .../migration-network-diagnostics.test.mjs | 28 +++++++++++++++---- 7 files changed, 47 insertions(+), 17 deletions(-) diff --git a/web/src/i18n/locales/pipeline-migration/en-US.ts b/web/src/i18n/locales/pipeline-migration/en-US.ts index bef21ef43..a91be419e 100644 --- a/web/src/i18n/locales/pipeline-migration/en-US.ts +++ b/web/src/i18n/locales/pipeline-migration/en-US.ts @@ -1,10 +1,12 @@ export default { networkDiagnostics: { timeout: 'The download timed out. Check your network or proxy and retry.', - connection: 'Could not connect to the marketplace. Check your network or proxy.', + connection: + 'Could not connect to the marketplace. Check your network or proxy.', incomplete: 'The download was interrupted. Please retry.', http: 'The marketplace rejected the download. Check the status and retry later.', - network: 'A network error interrupted installation. Check your connection and retry.', + network: + 'A network error interrupted installation. Check your connection and retry.', }, complete: 'Done', checkingPlugin: 'Check plugin', diff --git a/web/src/i18n/locales/pipeline-migration/es-ES.ts b/web/src/i18n/locales/pipeline-migration/es-ES.ts index cc340af89..8d3e61818 100644 --- a/web/src/i18n/locales/pipeline-migration/es-ES.ts +++ b/web/src/i18n/locales/pipeline-migration/es-ES.ts @@ -1,10 +1,12 @@ export default { networkDiagnostics: { - timeout: 'La descarga agotó el tiempo de espera. Revisa la red o el proxy y reintenta.', + timeout: + 'La descarga agotó el tiempo de espera. Revisa la red o el proxy y reintenta.', connection: 'No se pudo conectar al mercado. Revisa la red o el proxy.', incomplete: 'La descarga se interrumpió. Vuelve a intentarlo.', http: 'El mercado rechazó la descarga. Revisa el estado e inténtalo más tarde.', - network: 'Un error de red interrumpió la instalación. Revisa la conexión y reintenta.', + network: + 'Un error de red interrumpió la instalación. Revisa la conexión y reintenta.', }, complete: 'Finalizar', checkingPlugin: 'Comprobar plugin', diff --git a/web/src/i18n/locales/pipeline-migration/ja-JP.ts b/web/src/i18n/locales/pipeline-migration/ja-JP.ts index a2efeb52c..879be948d 100644 --- a/web/src/i18n/locales/pipeline-migration/ja-JP.ts +++ b/web/src/i18n/locales/pipeline-migration/ja-JP.ts @@ -1,10 +1,13 @@ export default { networkDiagnostics: { - timeout: 'ダウンロードがタイムアウトしました。ネットワークやプロキシを確認して再試行してください。', - connection: 'マーケットに接続できません。ネットワークやプロキシを確認してください。', + timeout: + 'ダウンロードがタイムアウトしました。ネットワークやプロキシを確認して再試行してください。', + connection: + 'マーケットに接続できません。ネットワークやプロキシを確認してください。', incomplete: 'ダウンロードが中断されました。再試行してください。', http: 'マーケットがダウンロードを拒否しました。ステータスを確認し、後で再試行してください。', - network: 'ネットワークエラーでインストールが中断されました。接続を確認して再試行してください。', + network: + 'ネットワークエラーでインストールが中断されました。接続を確認して再試行してください。', }, complete: '完了', checkingPlugin: 'プラグインを確認', diff --git a/web/src/i18n/locales/pipeline-migration/ru-RU.ts b/web/src/i18n/locales/pipeline-migration/ru-RU.ts index 6a9704be8..8a2fefcac 100644 --- a/web/src/i18n/locales/pipeline-migration/ru-RU.ts +++ b/web/src/i18n/locales/pipeline-migration/ru-RU.ts @@ -1,10 +1,13 @@ export default { networkDiagnostics: { - timeout: 'Время загрузки истекло. Проверьте сеть или прокси и повторите попытку.', - connection: 'Не удалось подключиться к каталогу. Проверьте сеть или прокси.', + timeout: + 'Время загрузки истекло. Проверьте сеть или прокси и повторите попытку.', + connection: + 'Не удалось подключиться к каталогу. Проверьте сеть или прокси.', incomplete: 'Загрузка прервана. Повторите попытку.', http: 'Каталог отклонил загрузку. Проверьте статус и повторите попытку позже.', - network: 'Установка прервана из-за ошибки сети. Проверьте соединение и повторите попытку.', + network: + 'Установка прервана из-за ошибки сети. Проверьте соединение и повторите попытку.', }, complete: 'Готово', checkingPlugin: 'Проверка плагина', diff --git a/web/src/i18n/locales/pipeline-migration/th-TH.ts b/web/src/i18n/locales/pipeline-migration/th-TH.ts index f94ee46df..5bfec6587 100644 --- a/web/src/i18n/locales/pipeline-migration/th-TH.ts +++ b/web/src/i18n/locales/pipeline-migration/th-TH.ts @@ -4,7 +4,8 @@ export default { connection: 'เชื่อมต่อมาร์เก็ตเพลซไม่ได้ โปรดตรวจสอบเครือข่ายหรือพร็อกซี', incomplete: 'การดาวน์โหลดถูกขัดจังหวะ โปรดลองใหม่', http: 'มาร์เก็ตเพลซปฏิเสธการดาวน์โหลด โปรดตรวจสอบสถานะแล้วลองใหม่ภายหลัง', - network: 'ข้อผิดพลาดเครือข่ายทำให้การติดตั้งหยุดลง โปรดตรวจสอบการเชื่อมต่อแล้วลองใหม่', + network: + 'ข้อผิดพลาดเครือข่ายทำให้การติดตั้งหยุดลง โปรดตรวจสอบการเชื่อมต่อแล้วลองใหม่', }, complete: 'เสร็จสิ้น', checkingPlugin: 'ตรวจสอบปลั๊กอิน', diff --git a/web/src/i18n/locales/pipeline-migration/vi-VN.ts b/web/src/i18n/locales/pipeline-migration/vi-VN.ts index 263ee045f..905aa4967 100644 --- a/web/src/i18n/locales/pipeline-migration/vi-VN.ts +++ b/web/src/i18n/locales/pipeline-migration/vi-VN.ts @@ -1,6 +1,7 @@ export default { networkDiagnostics: { - timeout: 'Tải xuống quá thời gian chờ. Kiểm tra mạng hoặc proxy rồi thử lại.', + timeout: + 'Tải xuống quá thời gian chờ. Kiểm tra mạng hoặc proxy rồi thử lại.', connection: 'Không thể kết nối kho tiện ích. Kiểm tra mạng hoặc proxy.', incomplete: 'Tải xuống bị gián đoạn. Vui lòng thử lại.', http: 'Kho tiện ích từ chối tải xuống. Kiểm tra trạng thái rồi thử lại sau.', diff --git a/web/tests/unit/migration-network-diagnostics.test.mjs b/web/tests/unit/migration-network-diagnostics.test.mjs index 822d4f4b2..7689af674 100644 --- a/web/tests/unit/migration-network-diagnostics.test.mjs +++ b/web/tests/unit/migration-network-diagnostics.test.mjs @@ -8,15 +8,33 @@ test('network diagnostics use safe, translated messages in all eight locales', ( assert.equal(locales.length, 8); for (const locale of locales) { const source = readFileSync(`${base}/${locale}`, 'utf8'); - const diagnostic = source.match(/networkDiagnostics: \{([\s\S]*?)\n \}/)?.[1]; + const diagnostic = source.match( + /networkDiagnostics: \{([\s\S]*?)\n \}/, + )?.[1]; assert.ok(diagnostic, locale); - for (const key of ['timeout', 'connection', 'incomplete', 'http', 'network']) { - assert.match(diagnostic, new RegExp(`${key}: ['"].+['"]`), `${locale}: ${key}`); + for (const key of [ + 'timeout', + 'connection', + 'incomplete', + 'http', + 'network', + ]) { + assert.match( + diagnostic, + new RegExp(`${key}:\\s+['"].+['"]`), + `${locale}: ${key}`, + ); } assert.doesNotMatch(diagnostic, /https?:\/\/|\{\{kind\}\}/); } - const component = readFileSync('src/app/home/pipelines/MigrationInstallProgress.tsx', 'utf8'); - assert.match(component, /t\(networkDiagnosticKey\(item\.diagnostic\.kind\)\)/); + const component = readFileSync( + 'src/app/home/pipelines/MigrationInstallProgress.tsx', + 'utf8', + ); + assert.match( + component, + /t\(networkDiagnosticKey\(item\.diagnostic\.kind\)\)/, + ); assert.match(component, /Number\.isInteger\(item\.diagnostic\.http_status\)/); assert.doesNotMatch(component, /\{item\.diagnostic\.kind\}/); });