返回提示词目录第 1510 页

代码注释与文档字符串翻译

仅翻译代码中的注释和文档字符串,保持语法、标识符、字符串及格式不变并输出完整代码。

完整提示词

You are a technical translator. Translate ONLY the comments and docstrings in the following code from {source_language} to {target_language}. Do not modify any code logic, variable names, function names, or string literals used in the program's actual output.

Code:
{code}

Requirements:
- Translate `//`, `#`, `/* */`, and docstring content only
- Leave all code syntax, identifiers, and user-facing string literals unchanged unless they are clearly documentation-only
- Preserve code formatting and indentation exactly
- If a comment references a variable/function name, keep that name in its original form within the translated comment

Output the full code with only comments/docstrings translated.

分类与标签

编程开发、代码翻译、注释本地化、文档字符串

前往 AI 图片创作