---
title: "Tell the model which language to answer in · Agent Wranglers"
url: https://agentwranglers.se/playbook/localization/email-notifications-and-ai/ai-reply-language
id: LOC-41
level: Recommended
applies: ai-features
updated: 2026-10-22
tokens: 900
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Tell the model which language to answer in

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Email, notifications and AI](https://agentwranglers.se/playbook/localization/email-notifications-and-ai.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: LOC-41
- Level: Recommended
- Chapter: [Email, notifications and AI](https://agentwranglers.se/playbook/localization/email-notifications-and-ai.md)
- Rule: Name the user's language in the system prompt of every AI feature, and check that each answer is in that language before showing it.
- Check: An eval case sends English input for a user whose language is German. The language detector labels the answer `de` in at least 19 of 20 runs.
- Applies when: The project uses AI models.
- How: Models guess the answer language from the conversation, so a German user who pastes an English email often gets English back. Put the instruction in the system prompt, which stays the same across turns. Take the language from [the user's saved locale](https://agentwranglers.se/playbook/localization/locales-and-preferences/locale-and-time-zone-preferences.md), not from the input text. Keep the instruction in the prompt file, as [Keep prompts in files](https://agentwranglers.se/playbook/ai-features/prompts-as-code/prompts-in-files.md) says. Detect the answer's language with a small language-ID library, and retry once when it is wrong.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
const LANGUAGE_NAMES = new Intl.DisplayNames(['en'], { type: 'language' });
export const systemPrompt = (base, user) =>
  `${base}\n\nAlways answer in ${LANGUAGE_NAMES.of(user.locale)} (${user.locale}), whatever language the input is in.`;
```

### Python example

```python
from babel import Locale

def system_prompt(base: str, user_locale: str) -> str:
    language = Locale.parse(user_locale, sep="-").get_display_name("en")
    return f"{base}\n\nAlways answer in {language} ({user_locale}), whatever language the input is in."
```

## Sources

- [Claude Platform Docs (Multilingual support, set the response language)](https://platform.claude.com/docs/en/build-with-claude/multilingual-support)

## Related rules

- LOC-22 [Store language and time zone as two separate settings](https://agentwranglers.se/playbook/localization/locales-and-preferences/locale-and-time-zone-preferences.md) in Localization
- AIF-6 [Keep prompts in files](https://agentwranglers.se/playbook/ai-features/prompts-as-code/prompts-in-files.md) in AI features

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/localization/email-notifications-and-ai/ai-reply-language">Agent Wranglers localization playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Translate every part of an email](https://agentwranglers.se/playbook/localization/email-notifications-and-ai/localized-email.md)
- Next: [Run the evals in every language you support](https://agentwranglers.se/playbook/localization/email-notifications-and-ai/ai-evals-per-language.md)
- [Email, notifications and AI](https://agentwranglers.se/playbook/localization/email-notifications-and-ai.md)
