diff --git a/frontend/src/utils/connectionExport.test.ts b/frontend/src/utils/connectionExport.test.ts index 4c4cd5dd..a8888da2 100644 --- a/frontend/src/utils/connectionExport.test.ts +++ b/frontend/src/utils/connectionExport.test.ts @@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs'; import { beforeEach, describe, expect, it } from 'vitest'; -import { setCurrentLanguage } from '../i18n'; +import { setCurrentLanguage, t } from '../i18n'; import { detectConnectionImportKind, isConnectionPackagePasswordRequiredError, @@ -104,6 +104,10 @@ describe('connectionExport', () => { `)).toBe('navicat-ncx'); }); + it('mentions Navicat NCX in unsupported import format guidance', () => { + expect(t('app.connection_package.message.unsupported_file_format', undefined, 'zh-CN')).toContain('Navicat NCX'); + }); + it('returns invalid for malformed or unsupported content', () => { expect(detectConnectionImportKind('{not-json}')).toBe('invalid'); expect(detectConnectionImportKind(JSON.stringify({ diff --git a/internal/app/methods_file.go b/internal/app/methods_file.go index a62c38f4..53f02a6d 100644 --- a/internal/app/methods_file.go +++ b/internal/app/methods_file.go @@ -1689,6 +1689,10 @@ func (a *App) ImportConfigFile() connection.QueryResult { DisplayName: "MySQL Workbench Connections (*.xml)", Pattern: "*.xml", }, + { + DisplayName: "Navicat Connections (*.ncx)", + Pattern: "*.ncx", + }, }, }) diff --git a/internal/app/methods_file_i18n_test.go b/internal/app/methods_file_i18n_test.go index 90b2743a..6162056b 100644 --- a/internal/app/methods_file_i18n_test.go +++ b/internal/app/methods_file_i18n_test.go @@ -157,6 +157,23 @@ func TestExternalSQLFileBackendMessagesUseLocalizedText(t *testing.T) { } } +func TestImportConfigFileAllowsNavicatNCXSelection(t *testing.T) { + sourceBytes, err := os.ReadFile("methods_file.go") + if err != nil { + t.Fatalf("read methods_file.go: %v", err) + } + source := methodsFileFunctionSource(t, string(sourceBytes), "func (a *App) ImportConfigFile() connection.QueryResult") + + for _, want := range []string{ + "Navicat Connections (*.ncx)", + `Pattern: "*.ncx"`, + } { + if !strings.Contains(source, want) { + t.Fatalf("ImportConfigFile missing Navicat NCX selector %q", want) + } + } +} + func TestExternalSQLFileBackendCatalogKeysExist(t *testing.T) { catalogs, err := i18n.LoadCatalogs() if err != nil { diff --git a/shared/i18n/de-DE.json b/shared/i18n/de-DE.json index a71d7f6f..f560eac2 100644 --- a/shared/i18n/de-DE.json +++ b/shared/i18n/de-DE.json @@ -2489,7 +2489,7 @@ "app.connection_package.message.imported_connections": "{{count}} Verbindungen importiert", "app.connection_package.message.imported_with_missing_passwords": "{{count}} Verbindungen importiert. Einige Verbindungen enthalten keine Passwörter. Bearbeiten Sie diese Verbindungen und geben Sie vor dem Speichern die Passwörter ein.", "app.connection_package.message.no_connections_to_export": "Keine Verbindungen zum Exportieren", - "app.connection_package.message.unsupported_file_format": "Dateiformatfehler: Unterstützt werden nur GoNavi-Wiederherstellungspakete, historische JSON-Verbindungsarrays oder MySQL Workbench XML", + "app.connection_package.message.unsupported_file_format": "Dateiformatfehler: Unterstützt werden nur GoNavi-Wiederherstellungspakete, historische JSON-Verbindungsarrays, MySQL Workbench XML oder Navicat NCX", "app.connection.message.editable_load_failed": "Die Details der gespeicherten Verbindung konnten nicht geladen werden. Stattdessen wird die maskierte Konfiguration geöffnet.", "app.connection.message.editable_load_failed_with_detail": "Die Details der gespeicherten Verbindung konnten nicht geladen werden: {{detail}}. Stattdessen wird die maskierte Konfiguration geöffnet.", "app.data_root.action.migrate_and_switch": "Vorhandene Daten migrieren und wechseln", diff --git a/shared/i18n/en-US.json b/shared/i18n/en-US.json index 8b2d9eb6..c6033c37 100644 --- a/shared/i18n/en-US.json +++ b/shared/i18n/en-US.json @@ -2489,7 +2489,7 @@ "app.connection_package.message.imported_connections": "Imported {{count}} connections", "app.connection_package.message.imported_with_missing_passwords": "Imported {{count}} connections. Some connections do not include passwords; edit those connections and enter passwords before saving.", "app.connection_package.message.no_connections_to_export": "No connections to export", - "app.connection_package.message.unsupported_file_format": "File format error: only GoNavi recovery packages, legacy JSON connection arrays, or MySQL Workbench XML are supported", + "app.connection_package.message.unsupported_file_format": "File format error: only GoNavi recovery packages, legacy JSON connection arrays, MySQL Workbench XML, or Navicat NCX are supported", "app.connection.message.editable_load_failed": "Failed to load the saved connection details. The masked configuration will be opened instead.", "app.connection.message.editable_load_failed_with_detail": "Failed to load the saved connection details: {{detail}}. The masked configuration will be opened instead.", "app.data_root.action.migrate_and_switch": "Migrate Existing Data and Switch", diff --git a/shared/i18n/ja-JP.json b/shared/i18n/ja-JP.json index eed9e5e2..804c2843 100644 --- a/shared/i18n/ja-JP.json +++ b/shared/i18n/ja-JP.json @@ -2489,7 +2489,7 @@ "app.connection_package.message.imported_connections": "{{count}} 件の接続をインポートしました", "app.connection_package.message.imported_with_missing_passwords": "{{count}} 件の接続をインポートしました。一部の接続にはパスワードが含まれていません。該当する接続を編集し、パスワードを入力して保存してください。", "app.connection_package.message.no_connections_to_export": "エクスポートできる接続がありません", - "app.connection_package.message.unsupported_file_format": "ファイル形式エラー: GoNavi 復元パッケージ、履歴 JSON 接続配列、または MySQL Workbench XML のみ対応しています", + "app.connection_package.message.unsupported_file_format": "ファイル形式エラー: GoNavi 復元パッケージ、履歴 JSON 接続配列、MySQL Workbench XML、または Navicat NCX のみ対応しています", "app.connection.message.editable_load_failed": "保存済み接続の詳細を読み込めませんでした。代わりにマスク済み設定を開きます。", "app.connection.message.editable_load_failed_with_detail": "保存済み接続の詳細を読み込めませんでした: {{detail}}。代わりにマスク済み設定を開きます。", "app.data_root.action.migrate_and_switch": "既存データを移行して切り替え", diff --git a/shared/i18n/ru-RU.json b/shared/i18n/ru-RU.json index d203a602..3738a4cd 100644 --- a/shared/i18n/ru-RU.json +++ b/shared/i18n/ru-RU.json @@ -2489,7 +2489,7 @@ "app.connection_package.message.imported_connections": "Импортировано подключений: {{count}}", "app.connection_package.message.imported_with_missing_passwords": "Импортировано подключений: {{count}}. В некоторых подключениях нет паролей; отредактируйте эти подключения, введите пароли и сохраните.", "app.connection_package.message.no_connections_to_export": "Нет подключений для экспорта", - "app.connection_package.message.unsupported_file_format": "Ошибка формата файла: поддерживаются только пакеты восстановления GoNavi, старые массивы подключений JSON или MySQL Workbench XML", + "app.connection_package.message.unsupported_file_format": "Ошибка формата файла: поддерживаются только пакеты восстановления GoNavi, старые массивы подключений JSON, MySQL Workbench XML или Navicat NCX", "app.connection.message.editable_load_failed": "Не удалось загрузить сведения сохраненного подключения. Вместо этого будет открыта маскированная конфигурация.", "app.connection.message.editable_load_failed_with_detail": "Не удалось загрузить сведения сохраненного подключения: {{detail}}. Вместо этого будет открыта маскированная конфигурация.", "app.data_root.action.migrate_and_switch": "Перенести существующие данные и переключиться", diff --git a/shared/i18n/zh-CN.json b/shared/i18n/zh-CN.json index 0d779c55..99e78f85 100644 --- a/shared/i18n/zh-CN.json +++ b/shared/i18n/zh-CN.json @@ -2489,7 +2489,7 @@ "app.connection_package.message.imported_connections": "成功导入 {{count}} 个连接", "app.connection_package.message.imported_with_missing_passwords": "成功导入 {{count}} 个连接,部分连接未包含密码,请编辑对应连接并输入密码后保存", "app.connection_package.message.no_connections_to_export": "没有连接可导出", - "app.connection_package.message.unsupported_file_format": "文件格式错误:仅支持 GoNavi 恢复包、历史 JSON 连接数组或 MySQL Workbench XML", + "app.connection_package.message.unsupported_file_format": "文件格式错误:仅支持 GoNavi 恢复包、历史 JSON 连接数组、MySQL Workbench XML 或 Navicat NCX", "app.connection.message.editable_load_failed": "读取已保存连接详情失败,当前将打开脱敏配置", "app.connection.message.editable_load_failed_with_detail": "读取已保存连接详情失败:{{detail}},当前将打开脱敏配置", "app.data_root.action.migrate_and_switch": "迁移现有数据并切换", diff --git a/shared/i18n/zh-TW.json b/shared/i18n/zh-TW.json index ef4183a0..1d770d7d 100644 --- a/shared/i18n/zh-TW.json +++ b/shared/i18n/zh-TW.json @@ -2489,7 +2489,7 @@ "app.connection_package.message.imported_connections": "成功匯入 {{count}} 個連線", "app.connection_package.message.imported_with_missing_passwords": "成功匯入 {{count}} 個連線,部分連線未包含密碼,請編輯對應連線並輸入密碼後儲存", "app.connection_package.message.no_connections_to_export": "沒有連線可匯出", - "app.connection_package.message.unsupported_file_format": "檔案格式錯誤:僅支援 GoNavi 恢復包、歷史 JSON 連線陣列或 MySQL Workbench XML", + "app.connection_package.message.unsupported_file_format": "檔案格式錯誤:僅支援 GoNavi 恢復包、歷史 JSON 連線陣列、MySQL Workbench XML 或 Navicat NCX", "app.connection.message.editable_load_failed": "讀取已儲存連線詳情失敗,將改為開啟脫敏設定", "app.connection.message.editable_load_failed_with_detail": "讀取已儲存連線詳情失敗:{{detail}},將改為開啟脫敏設定", "app.data_root.action.migrate_and_switch": "遷移现有資料并切换",