feat: add commit language option for commit message localization

This commit is contained in:
Kyosuke Takayama 2025-06-01 18:52:38 +09:00
parent 0bb0f169d2
commit 7ffd9c1859
No known key found for this signature in database
GPG key ID: 6A3B72186859843B
4 changed files with 13 additions and 1 deletions

View file

@ -731,6 +731,12 @@ def get_parser(default_config_files, git_root):
default=None,
help="Specify the language to use in the chat (default: None, uses system settings)",
)
group.add_argument(
"--commit-language",
metavar="COMMIT_LANGUAGE",
default=None,
help="Specify the language to use in the commit message (default: None, user language)",
)
group.add_argument(
"--yes-always",
action="store_true",

View file

@ -118,6 +118,7 @@ class Coder:
detect_urls = True
ignore_mentions = None
chat_language = None
commit_language = None
file_watcher = None
@classmethod
@ -328,6 +329,7 @@ class Coder:
num_cache_warming_pings=0,
suggest_shell_commands=True,
chat_language=None,
commit_language=None,
detect_urls=True,
ignore_mentions=None,
total_tokens_sent=0,
@ -341,6 +343,7 @@ class Coder:
self.event = self.analytics.event
self.chat_language = chat_language
self.commit_language = commit_language
self.commit_before_message = []
self.aider_commit_hashes = set()
self.rejected_urls = set()

View file

@ -993,6 +993,7 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
num_cache_warming_pings=args.cache_keepalive_pings,
suggest_shell_commands=args.suggest_shell_commands,
chat_language=args.chat_language,
commit_language=args.commit_language,
detect_urls=args.detect_urls,
auto_copy_context=args.copy_paste,
auto_accept_architect=args.auto_accept_architect,

View file

@ -210,7 +210,9 @@ class GitRepo:
else:
user_language = None
if coder:
user_language = coder.get_user_language()
user_language = coder.commit_language
if not user_language:
user_language = coder.get_user_language()
commit_message = self.get_commit_message(diffs, context, user_language)
# Retrieve attribute settings, prioritizing coder.args if available