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 {
|
try {
|
||||||
const gitExtension = vscode.extensions.getExtension("vscode.git")?.exports
|
const gitExtension = vscode.extensions.getExtension("vscode.git")?.exports
|
||||||
if (!gitExtension) {
|
if (!gitExtension) {
|
||||||
throw new Error("Git extension not found")
|
throw new Error("Extension Git introuvable")
|
||||||
}
|
}
|
||||||
|
|
||||||
const git = gitExtension.getAPI(1)
|
const git = gitExtension.getAPI(1)
|
||||||
if (git.repositories.length === 0) {
|
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 invoked from SCM panel button, a specific repo is provided
|
||||||
if (scm) {
|
if (scm) {
|
||||||
const repository = git.getRepository(scm.rootUri)
|
const repository = git.getRepository(scm.rootUri)
|
||||||
if (!repository) {
|
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)
|
await generateForRepository(repository)
|
||||||
return
|
return
|
||||||
@@ -45,7 +45,7 @@ async function orchestrateMultiRepo(repos: unknown[]): Promise<void> {
|
|||||||
const reposWithChanges = await filterReposWithChanges(repos)
|
const reposWithChanges = await filterReposWithChanges(repos)
|
||||||
|
|
||||||
if (reposWithChanges.length === 0) {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,12 +62,12 @@ async function orchestrateMultiRepo(repos: unknown[]): Promise<void> {
|
|||||||
|
|
||||||
items.unshift({
|
items.unshift({
|
||||||
label: "$(git-commit) All repositories with changes",
|
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,
|
repo: null as any,
|
||||||
})
|
})
|
||||||
|
|
||||||
const selection = await vscode.window.showQuickPick(items, {
|
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
|
if (!selection) return
|
||||||
@@ -104,7 +104,7 @@ async function generateForRepository(repository: any): Promise<void> {
|
|||||||
await vscode.window.withProgress(
|
await vscode.window.withProgress(
|
||||||
{
|
{
|
||||||
location: vscode.ProgressLocation.SourceControl,
|
location: vscode.ProgressLocation.SourceControl,
|
||||||
title: `Zemit: Generating commit message for ${repoName}...`,
|
title: `Zemit : Génération du message de commit pour ${repoName}...`,
|
||||||
cancellable: true,
|
cancellable: true,
|
||||||
},
|
},
|
||||||
(_progress, token) => performGeneration(repository.inputBox, diff, token),
|
(_progress, token) => performGeneration(repository.inputBox, diff, token),
|
||||||
@@ -147,7 +147,7 @@ async function performGeneration(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!inputBox.value) {
|
if (!inputBox.value) {
|
||||||
throw new Error("The AI returned an empty response")
|
throw new Error("L'IA n'a retourné aucune réponse")
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
await vscode.commands.executeCommand("setContext", "zemit.isGenerating", false)
|
await vscode.commands.executeCommand("setContext", "zemit.isGenerating", false)
|
||||||
|
|||||||
+5
-5
@@ -18,7 +18,7 @@ async function selectModel(): Promise<void> {
|
|||||||
let models: string[]
|
let models: string[]
|
||||||
try {
|
try {
|
||||||
models = await vscode.window.withProgress(
|
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),
|
() => fetchAvailableModels(config),
|
||||||
)
|
)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -28,25 +28,25 @@ async function selectModel(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (models.length === 0) {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentModel = config.get<string>("model", "")
|
const currentModel = config.get<string>("model", "")
|
||||||
const items = models.map((id) => ({
|
const items = models.map((id) => ({
|
||||||
label: id,
|
label: id,
|
||||||
description: id === currentModel ? "current" : undefined,
|
description: id === currentModel ? "actuel" : undefined,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const picked = await vscode.window.showQuickPick(items, {
|
const picked = await vscode.window.showQuickPick(items, {
|
||||||
placeHolder: "Select a model",
|
placeHolder: "Sélectionner un modèle",
|
||||||
matchOnDescription: false,
|
matchOnDescription: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!picked) return
|
if (!picked) return
|
||||||
|
|
||||||
await config.update("model", picked.label, vscode.ConfigurationTarget.Global)
|
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 {}
|
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> {
|
export async function getGitDiff(cwd: string, stagedOnly = false): Promise<string> {
|
||||||
if (!(await isGitInstalled())) {
|
if (!(await isGitInstalled())) {
|
||||||
throw new Error("Git is not installed")
|
throw new Error("Git n'est pas installé")
|
||||||
}
|
}
|
||||||
if (!(await isGitRepo(cwd))) {
|
if (!(await isGitRepo(cwd))) {
|
||||||
throw new Error("Not a git repository")
|
throw new Error("Pas un dépôt git")
|
||||||
}
|
}
|
||||||
|
|
||||||
let diff = ""
|
let diff = ""
|
||||||
@@ -72,7 +72,7 @@ export async function getGitDiff(cwd: string, stagedOnly = false): Promise<strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!diff) {
|
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
|
return diff
|
||||||
|
|||||||
+4
-4
@@ -170,7 +170,7 @@ export function createProvider(config: vscode.WorkspaceConfiguration): AIProvide
|
|||||||
switch (provider) {
|
switch (provider) {
|
||||||
case "anthropic": {
|
case "anthropic": {
|
||||||
const baseUrl = customBaseUrl || "https://api.anthropic.com/v1"
|
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)
|
return new AnthropicProvider(apiKey, model, baseUrl)
|
||||||
}
|
}
|
||||||
case "ollama": {
|
case "ollama": {
|
||||||
@@ -179,7 +179,7 @@ export function createProvider(config: vscode.WorkspaceConfiguration): AIProvide
|
|||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
const baseUrl = customBaseUrl || "https://api.openai.com/v1"
|
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)
|
return new OpenAICompatibleProvider(apiKey, model, baseUrl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ export async function fetchAvailableModels(config: vscode.WorkspaceConfiguration
|
|||||||
switch (provider) {
|
switch (provider) {
|
||||||
case "anthropic": {
|
case "anthropic": {
|
||||||
const baseUrl = customBaseUrl || "https://api.anthropic.com/v1"
|
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`, {
|
const response = await fetch(`${baseUrl}/models`, {
|
||||||
headers: {
|
headers: {
|
||||||
"x-api-key": apiKey,
|
"x-api-key": apiKey,
|
||||||
@@ -208,7 +208,7 @@ export async function fetchAvailableModels(config: vscode.WorkspaceConfiguration
|
|||||||
}
|
}
|
||||||
case "openai": {
|
case "openai": {
|
||||||
const baseUrl = customBaseUrl || "https://api.openai.com/v1"
|
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`, {
|
const response = await fetch(`${baseUrl}/models`, {
|
||||||
headers: { Authorization: `Bearer ${apiKey}` },
|
headers: { Authorization: `Bearer ${apiKey}` },
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user