创建项目失败提示语优化
This commit is contained in:
@@ -40,7 +40,7 @@ import {
|
||||
openFolderWindow,
|
||||
detectPackageManager,
|
||||
} from "@/lib/api"
|
||||
import { toErrorMessage } from "@/lib/app-error"
|
||||
import { extractAppCommandError, toErrorMessage } from "@/lib/app-error"
|
||||
import {
|
||||
BASE_OPTIONS,
|
||||
FRAMEWORK_OPTIONS,
|
||||
@@ -118,7 +118,13 @@ export function CreateProjectDialog({
|
||||
resetForm()
|
||||
await openFolderWindow(projectPath)
|
||||
} catch (err) {
|
||||
const message = toErrorMessage(err)
|
||||
const appErr = extractAppCommandError(err)
|
||||
const message =
|
||||
appErr?.code === "already_exists"
|
||||
? t("errors.directoryExists")
|
||||
: appErr?.code === "external_command_failed"
|
||||
? t("errors.commandFailed")
|
||||
: toErrorMessage(err)
|
||||
setError(message)
|
||||
toast.error(t("toasts.createFailed"), { description: message })
|
||||
} finally {
|
||||
@@ -188,6 +194,13 @@ export function CreateProjectDialog({
|
||||
<FolderOpen className="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
{saveDirectory && projectName.trim() && (
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t("createDialog.projectPath", {
|
||||
path: `${saveDirectory}/${projectName.trim()}`,
|
||||
})}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="space-y-1.5">
|
||||
|
||||
@@ -1607,6 +1607,7 @@
|
||||
"saveDirectory": "دليل الحفظ",
|
||||
"saveDirectoryPlaceholder": "اختر الدليل...",
|
||||
"browseDirectory": "تصفح",
|
||||
"projectPath": "سيتم إنشاء المشروع في: {path}",
|
||||
"advancedOptions": "خيارات متقدمة",
|
||||
"base": "المكتبة الأساسية",
|
||||
"enableRtl": "تفعيل دعم RTL",
|
||||
@@ -1622,7 +1623,7 @@
|
||||
"createSuccess": "تم إنشاء المشروع بنجاح"
|
||||
},
|
||||
"errors": {
|
||||
"directoryExists": "الدليل موجود بالفعل وليس فارغاً.",
|
||||
"directoryExists": "الدليل الهدف موجود بالفعل",
|
||||
"commandFailed": "فشل أمر إنشاء المشروع."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1607,6 +1607,7 @@
|
||||
"saveDirectory": "Speicherverzeichnis",
|
||||
"saveDirectoryPlaceholder": "Verzeichnis auswählen...",
|
||||
"browseDirectory": "Durchsuchen",
|
||||
"projectPath": "Projekt wird erstellt in: {path}",
|
||||
"advancedOptions": "Erweiterte Optionen",
|
||||
"base": "Basisbibliothek",
|
||||
"enableRtl": "RTL-Unterstützung aktivieren",
|
||||
@@ -1622,7 +1623,7 @@
|
||||
"createSuccess": "Projekt erfolgreich erstellt"
|
||||
},
|
||||
"errors": {
|
||||
"directoryExists": "Verzeichnis existiert bereits und ist nicht leer.",
|
||||
"directoryExists": "Zielverzeichnis existiert bereits",
|
||||
"commandFailed": "Projekterstellungsbefehl fehlgeschlagen."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1607,6 +1607,7 @@
|
||||
"saveDirectory": "Save Directory",
|
||||
"saveDirectoryPlaceholder": "Select directory...",
|
||||
"browseDirectory": "Browse",
|
||||
"projectPath": "Project will be created at: {path}",
|
||||
"advancedOptions": "Advanced Options",
|
||||
"base": "Base Library",
|
||||
"enableRtl": "Enable RTL Support",
|
||||
@@ -1622,7 +1623,7 @@
|
||||
"createSuccess": "Project created successfully"
|
||||
},
|
||||
"errors": {
|
||||
"directoryExists": "Directory already exists and is not empty.",
|
||||
"directoryExists": "Target directory already exists",
|
||||
"commandFailed": "Project creation command failed."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1607,6 +1607,7 @@
|
||||
"saveDirectory": "Directorio de guardado",
|
||||
"saveDirectoryPlaceholder": "Seleccionar directorio...",
|
||||
"browseDirectory": "Explorar",
|
||||
"projectPath": "El proyecto se creará en: {path}",
|
||||
"advancedOptions": "Opciones Avanzadas",
|
||||
"base": "Biblioteca Base",
|
||||
"enableRtl": "Habilitar Soporte RTL",
|
||||
@@ -1622,7 +1623,7 @@
|
||||
"createSuccess": "Proyecto creado exitosamente"
|
||||
},
|
||||
"errors": {
|
||||
"directoryExists": "El directorio ya existe y no está vacío.",
|
||||
"directoryExists": "El directorio de destino ya existe",
|
||||
"commandFailed": "El comando de creación del proyecto falló."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1607,6 +1607,7 @@
|
||||
"saveDirectory": "Répertoire de sauvegarde",
|
||||
"saveDirectoryPlaceholder": "Sélectionner un répertoire...",
|
||||
"browseDirectory": "Parcourir",
|
||||
"projectPath": "Le projet sera créé dans : {path}",
|
||||
"advancedOptions": "Options avancées",
|
||||
"base": "Bibliothèque de base",
|
||||
"enableRtl": "Activer le support RTL",
|
||||
@@ -1622,7 +1623,7 @@
|
||||
"createSuccess": "Projet créé avec succès"
|
||||
},
|
||||
"errors": {
|
||||
"directoryExists": "Le répertoire existe déjà et n'est pas vide.",
|
||||
"directoryExists": "Le répertoire cible existe déjà",
|
||||
"commandFailed": "La commande de création du projet a échoué."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1607,6 +1607,7 @@
|
||||
"saveDirectory": "保存先ディレクトリ",
|
||||
"saveDirectoryPlaceholder": "ディレクトリを選択...",
|
||||
"browseDirectory": "参照",
|
||||
"projectPath": "プロジェクトの作成先:{path}",
|
||||
"advancedOptions": "詳細オプション",
|
||||
"base": "基盤ライブラリ",
|
||||
"enableRtl": "RTL サポートを有効にする",
|
||||
@@ -1622,7 +1623,7 @@
|
||||
"createSuccess": "プロジェクトが正常に作成されました"
|
||||
},
|
||||
"errors": {
|
||||
"directoryExists": "ディレクトリは既に存在し、空ではありません。",
|
||||
"directoryExists": "対象ディレクトリは既に存在します",
|
||||
"commandFailed": "プロジェクト作成コマンドが失敗しました。"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1607,6 +1607,7 @@
|
||||
"saveDirectory": "저장 디렉토리",
|
||||
"saveDirectoryPlaceholder": "디렉토리 선택...",
|
||||
"browseDirectory": "찾아보기",
|
||||
"projectPath": "프로젝트 생성 위치: {path}",
|
||||
"advancedOptions": "고급 옵션",
|
||||
"base": "기본 라이브러리",
|
||||
"enableRtl": "RTL 지원 활성화",
|
||||
@@ -1622,7 +1623,7 @@
|
||||
"createSuccess": "프로젝트가 성공적으로 생성되었습니다"
|
||||
},
|
||||
"errors": {
|
||||
"directoryExists": "디렉토리가 이미 존재하며 비어 있지 않습니다.",
|
||||
"directoryExists": "대상 디렉터리가 이미 존재합니다",
|
||||
"commandFailed": "프로젝트 생성 명령이 실패했습니다."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1607,6 +1607,7 @@
|
||||
"saveDirectory": "Diretório de salvamento",
|
||||
"saveDirectoryPlaceholder": "Selecionar diretório...",
|
||||
"browseDirectory": "Procurar",
|
||||
"projectPath": "O projeto será criado em: {path}",
|
||||
"advancedOptions": "Opções Avançadas",
|
||||
"base": "Biblioteca Base",
|
||||
"enableRtl": "Ativar Suporte RTL",
|
||||
@@ -1622,7 +1623,7 @@
|
||||
"createSuccess": "Projeto criado com sucesso"
|
||||
},
|
||||
"errors": {
|
||||
"directoryExists": "O diretório já existe e não está vazio.",
|
||||
"directoryExists": "O diretório de destino já existe",
|
||||
"commandFailed": "O comando de criação do projeto falhou."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1607,6 +1607,7 @@
|
||||
"saveDirectory": "保存目录",
|
||||
"saveDirectoryPlaceholder": "选择目录...",
|
||||
"browseDirectory": "浏览",
|
||||
"projectPath": "项目将创建在:{path}",
|
||||
"advancedOptions": "高级选项",
|
||||
"base": "基础库",
|
||||
"enableRtl": "启用 RTL 支持",
|
||||
@@ -1622,7 +1623,7 @@
|
||||
"createSuccess": "项目创建成功"
|
||||
},
|
||||
"errors": {
|
||||
"directoryExists": "目录已存在且不为空。",
|
||||
"directoryExists": "目标目录已存在",
|
||||
"commandFailed": "项目创建命令执行失败。"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1607,6 +1607,7 @@
|
||||
"saveDirectory": "儲存目錄",
|
||||
"saveDirectoryPlaceholder": "選擇目錄...",
|
||||
"browseDirectory": "瀏覽",
|
||||
"projectPath": "專案將建立在:{path}",
|
||||
"advancedOptions": "進階選項",
|
||||
"base": "基礎庫",
|
||||
"enableRtl": "啟用 RTL 支援",
|
||||
@@ -1622,7 +1623,7 @@
|
||||
"createSuccess": "專案建立成功"
|
||||
},
|
||||
"errors": {
|
||||
"directoryExists": "目錄已存在且不為空。",
|
||||
"directoryExists": "目標目錄已存在",
|
||||
"commandFailed": "專案建立命令執行失敗。"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user