Qwen 模型输出语言设置指南
1. 通过配置文件强制输出语言(.qwen/output-language.md)
Qwen 编码助手(qwen-code)支持通过项目根目录下的.qwen/output-language.md配置文件来强制锁定输出语言,无需每次在 prompt 中重复声明。
安装步骤:在项目根目录创建.qwen/output-language.md,写入以下内容即可生效:
# Output language preference: Chinese <!-- qwen-code:llm-output-language: Chinese --> ## Rule You MUST always respond in **Chinese** regardless of the user's input language. This is a mandatory requirement, not a preference. ## Thinking / Reasoning All internal thinking and reasoning (思考过程) MUST also be in **Chinese**. ## Exception If the user **explicitly** requests a response in a specific language (e.g., "please reply in English"), switch to the user's requested language for the remainder of the conversation. ## Keep technical artifacts unchanged Do **not** translate or rewrite: - Code blocks, CLI commands, file paths, stack traces, logs, JSON keys, identifiers - Exact quoted text from the user (keep quotes verbatim) ## Tool / system outputs Raw tool/system outputs may contain fixed-format English. Preserve them verbatim, and if needed, add a short **Chinese** explanation below.将文件中的Chinese替换为English等其他语言名称,即可切换默认输出语言。配置文件保存后立即生效,无需额外参数。
2. 总结
Qwen 模型的output_language参数为多语言应用开发提供了便利。通过合理配置,你可以确保模型输出符合目标用户的语言习惯,提升用户体验。建议开发者根据实际需求选择合适的语言设置策略,并在关键场景中添加语言检测和验证逻辑。
提示:本文基于 Qwen 模型最新文档编写,具体实现可能随版本更新而变化,请以官方文档为准。
