Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/short-geckos-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"kilo-code": patch
"@kilocode/cli": patch
---

Generate commit messages in the user's selected UI language instead of always using English.
51 changes: 51 additions & 0 deletions packages/kilo-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,57 @@
"Italiano"
]
},
"kilo-code.new.languageCommitMessage": {
"type": "string",
"default": "sync",
"description": "Language used for AI-generated commit messages. Choose 'sync' to follow the Kilo Code UI language, or select a specific language.",
"enum": [
"sync",
"en",
"zh",
"zht",
"ko",
"de",
"es",
"fr",
"da",
"ja",
"pl",
"ru",
"ar",
"no",
"br",
"th",
"bs",
"tr",
"nl",
"uk",
"it"
],
"enumDescriptions": [
"跟随界面语言 (Sync with UI language)",
"English",
"简体中文",
"繁體中文",
"한국어",
"Deutsch",
"Español",
"Français",
"Dansk",
"日本語",
"Polski",
"Русский",
"العربية",
"Norsk",
"Português (Brasil)",
"ภาษาไทย",
"Bosanski",
"Türkçe",
"Nederlands",
"Українська",
"Italiano"
]
},
"kilo-code.new.model.providerID": {
"type": "string",
"default": "kilo",
Expand Down
16 changes: 10 additions & 6 deletions packages/kilo-vscode/src/KiloProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2418,7 +2418,7 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
config,
globalConfig: global,
projectConfig: overlay?.project,
settings: { maxCost: this.maxCostSetting() },
settings: { maxCost: this.maxCostSetting(), languageCommitMessage: this.commitMessageLanguageSetting() },
features: configFeatures(config),
}
this.cachedConfigMessage = message
Expand Down Expand Up @@ -2514,15 +2514,15 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
config,
globalConfig: global,
projectConfig: overlay?.project,
settings: { maxCost: this.maxCostSetting() },
settings: { maxCost: this.maxCostSetting(), languageCommitMessage: this.commitMessageLanguageSetting() },
features: configFeatures(config),
}
this.postMessage({
type: "configUpdated",
config,
globalConfig: global,
projectConfig: overlay?.project,
settings: { maxCost: this.maxCostSetting() },
settings: { maxCost: this.maxCostSetting(), languageCommitMessage: this.commitMessageLanguageSetting() },
features: configFeatures(config),
})
} catch (error) {
Expand Down Expand Up @@ -2904,15 +2904,15 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
config: merged,
globalConfig: global,
projectConfig: overlay?.project,
settings: { maxCost: this.maxCostSetting() },
settings: { maxCost: this.maxCostSetting(), languageCommitMessage: this.commitMessageLanguageSetting() },
features: configFeatures(merged),
}
this.postMessage({
type: "configUpdated",
config: merged,
globalConfig: global,
projectConfig: overlay?.project,
settings: { maxCost: this.maxCostSetting() },
settings: { maxCost: this.maxCostSetting(), languageCommitMessage: this.commitMessageLanguageSetting() },
features: configFeatures(merged),
})
this.requirements.clear()
Expand All @@ -2934,7 +2934,7 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
type: "configUpdated",
config: optimistic,
globalConfig: this.cachedGlobalConfig ?? undefined,
settings: { maxCost: this.maxCostSetting() },
settings: { maxCost: this.maxCostSetting(), languageCommitMessage: this.commitMessageLanguageSetting() },
features: features ?? configFeatures(optimistic as Config),
})
this.requirements.clear()
Expand Down Expand Up @@ -3075,6 +3075,10 @@ export class KiloProvider implements vscode.WebviewViewProvider, TelemetryProper
return this.setMaxCost(vscode.workspace.getConfiguration("kilo-code.new").get<number>("maxCost", 0))
}

private commitMessageLanguageSetting(): string {
return vscode.workspace.getConfiguration("kilo-code.new").get<string>("languageCommitMessage", "sync")
}

