From c517406d9846f788504b7aaf8b234aa60cdfa2f6 Mon Sep 17 00:00:00 2001 From: kooo5252 Date: Wed, 18 Oct 2023 23:35:09 +0900 Subject: [PATCH] i18n support --- src/gpt_review/_ask.py | 5 +++++ src/gpt_review/constants.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/gpt_review/_ask.py b/src/gpt_review/_ask.py index 9461de0a..d603dbe6 100644 --- a/src/gpt_review/_ask.py +++ b/src/gpt_review/_ask.py @@ -1,4 +1,5 @@ """Ask GPT a question.""" +import os import logging from typing import Dict, List, Optional @@ -103,6 +104,10 @@ def _ask( prompt = "".join(question) + response_lang = os.getenv("RESPONSE_LANG") + if response_lang: + prompt = "Please reply in " + response_lang + prompt + if files or directory or repository: response = _query_index( prompt, diff --git a/src/gpt_review/constants.py b/src/gpt_review/constants.py index e1a87630..220417ab 100644 --- a/src/gpt_review/constants.py +++ b/src/gpt_review/constants.py @@ -37,3 +37,5 @@ BUG_PROMPT_YAML = "prompt_bug.yaml" COVERAGE_PROMPT_YAML = "prompt_coverage.yaml" SUMMARY_PROMPT_YAML = "prompt_summary.yaml" + +RESPONSE_LANG = None \ No newline at end of file