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