---
description: 
globs: 
alwaysApply: false
---
# Language Settings Support

## Overview

Task Master now supports multiple languages for task generation, PRD parsing, and other AI-generated content. Users can specify their preferred language, which will be used for:

1. **PRD Parsing**: Generate tasks in the specified language
2. **Task Expansion**: Create subtasks in the specified language
3. **Complexity Analysis**: Generate complexity reports in the specified language
4. **UI Elements**: Customize certain UI elements for the selected language (future enhancement)

## Configuration

Control language settings using the following environment variables:

```
# Language configuration
LANGUAGE=zh-CN  # Language code (ISO 639-1 with optional region)
DEFAULT_LANGUAGE=en-US  # Fallback language if LANGUAGE is not specified
```

Supported language codes include:
- `en-US` - English (United States) - Default
- `zh-CN` - Chinese (Simplified)
- `zh-TW` - Chinese (Traditional)
- `ja-JP` - Japanese
- `ko-KR` - Korean
- `fr-FR` - French
- `de-DE` - German
- `es-ES` - Spanish
- `pt-BR` - Portuguese (Brazil)
- `ru-RU` - Russian
- `ar-SA` - Arabic

## Implementation

Language settings apply to the following contexts:

1. **AI Prompts**: System prompts are modified to specify language preference:
   ```
   Generate the response in ${language}. All task titles, descriptions, details, and test strategies should be written in ${language}.
   ```

2. **PRD Analysis**: When parsing PRDs, the system instructs the AI to produce tasks in the specified language, even if the PRD itself is in another language.

3. **Task Generation**: All task expansion operations create subtasks in the configured language.

4. **Error Messages**: AI-generated error messages and suggestions use the specified language when possible.

## Usage Examples

```bash
# Generate tasks in Chinese
LANGUAGE=zh-CN task-master parse-prd your-prd.txt

# Expand task with Japanese subtasks
LANGUAGE=ja-JP task-master expand --id=5
```

## Language Override

You can override the global language setting for specific commands:

```bash
# Override language for a specific command
task-master expand --id=5 --language=fr-FR
```

The command-line option takes precedence over the environment variable.

## Technical Implementation

The language setting is:

1. Stored in the `CONFIG` object in `utils.js`
2. Passed to AI prompts in `ai-services.js`
3. Applied to template system prompts
4. Made available to command handlers for CLI option processing

## Limitations

Currently, the language setting only affects AI-generated content. The following elements remain in the system's default language (English):

1. CLI command names, options, and help text
2. Fixed UI elements (loading messages, success/error indicators)
3. Internal logging messages

Future enhancements may include full internationalization of the user interface.