private setMaxCost(value: unknown): number {
maxCost = MaxCostNudge.normalizeLimit(typeof value === "number" ? value : Number(value)) ?? 0
this.costs.setLimit(maxCost)
Expand Down
3 changes: 2 additions & 1 deletion packages/kilo-vscode/src/services/commit-message/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as vscode from "vscode"
import type { KiloConnectionService } from "../cli-backend/connection-service"
import { getErrorMessage } from "../../kilo-provider-utils"
import { getCommitMessageLanguage } from "../i18n"

let lastGeneratedMessage: string | undefined
let lastWorkspacePath: string | undefined
Expand Down Expand Up @@ -94,7 +95,7 @@ export function registerCommitMessageService(

try {
const { data } = await client.commitMessage.generate(
{ path, selectedFiles: undefined, previousMessage },
{ path, selectedFiles: undefined, previousMessage, language: getCommitMessageLanguage(vscode) },
{ throwOnError: true, signal: controller.signal },
)
const message = data.message
Expand Down
7 changes: 7 additions & 0 deletions packages/kilo-vscode/src/services/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ export function selectedLocale(vscode: typeof import("vscode")): string {
return resolveLocale(lang || vscode.env.language)
}

export function getCommitMessageLanguage(vscode: typeof import("vscode")): string {
const cfg = vscode.workspace.getConfiguration("kilo-code.new")
const commitLang = cfg.get<string>("languageCommitMessage") ?? "sync"
if (commitLang === "sync") return selectedLocale(vscode)
return resolveLocale(commitLang)
}

export function translate(
locale: string,
key: keyof typeof enDict | string,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
import { Component, Show, createSignal } from "solid-js"
import { Component, Show, createSignal, createMemo } from "solid-js"
import { Switch } from "@kilocode/kilo-ui/switch"
import { TextField } from "@kilocode/kilo-ui/text-field"
import { Card } from "@kilocode/kilo-ui/card"
import { Select } from "@kilocode/kilo-ui/select"
import { useConfig } from "../../context/config"
import { useLanguage } from "../../context/language"
import { useLanguage, LOCALES, LOCALE_LABELS } from "../../context/language"
import type { Locale } from "../../context/language"
import SettingsRow from "./SettingsRow"

const SYNC = "sync"
const opts = [SYNC, ...LOCALES] as const
type Option = typeof SYNC | Locale

const CommitMessageTab: Component = () => {
const { config, updateConfig } = useConfig()
const { config, updateConfig, settings, updateSetting } = useConfig()
const language = useLanguage()

const langValue = () => settings().languageCommitMessage ?? SYNC

const [expanded, setExpanded] = createSignal(Boolean(config().commit_message?.prompt))

const toggle = (checked: boolean) => {
Expand All @@ -19,9 +27,46 @@ const CommitMessageTab: Component = () => {
}
}

const label = (opt: Option) =>
opt === SYNC ? language.t("settings.commitMessage.language.sync") : LOCALE_LABELS[opt]

const value = (opt: Option) => opt

const onSelect = (opt: Option | undefined) => {
if (opt !== undefined) updateSetting("languageCommitMessage", opt)
}

const currentLabel = createMemo(() => label(langValue() as Option))

return (
<div>
<Card>
<Card>
<div style={{ padding: "16px" }}>
<p style={{ "font-size": "var(--kilo-font-size-13)", "margin-bottom": "12px" }}>
{language.t("settings.commitMessage.language.description")}
</p>
<Select
options={[...opts]}
current={langValue() as Option}
label={label}
value={value}
onSelect={onSelect}
variant="secondary"
size="large"
/>
<p
style={{
"font-size": "var(--kilo-font-size-12)",
color: "var(--vscode-descriptionForeground)",
"margin-top": "8px",
}}
>
{language.t("settings.language.current")} {currentLabel()}
</p>
</div>

<div style={{ "border-bottom": "1px solid var(--border-weak-base)" }} />

<div style={{ padding: "16px" }}>
<SettingsRow
title={language.t("settings.commitMessage.override.title")}
description={language.t("settings.commitMessage.override.description")}
Expand Down Expand Up @@ -52,8 +97,8 @@ const CommitMessageTab: Component = () => {
</div>
</div>
</Show>
</Card>
</div>
</div>
</Card>
)
}

Expand Down
5 changes: 5 additions & 0 deletions packages/kilo-vscode/webview-ui/src/i18n/ar.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/kilo-vscode/webview-ui/src/i18n/br.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/kilo-vscode/webview-ui/src/i18n/bs.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/kilo-vscode/webview-ui/src/i18n/da.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/kilo-vscode/webview-ui/src/i18n/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1668,6 +1668,11 @@ export const dict = {
"settings.commitMessage.prompt.placeholder":
"z. B. Generiere commit messages auf Spanisch nach dem conventional commits Format. Gib NUR die commit message zurück.",

"settings.commitMessage.language.sync": "Synchronisieren mit Benutzeroberflächensprache",
"settings.commitMessage.language.title": "Sprache",
"settings.commitMessage.language.description":
"Wählen Sie, welche Sprache für KI-generierte Commit-Nachrichten verwendet werden soll:",

"settings.display.username.title": "Benutzername",
"settings.display.username.description": "Benutzerdefinierter Benutzername in Gesprächen",
"settings.display.fontSize.title": "Schriftgröße",
Expand Down
5 changes: 5 additions & 0 deletions packages/kilo-vscode/webview-ui/src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,11 @@ export const dict = {
"settings.commitMessage.prompt.placeholder":
"e.g. Generate commit messages in Spanish following conventional commits format. Return ONLY the commit message.",

"settings.commitMessage.language.sync": "Sync with UI language",
"settings.commitMessage.language.title": "Language",
"settings.commitMessage.language.description":
"Choose which language to use for AI-generated commit messages:",

"settings.display.username.title": "Username",
"settings.display.username.description": "Custom username displayed in conversations",
"settings.display.fontSize.title": "Font Size",
Expand Down
5 changes: 5 additions & 0 deletions packages/kilo-vscode/webview-ui/src/i18n/es.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/kilo-vscode/webview-ui/src/i18n/fr.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions packages/kilo-vscode/webview-ui/src/i18n/it.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/kilo-vscode/webview-ui/src/i18n/ja.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/kilo-vscode/webview-ui/src/i18n/ko.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/kilo-vscode/webview-ui/src/i18n/nl.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading