refactor: translate UI messages to French
This commit is contained in:
@@ -9,19 +9,19 @@ export async function generateCommitMsg(scm?: vscode.SourceControl): Promise<voi
|
||||
try {
|
||||
const gitExtension = vscode.extensions.getExtension("vscode.git")?.exports
|
||||
if (!gitExtension) {
|
||||
throw new Error("Git extension not found")
|
||||
throw new Error("Extension Git introuvable")
|
||||
}
|
||||
|
||||
const git = gitExtension.getAPI(1)
|
||||
if (git.repositories.length === 0) {
|
||||
throw new Error("No Git repositories available")
|
||||
throw new Error("Aucun dépôt Git disponible")
|
||||
}
|
||||
|
||||
// If invoked from SCM panel button, a specific repo is provided
|
||||
if (scm) {
|
||||
const repository = git.getRepository(scm.rootUri)
|
||||
if (!repository) {
|
||||
throw new Error("Repository not found for the selected SCM")
|
||||
throw new Error("Dépôt introuvable pour le SCM sélectionné")
|
||||
}
|
||||
await generateForRepository(repository)
|
||||
return
|
||||
@@ -45,7 +45,7 @@ async function orchestrateMultiRepo(repos: unknown[]): Promise<void> {
|
||||
const reposWithChanges = await filterReposWithChanges(repos)
|
||||
|
||||
if (reposWithChanges.length === 0) {
|
||||
vscode.window.showInformationMessage("[Zemit] No changes found in any repository.")
|
||||
vscode.window.showInformationMessage("[Zemit] Aucune modification trouvée dans les dépôts.")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -62,12 +62,12 @@ async function orchestrateMultiRepo(repos: unknown[]): Promise<void> {
|
||||
|
||||
items.unshift({
|
||||
label: "$(git-commit) All repositories with changes",
|
||||
description: `Generate for ${reposWithChanges.length} repositories`,
|
||||
description: `Générer pour ${reposWithChanges.length} dépôts`,
|
||||
repo: null as any,
|
||||
})
|
||||
|
||||
const selection = await vscode.window.showQuickPick(items, {
|
||||
placeHolder: "Select a repository to generate a commit message for",
|
||||
placeHolder: "Sélectionner un dépôt pour générer un message de commit",
|
||||
})
|
||||
|
||||
if (!selection) return
|
||||
@@ -104,7 +104,7 @@ async function generateForRepository(repository: any): Promise<void> {
|
||||
await vscode.window.withProgress(
|
||||
{
|
||||
location: vscode.ProgressLocation.SourceControl,
|
||||
title: `Zemit: Generating commit message for ${repoName}...`,
|
||||
title: `Zemit : Génération du message de commit pour ${repoName}...`,
|
||||
cancellable: true,
|
||||
},
|
||||
(_progress, token) => performGeneration(repository.inputBox, diff, token),
|
||||
@@ -147,7 +147,7 @@ async function performGeneration(
|
||||
}
|
||||
|
||||
if (!inputBox.value) {
|
||||
throw new Error("The AI returned an empty response")
|
||||
throw new Error("L'IA n'a retourné aucune réponse")
|
||||
}
|
||||
} finally {
|
||||
await vscode.commands.executeCommand("setContext", "zemit.isGenerating", false)
|
||||
|
||||
+5
-5
@@ -18,7 +18,7 @@ async function selectModel(): Promise<void> {
|
||||
let models: string[]
|
||||
try {
|
||||
models = await vscode.window.withProgress(
|
||||
{ location: vscode.ProgressLocation.Notification, title: "Zemit: Fetching available models…", cancellable: false },
|
||||
{ location: vscode.ProgressLocation.Notification, title: "Zemit : Récupération des modèles disponibles…", cancellable: false },
|
||||
() => fetchAvailableModels(config),
|
||||
)
|
||||
} catch (err) {
|
||||
@@ -28,25 +28,25 @@ async function selectModel(): Promise<void> {
|
||||
}
|
||||
|
||||
if (models.length === 0) {
|
||||
vscode.window.showWarningMessage("[Zemit] No models found for the configured provider.")
|
||||
vscode.window.showWarningMessage("[Zemit] Aucun modèle trouvé pour le fournisseur configuré.")
|
||||
return
|
||||
}
|
||||
|
||||
const currentModel = config.get<string>("model", "")
|
||||
const items = models.map((id) => ({
|
||||
label: id,
|
||||
description: id === currentModel ? "current" : undefined,
|
||||
description: id === currentModel ? "actuel" : undefined,
|
||||
}))
|
||||
|
||||
const picked = await vscode.window.showQuickPick(items, {
|
||||
placeHolder: "Select a model",
|
||||
placeHolder: "Sélectionner un modèle",
|
||||
matchOnDescription: false,
|
||||
})
|
||||
|
||||
if (!picked) return
|
||||
|
||||
await config.update("model", picked.label, vscode.ConfigurationTarget.Global)
|
||||
vscode.window.showInformationMessage(`[Zemit] Model set to ${picked.label}`)
|
||||
vscode.window.showInformationMessage(`[Zemit] Modèle défini sur ${picked.label}`)
|
||||
}
|
||||
|
||||
export function deactivate(): void {}
|
||||
|
||||
+3
-3
@@ -32,10 +32,10 @@ async function hasCommits(cwd: string): Promise<boolean> {
|
||||
|
||||
export async function getGitDiff(cwd: string, stagedOnly = false): Promise<string> {
|
||||
if (!(await isGitInstalled())) {
|
||||
throw new Error("Git is not installed")
|
||||
throw new Error("Git n'est pas installé")
|
||||
}
|
||||
if (!(await isGitRepo(cwd))) {
|
||||
throw new Error("Not a git repository")
|
||||
throw new Error("Pas un dépôt git")
|
||||
}
|
||||
|
||||
let diff = ""
|
||||
@@ -72,7 +72,7 @@ export async function getGitDiff(cwd: string, stagedOnly = false): Promise<strin
|
||||
}
|
||||
|
||||
if (!diff) {
|
||||
throw new Error("No changes found to generate a commit message from")
|
||||
throw new Error("Aucune modification trouvée pour générer un message de commit")
|
||||
}
|
||||
|
||||
return diff
|
||||
|
||||
+4
-4
@@ -170,7 +170,7 @@ export function createProvider(config: vscode.WorkspaceConfiguration): AIProvide
|
||||
switch (provider) {
|
||||
case "anthropic": {
|
||||
const baseUrl = customBaseUrl || "https://api.anthropic.com/v1"
|
||||
if (!apiKey) throw new Error("Anthropic API key is required. Set it in Settings → Zemit AI Commit.")
|
||||
if (!apiKey) throw new Error("Clé API Anthropic requise. Configurez-la dans Paramètres → Zemit AI Commit.")
|
||||
return new AnthropicProvider(apiKey, model, baseUrl)
|
||||
}
|
||||
case "ollama": {
|
||||
@@ -179,7 +179,7 @@ export function createProvider(config: vscode.WorkspaceConfiguration): AIProvide
|
||||
}
|
||||
default: {
|
||||
const baseUrl = customBaseUrl || "https://api.openai.com/v1"
|
||||
if (!apiKey) throw new Error("OpenAI API key is required. Set it in Settings → Zemit AI Commit.")
|
||||
if (!apiKey) throw new Error("Clé API OpenAI requise. Configurez-la dans Paramètres → Zemit AI Commit.")
|
||||
return new OpenAICompatibleProvider(apiKey, model, baseUrl)
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ export async function fetchAvailableModels(config: vscode.WorkspaceConfiguration
|
||||
switch (provider) {
|
||||
case "anthropic": {
|
||||
const baseUrl = customBaseUrl || "https://api.anthropic.com/v1"
|
||||
if (!apiKey) throw new Error("Anthropic API key is required. Set it in Settings → Zemit AI Commit.")
|
||||
if (!apiKey) throw new Error("Clé API Anthropic requise. Configurez-la dans Paramètres → Zemit AI Commit.")
|
||||
const response = await fetch(`${baseUrl}/models`, {
|
||||
headers: {
|
||||
"x-api-key": apiKey,
|
||||
@@ -208,7 +208,7 @@ export async function fetchAvailableModels(config: vscode.WorkspaceConfiguration
|
||||
}
|
||||
case "openai": {
|
||||
const baseUrl = customBaseUrl || "https://api.openai.com/v1"
|
||||
if (!apiKey) throw new Error("OpenAI API key is required. Set it in Settings → Zemit AI Commit.")
|
||||
if (!apiKey) throw new Error("Clé API OpenAI requise. Configurez-la dans Paramètres → Zemit AI Commit.")
|
||||
const response = await fetch(`${baseUrl}/models`, {
|
||||
headers: { Authorization: `Bearer ${apiKey}` },
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user