# DeepSeek-Reasonix `reasoning_language` Setting: Controlling Visible Reasoning Language (auto|zh|en)

> Control DeepSeek-Reasonix visible reasoning text with the reasoning_language setting. Choose auto, zh, or en to manage chain-of-thought output language for better control.

- Repository: [YHH/DeepSeek-Reasonix](https://github.com/esengine/DeepSeek-Reasonix)
- Tags: api-reference
- Published: 2026-08-06

---

**The `reasoning_language` setting in the esengine/DeepSeek-Reasonix repository forces the model's visible reasoning (chain-of-thought) text into Simplified Chinese (`zh`), English (`en`), or automatically selects based on prompt content (`auto`), while leaving the final answer language controlled by a separate setting.**

The DeepSeek-Reasonix project provides a configurable interface that separates the language of the model's internal "thinking" process from its final output text. By manipulating the `reasoning_language` configuration value, users can ensure that streaming reasoning blocks appear in their preferred language regardless of the provider's default behavior.

## What the `reasoning_language` Setting Controls

The setting accepts three canonical values stored in the user or project configuration ([`internal/config/config.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/config/config.go)):

- **`auto`** – The system analyzes the user prompt and injects a Chinese reasoning block only if the text contains sufficient Han characters or Chinese cues; otherwise, it leaves the provider's default (typically English).
- **`zh`** – Forces all visible reasoning text to be written in Simplified Chinese, overriding any provider default.
- **`en`** – Forces all visible reasoning text to be written in English.

This applies exclusively to the **visible reasoning** streamed back before the final answer. The final response language remains independent, governed by the `response_language` setting.

## Internal Implementation: From Config to Prompt Injection

The implementation follows a pipeline that normalizes user input, detects language when necessary, and injects XML-style instruction blocks into the prompt at the last moment before sending it to the LLM.

### Normalization with `NormalizeReasoningLanguage`

When the configuration loads, the system canonicalizes the input string. In [`internal/agent/reasoning_language.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/agent/reasoning_language.go) (lines 15-23), the `NormalizeReasoningLanguage` function accepts flexible inputs:

```go
// Variants like "cn", "中文", or "chinese" normalize to "zh"
// "english" or "en" normalize to "en"
// Anything unrecognized becomes "auto"

```

This ensures that user typos or regional variations (e.g., typing `"cn"` instead of `"zh"`) are handled gracefully.

### Block Generation via `ReasoningLanguageBlock`

The `ReasoningLanguageBlock` function (lines 56-66 in [`internal/agent/reasoning_language.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/agent/reasoning_language.go)) returns a transient XML block that is prefixed to the prompt:

- For **`zh`**: Returns a block instructing the model that it **must** write all visible reasoning in Chinese (uses phrases like "必须使用简体中文书写全部可见思考/推理文本").
- For **`en`**: Returns a block requesting English reasoning ("Visible reasoning/thinking text preference: use English").
- For **`auto`**: Returns an empty string, leaving the prompt unmodified unless auto-detection triggers later.

### Auto-Detection Using `InferReasoningLanguageFromText`

When the mode is set to `auto`, the helper `InferReasoningLanguageFromText` (lines 82-99) analyzes the raw user prompt after stripping previously injected blocks:

1. It counts Unicode Han characters (`unicode.Han`) and CJK punctuation.
2. If the prompt contains **≥4 Han characters**, or **≥2 Han characters** combined with Chinese punctuation or cue phrases (defined in `chineseReasoningLanguageCues`), the function returns `"zh"`.
3. Otherwise, it returns `"auto"`, signaling the controller to use the provider's default.

### Prompt Prefixing with `WithReasoningLanguageForSource`

The `WithReasoningLanguageForSource` function (lines 94-104) prefixes the generated block to the prompt immediately before transmission, unless the block already exists. This ensures the language preference applies transiently to the current turn only without permanently modifying the stored prompt.

## How It Affects Visible Reasoning Output

When a non-empty block is present, the model receives explicit instructions within XML tags. Most providers honor this by emitting reasoning text in the requested language. The desktop frontend ([`desktop/frontend/src/lib/reasoningDisplay.ts`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/desktop/frontend/src/lib/reasoningDisplay.ts)) then renders this streaming text exactly as produced.

**Example injected blocks:**

| Setting | Injected Block Content | Visible Output |
|---------|----------------------|----------------|
| `zh` | `<reasoning-language>必须使用简体中文书写全部可见思考/推理文本...</reasoning-language>` | Chinese reasoning like "思考过程如下：..." |
| `en` | `<reasoning-language>Visible reasoning/thinking text preference: use English...</reasoning-language>` | English reasoning like "Step 1:..." |
| `auto` | *(empty unless triggered)* | Provider default, usually English |

The final answer portion of the response remains unaffected by these blocks.

## Configuring the Setting via CLI and Config Files

Users can modify the setting at runtime using the `/reasoning-language` command. The CLI implementation in [`internal/cli/reasoning_language.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/cli/reasoning_language.go) parses the argument (lines 63-73), validates it against the three allowed values, and updates the running controller via `SetReasoningLanguage` (defined in [`internal/control/controller.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/control/controller.go)). This writes the value to the user configuration and takes effect immediately without requiring a restart.

## Summary

- The **`reasoning_language`** setting controls only the visible chain-of-thought text, not the final answer.
- **`auto`** mode detects Chinese prompts by counting Han characters (≥4) or looking for Chinese cues in `InferReasoningLanguageFromText`.
- The system normalizes inputs like `"cn"` or `"english"` to canonical `"zh"`/`"en"` via `NormalizeReasoningLanguage`.
- XML instruction blocks are injected at the last moment by `WithReasoningLanguageForSource` in [`internal/agent/reasoning_language.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/agent/reasoning_language.go).
- The **`/reasoning-language`** CLI command updates the configuration in real time through the controller.

## Frequently Asked Questions

### Does `reasoning_language` affect the language of the final answer?

No. According to the source code in [`internal/config/config.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/config/config.go), the final answer language is controlled separately by the `response_language` setting. The `reasoning_language` setting only affects the intermediate reasoning text streamed before the final response is generated.

### How does the `auto` mode decide between Chinese and English?

The `auto` mode relies on `InferReasoningLanguageFromText` in [`internal/agent/reasoning_language.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/agent/reasoning_language.go). It scans the raw user prompt for Han characters using `unicode.Han`. If the prompt contains four or more Han characters, or two Han characters combined with Chinese punctuation or cue phrases, the system injects a Chinese reasoning block. Otherwise, it leaves the provider's default language intact.

### Can I use values like "chinese", "cn", or "english" instead of the standard codes?

Yes. The `NormalizeReasoningLanguage` function (lines 15-23 in [`internal/agent/reasoning_language.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/agent/reasoning_language.go)) accepts variants and canonicalizes them. Inputs like `"cn"`, `"中文"`, or `"english"` are converted to `"zh"` or `"en"`. Any unrecognized string defaults to `"auto"`.

### Where is the `reasoning_language` setting stored, and can I change it during a chat session?

The setting persists in the user configuration file managed through [`internal/config/config.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/config/config.go). You can change it dynamically during an active session by using the `/reasoning-language` CLI command, which calls `SetReasoningLanguage` on the controller ([`internal/control/controller.go`](https://github.com/esengine/DeepSeek-Reasonix/blob/main/internal/control/controller.go)) and applies the change immediately to subsequent prompts.