|
| 1 | +# Internationalization (i18n) & Language |
| 2 | + |
| 3 | +Qwen Code is built for multilingual workflows: it supports UI localization (i18n/l10n) in the CLI, lets you choose the assistant output language, and allows custom UI language packs. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +From a user point of view, Qwen Code’s “internationalization” spans multiple layers: |
| 8 | + |
| 9 | +| Capability / Setting | What it controls | Where stored | |
| 10 | +| ------------------------ | ---------------------------------------------------------------------- | ---------------------------- | |
| 11 | +| `/language ui` | Terminal UI text (menus, system messages, prompts) | `~/.qwen/settings.json` | |
| 12 | +| `/language output` | Language the AI responds in (an output preference, not UI translation) | `~/.qwen/output-language.md` | |
| 13 | +| Custom UI language packs | Overrides/extends built-in UI translations | `~/.qwen/locales/*.js` | |
| 14 | + |
| 15 | +## UI Language |
| 16 | + |
| 17 | +This is the CLI’s UI localization layer (i18n/l10n): it controls the language of menus, prompts, and system messages. |
| 18 | + |
| 19 | +### Setting the UI Language |
| 20 | + |
| 21 | +Use the `/language ui` command: |
| 22 | + |
| 23 | +```bash |
| 24 | +/language ui zh-CN # Chinese |
| 25 | +/language ui en-US # English |
| 26 | +/language ui ru-RU # Russian |
| 27 | +/language ui de-DE # German |
| 28 | +``` |
| 29 | + |
| 30 | +Aliases are also supported: |
| 31 | + |
| 32 | +```bash |
| 33 | +/language ui zh # Chinese |
| 34 | +/language ui en # English |
| 35 | +/language ui ru # Russian |
| 36 | +/language ui de # German |
| 37 | +``` |
| 38 | + |
| 39 | +### Auto-detection |
| 40 | + |
| 41 | +On first startup, Qwen Code detects your system locale and sets the UI language automatically. |
| 42 | + |
| 43 | +Detection priority: |
| 44 | + |
| 45 | +1. `QWEN_CODE_LANG` environment variable |
| 46 | +2. `LANG` environment variable |
| 47 | +3. System locale via JavaScript Intl API |
| 48 | +4. Default: English |
| 49 | + |
| 50 | +## LLM Output Language |
| 51 | + |
| 52 | +The LLM output language controls what language the AI assistant responds in, regardless of what language you type your questions in. |
| 53 | + |
| 54 | +### How It Works |
| 55 | + |
| 56 | +The LLM output language is controlled by a rule file at `~/.qwen/output-language.md`. This file is automatically included in the LLM's context during startup, instructing it to respond in the specified language. |
| 57 | + |
| 58 | +### Auto-detection |
| 59 | + |
| 60 | +On first startup, if no `output-language.md` file exists, Qwen Code automatically creates one based on your system locale. For example: |
| 61 | + |
| 62 | +- System locale `zh` creates a rule for Chinese responses |
| 63 | +- System locale `en` creates a rule for English responses |
| 64 | +- System locale `ru` creates a rule for Russian responses |
| 65 | +- System locale `de` creates a rule for German responses |
| 66 | + |
| 67 | +### Manual Setting |
| 68 | + |
| 69 | +Use `/language output <language>` to change: |
| 70 | + |
| 71 | +```bash |
| 72 | +/language output Chinese |
| 73 | +/language output English |
| 74 | +/language output Japanese |
| 75 | +/language output German |
| 76 | +``` |
| 77 | + |
| 78 | +Any language name works. The LLM will be instructed to respond in that language. |
| 79 | + |
| 80 | +> [!note] |
| 81 | +> |
| 82 | +> After changing the output language, restart Qwen Code for the change to take effect. |
| 83 | +
|
| 84 | +### File Location |
| 85 | + |
| 86 | +``` |
| 87 | +~/.qwen/output-language.md |
| 88 | +``` |
| 89 | + |
| 90 | +## Configuration |
| 91 | + |
| 92 | +### Via Settings Dialog |
| 93 | + |
| 94 | +1. Run `/settings` |
| 95 | +2. Find "Language" under General |
| 96 | +3. Select your preferred UI language |
| 97 | + |
| 98 | +### Via Environment Variable |
| 99 | + |
| 100 | +```bash |
| 101 | +export QWEN_CODE_LANG=zh |
| 102 | +``` |
| 103 | + |
| 104 | +This influences auto-detection on first startup (if you haven’t set a UI language and no `output-language.md` file exists yet). |
| 105 | + |
| 106 | +## Custom Language Packs |
| 107 | + |
| 108 | +For UI translations, you can create custom language packs in `~/.qwen/locales/`: |
| 109 | + |
| 110 | +- Example: `~/.qwen/locales/es.js` for Spanish |
| 111 | +- Example: `~/.qwen/locales/fr.js` for French |
| 112 | + |
| 113 | +User directory takes precedence over built-in translations. |
| 114 | + |
| 115 | +> [!tip] |
| 116 | +> |
| 117 | +> Contributions are welcome! If you’d like to improve built-in translations or add new languages. |
| 118 | +> For a concrete example, see [PR #1238: feat(i18n): add Russian language support](https://github.com/QwenLM/qwen-code/pull/1238). |
| 119 | +
|
| 120 | +### Language Pack Format |
| 121 | + |
| 122 | +```javascript |
| 123 | +// ~/.qwen/locales/es.js |
| 124 | +export default { |
| 125 | + Hello: 'Hola', |
| 126 | + Settings: 'Configuracion', |
| 127 | + // ... more translations |
| 128 | +}; |
| 129 | +``` |
| 130 | + |
| 131 | +## Related Commands |
| 132 | + |
| 133 | +- `/language` - Show current language settings |
| 134 | +- `/language ui [lang]` - Set UI language |
| 135 | +- `/language output <language>` - Set LLM output language |
| 136 | +- `/settings` - Open settings dialog |
0 commit comments