Output language preference: 中文
Output language preference: 中文【免费下载链接】qwen-codeAn open-source AI coding agent that lives in your terminal.项目地址: https://gitcode.com/GitHub_Trending/qw/qwen-codeRuleYou MUST always respond in中文regardless of the users input language. This is a mandatory requirement, not a preference.ExceptionIf the userexplicitlyrequests a response in a specific language (e.g., please reply in English, 用中文回答), switch to the users requested language for the remainder of the conversation.Keep technical artifacts unchangedDonottranslate or rewrite:Code blocks, CLI commands, file paths, stack traces, logs, JSON keys, identifiersExact quoted text from the user (keep quotes verbatim)Tool / system outputsRaw tool/system outputs may contain fixed-format English. Preserve them verbatim, and if needed, add a short中文explanation below.[](https://link.gitcode.com/i/d98ef0edb497f9293693142933993b1a) *Qwen Code多语言支持架构从界面语言到输出语言的完整本地化流程* ## 实践指南5步实现中文环境配置 ### 步骤1一键切换中文界面 使用/language命令快速配置中文环境 bash # 查看当前语言状态 /language # 切换UI界面为简体中文 /language ui zh-CN # 设置LLM输出语言为中文 /language output 中文步骤2系统语言自动检测Qwen Code能够自动检测操作系统语言设置。如果你的系统语言是中文首次启动时会自动配置// 自动检测逻辑示例 function detectSystemLanguage() { const systemLang navigator.language || en-US; if (systemLang.startsWith(zh)) { return zh-CN; } return en-US; }步骤3项目级语言配置对于团队项目可以在项目根目录创建.qwen/output-language.md文件实现项目级别的语言配置# 项目级输出语言规则 !-- qwen-code:llm-output-language: 中文 -- 本项目要求所有AI响应使用中文除非用户明确指定其他语言。步骤4中文翻译文件管理Qwen Code的中文翻译文件位于中文翻译文件包含所有界面文本的本地化// 中文翻译示例 export default { Cannot disable an extension-provided MCP server here.: 无法在此处禁用扩展提供的 MCP 服务器。, Cleared authentication for {{name}}.: 已清空 {{name}} 的认证信息。, MCP {{name}} disabled for all projects.: MCP {{name}} 已在所有项目中禁用。, // 更多翻译... };步骤5验证配置生效配置完成后通过以下命令验证语言设置# 验证UI语言 /language # 输出示例 # 当前 UI 语言Chinesezh-CN # 当前 LLM 输出语言中文 # 测试中文对话 你好请帮我写一个Python函数来计算斐波那契数列Qwen Code技能市场支持中文界面和中文技能描述进阶技巧3个高级配置选项技巧1多语言混合使用在某些场景下你可能需要混合使用不同语言。Qwen Code支持动态切换# 临时请求英文回复 请用英文解释这个算法 # 恢复中文输出 现在请用中文继续技巧2自定义语言规则通过修改output-language.md文件可以创建更复杂的语言规则# 自定义多语言规则 !-- qwen-code:llm-output-language: 中文 -- ## 特殊规则 - 技术文档优先使用中文但保留英文术语 - 代码注释根据项目规范选择语言 - 错误信息保持英文原样添加中文解释 ## 例外情况 - 当用户明确要求code review时使用英文进行代码审查 - 当讨论国际化项目时自动切换到英文技巧3语言优先级配置Qwen Code支持多级语言配置优先级用户显式请求最高优先级项目级规则.qwen/output-language.md全局配置~/.qwen/output-language.md系统自动检测最低优先级常见问题与解决方案问题1中文显示乱码症状界面或输出中出现乱码字符解决方案# 方案1检查系统字体设置 # 确保系统安装了中文字体 # 方案2重新设置语言 /language ui zh-CN /language output 中文 # 方案3重启Qwen Code应用 # 重新加载语言配置文件问题2语言设置不生效症状设置语言后界面或输出未改变解决方案# 检查配置文件路径 ls ~/.qwen/output-language.md # 手动创建规则文件 echo # Output language preference: 中文 ~/.qwen/output-language.md echo !-- qwen-code:llm-output-language: 中文 -- ~/.qwen/output-language.md # 重新加载配置 # 重启Qwen Code或重新加载会话问题3技术术语翻译不一致症状某些技术术语翻译不准确解决方案# 在output-language.md中添加术语表 ## 技术术语处理规则 - 保留以下英文术语原样API、CLI、JSON、YAML、Git、Docker - 以下术语使用标准中文翻译 - function → 函数 - variable → 变量 - class → 类 - method → 方法性能优化建议1. 语言缓存优化Qwen Code使用智能缓存机制加速语言切换// 语言缓存实现示例 class LanguageCache { private cache new Mapstring, TranslationData(); getTranslation(key: string, locale: string): string { const cacheKey ${locale}:${key}; if (this.cache.has(cacheKey)) { return this.cache.get(cacheKey)!; } // 从文件加载并缓存 const translation this.loadTranslation(key, locale); this.cache.set(cacheKey, translation); return translation; } }2. 按需加载翻译大型项目可以按需加载语言包减少内存占用// 动态导入语言包 async function loadLanguageBundle(locale: string) { switch (locale) { case zh-CN: return await import(./locales/zh.js); case en-US: return await import(./locales/en.js); // 其他语言... } }3. 预编译语言资源在构建时预编译语言资源提高运行时性能# 构建时预编译语言文件 npm run build:i18n # 生成优化后的语言包 # 包含最小化、压缩和tree-shaking优化Qwen Code桌面应用支持完整的中文本地化体验资源整合与最佳实践1. 中文技术文档访问Qwen Code内置了完整的中文技术文档系统# 在终端中查看中文帮助 /help # 在浏览器中打开中文文档 /docs # 访问特定主题的中文文档 /docs 多语言配置2. 社区贡献指南如果你想为Qwen Code的中文翻译做贡献Fork项目仓库https://gitcode.com/GitHub_Trending/qw/qwen-code修改翻译文件中文翻译文件提交Pull Request遵循项目贡献规范参与翻译审查帮助改进翻译质量3. 多语言开发工作流建议的多语言开发工作流# .github/workflows/i18n.yml name: I18N Translation Check on: push: paths: - packages/cli/src/i18n/** - docs/** jobs: translation-check: runs-on: ubuntu-latest steps: - name: Check translation completeness run: | # 检查翻译覆盖率 npm run check:i18n - name: Validate output-language.md format run: | # 验证输出语言规则文件格式 npm run validate:output-language【免费下载链接】qwen-codeAn open-source AI coding agent that lives in your terminal.项目地址: https://gitcode.com/GitHub_Trending/qw/qwen-code创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考