Improve translator
Some checks failed
Build / Bazel, cl, windows-latest (push) Has been cancelled
Build / Bazel, clang++, macos-latest (push) Has been cancelled
Build / Bazel, clang++, ubuntu-latest (push) Has been cancelled
Build / Bazel, g++, macos-latest (push) Has been cancelled
Build / Bazel, g++, ubuntu-latest (push) Has been cancelled
Build / CMake, cl, windows-latest (push) Has been cancelled
Build / CMake, gcc, ubuntu-latest (push) Has been cancelled
Build / CMake, llvm, ubuntu-latest (push) Has been cancelled
Build / CMake, llvm, macos-latest (push) Has been cancelled
Build / Test modules (llvm, ubuntu-latest) (push) Has been cancelled
Documentation / documentation (push) Has been cancelled

This commit is contained in:
ArthurSonzogni
2025-12-06 11:00:35 +01:00
parent 183a426efa
commit c8fbef03c9

View File

@@ -150,7 +150,8 @@ limiter = RateLimiter(LIMIT_RPM, LIMIT_TPM)
# Prompts # Prompts
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
AGENT_NEW_FILE_PROMPT = """\ AGENT_NEW_FILE_PROMPT = """\
You are an autonomous documentation translator. You are an autonomous documentation translator. You are translating the FTXUI
C++ library from English into {lang_name} ("{lang_code}").
GOAL GOAL
- Translate a single, NEW file to {lang_name} ("{lang_code}"). - Translate a single, NEW file to {lang_name} ("{lang_code}").
@@ -173,7 +174,8 @@ TOOLS: {allowed_tools}.
""" """
AGENT_DIFF_FILE_PROMPT = """\ AGENT_DIFF_FILE_PROMPT = """\
You are an autonomous documentation translator. You are an autonomous documentation translator. You are translating the FTXUI
C++ library from English into {lang_name} ("{lang_code}").
GOAL GOAL
- Update existing translation: {tx_root}/{rel_path} - Update existing translation: {tx_root}/{rel_path}
@@ -195,6 +197,16 @@ WORKFLOW
4. ONLY update text where the source changed. 4. ONLY update text where the source changed.
5. DO NOT translate code. 5. DO NOT translate code.
RULES:
1. Translate ONLY documentation:
* C++ comments (//, /* ... */)
* Doxygen comments (///, /** ... */).
* Prose in Markdown.
2. DO NOT translate/modify:
* C/C++ code, identifiers, includes, macros.
* Doxygen commands/params.
* Markdown code fences/URLs.
TOOLS: {allowed_tools}. TOOLS: {allowed_tools}.
""" """
@@ -404,8 +416,14 @@ def main() -> None:
all_files.sort() all_files.sort()
for lang_code in args.langs: for lang_code in args.langs:
lang_name = LANG_NAMES.get(lang_code, lang_code) lang_name = LANG_NAMES.get(lang_code, "")
print_step(f"Processing Language: {lang_name} ({lang_code})") print_step(f"Processing Language: {lang_name} ({lang_code})")
if not lang_name:
exit_msg = f"Unknown language code: {lang_code}. Please update LANG_NAMES dictionary."
print_err(exit_msg)
sys.exit(1)
checkout_or_create_branch(tx_dir, lang_code) checkout_or_create_branch(tx_dir, lang_code)