# How Do You Support Many Languages?

> How an AI app serves users in many languages: reply language, token cost, quality per language and fixed facts, explained for your AI interview.

**In short:** Set the reply language from the user's account in code, measure quality and cost for each language, and keep facts like fees and dates in a table the model doesn't write. Models speak many languages, but how well, and at what cost, depends on the language.

AI and LLM interview question Q370, LLM system design. Intermediate, occasional (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/how-do-you-support-many-languages

## Say it in 30 seconds

To support many languages, I first set the reply language from the user's account, and tell the model in the system prompt. Then I plan for two gaps. Quality varies by language, so I test each one I support on its own. Cost varies too, because some languages take far more tokens for the same text. Fees and dates come from a table in code, never from the model.

## Say it in 2 minutes

The first decision is the reply language, and it must not be left to chance. If the customer's account has a language, the app passes it into the system prompt on every call. Anthropic's guidance is that production apps should state the target language explicitly, and the system prompt is the most reliable place to do it. If a message arrives in another language, the saved language still sets the reply, and the customer can change it in their settings. If a customer has no saved language, a detection step comes first. Azure Translator's Auto Language Detection is one option for that.

The second gap is cost and quality. Models read text as tokens, and some languages split into many more tokens for the same meaning. A 2023 research paper found translations whose token lengths differed by up to 15 times in some cases. That means a higher bill, slower replies and less room for the same policy text in the context window. Quality varies too, so I build one test set per language, checked by native speakers, and score each language on its own, with no average across languages.

Facts stay in code. Fees, dates, currencies and legal wording come from a table the app owns, and numbers are formatted for the locale, since 1,000.50 and 1.000,50 mean different things in different countries. The model asks for the figure, and the code puts the exact one into the reply. Safety filters need the same care, because OWASP says semantic filters lose accuracy on low-resource and code-mixed inputs.

I'd be honest about the limit. Performance varies by language, so I launch the languages I can test well, add others in waves, and keep a human route for the rest.

## What does supporting many languages mean, in plain words?

Your app has users who write in Hindi, Arabic, Spanish and English. They expect answers in their own language, and those answers have to be correct in every one.

Think of a bank call centre that hires staff who speak several languages. Each agent still needs the same fee rules, and a fee quoted wrongly in Hindi is as wrong as one quoted in English. In an AI app, a customer types "¿Cuánto cuesta el cargo por retraso en mi tarjeta?" (How much is the late fee on my card?). The answer has to be in Spanish, and the fee has to match the bank's table.

- **Reply language:** The language the answer is written in. It should come from the saved account.
- **Locale:** The language and region settings, such as Hindi used in India. It sets dates and number formats.
- **System prompt:** The developer's instructions to the model, sent with every customer message.
- **Tokeniser:** The part that cuts text into small pieces, called tokens, before the model reads it.
- **Per-language test set:** Questions with checked answers, written for one language and scored on their own.

## Why is it harder than translating the text?

One model can serve many languages. The XLM-R research paper, from 2019, trained one model on one hundred languages at once. Performance still varies by language, and Anthropic says the same of Claude, with the strongest results in widely spoken languages.

> "Performance varies by language, with particularly strong capabilities in widely spoken languages." (Anthropic, on Claude)
>
> "This induces unfair treatment for some language communities in regard to the cost of accessing commercial language services" (Petrov and co-authors, 2023 paper)

Tokens are the second gap. The tokeniser cuts text into pieces before the model sees it, and for some languages it cuts more pieces for the same meaning. A 2023 paper at NeurIPS, an AI research conference, found translations whose token lengths differ by up to 15 times in some cases. For a product, that means a bigger bill, slower replies and less room in the context window (the text the model can read in one go) for the same policy text.

## How does one message travel through the system?

Here is the path for one message, from the customer's screen to the reply. Each box does one job, and fixed facts never depend on the model's own wording.

*Diagram, One message, from question to checked reply: A customer's message is answered in the language saved on their account. The model asks the fee table for each number, and a check in code looks at the language and the numbers before anything is sent. Only a checked reply goes out.*
1. The message arrives, and the app loads the saved language, whatever language the message is in.
2. The language goes into the system prompt, so the reply follows it.
3. The model asks the fee table for each number it needs.
4. The draft reply goes through the checks.
5. A checked reply is sent to the customer.

1. **Set the language:** Read the saved locale. If there is none, detect the language first, then store it on the account.
2. **Keep facts in data:** Fees, dates and legal wording come from a table the bank owns, never typed by the model.
3. **Store documents as written:** Keep each policy in its own language, and test that a question in another language still finds the right passage.
4. **Check before sending:** Code checks the reply language and the numbers. A reply that fails goes to a retry or to a person.

> **Tip:** In an interview, name where each fixed fact comes from: the account for the language, the table for the numbers.

## Should one model handle every language, or should you translate through English?

Two designs are common. In the first, one model reads and writes each language directly. In the second, the app translates into English, answers, and translates back. Each has a cost, so I'd pick by test results.

- **Option A: One model, direct.** Reads and writes the language itself. Fewer steps, so fewer places for meaning to slip. Quality still has to be tested per language.
- **Option B: Translate in and out.** Easy to bolt onto an English system. Each hop can lose meaning, and it adds delay and cost.
- **Option C: Mix them.** Direct for the main languages, translation for rare ones, with the same test set for both paths.

*Diagram, Direct model or translate through English: Two paths to one answer, judged by the same test set. The direct path keeps the wording, and the translated path adds a hop that can drift. Both must pass the per-language test before they ship.*
1. Path A's wording goes straight to the test set.
2. Path B's translated answer goes to the same test set.

## How do you know it works in every language?

Anthropic's guidance is to measure output quality in each language you support. In practice that means a test set for each language, with expected answers checked by someone who speaks it.

- **One test set per language:** Build it from real customer questions in that language.
- **A native speaker checks:** Someone who speaks the language writes or checks the expected answers.
- **Score each language apart:** A weak language can't hide in the average of the others.
- **Watch live replies:** Sample replies by language, and send weak ones to a person.

### How would you launch a bank's help chat in eight languages?

Start with the three languages that cover most customers, each with its own test set and a native reviewer. Fee and date answers come from the bank's approved table in every language. The other languages wait until they pass the same bar, and until a person can take over a chat when the assistant is unsure.

Cost is a launch number too. Some languages can use more tokens for the same reply, so I'd measure the cost per language in the first week.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] Set the reply language from the account, and say why.
- [ ] Name the two gaps: quality varies, and some languages cost more tokens.
- [ ] Compare a direct model with translating through English, and say how you'd choose.
- [ ] Keep fees, dates and legal wording in data, never in the model's words.
- [ ] Test each language on its own, with native reviewers.
- [ ] Say the limits: some languages will lag, so launch in waves.

**Common traps**

- Trap: "Translating everything to English first is always safest." Better: It works, but each hop can lose meaning and adds delay. Test it against a direct model.
- Trap: "One English test is enough, the model handles every language." Better: Anthropic says performance varies by language. Test every language you support.
- Trap: "Let the model guess the language from the message." Better: The account holds the language. Set it in the system prompt on every call.

## Can you spot the problem?

**Spot the bug:** The account is set to Hindi and rupees. A customer gets an English reply that quotes a fee in dollars. Which line causes it?

A. reply_language = account.locale
B. fee = fee_table.lookup(plan, currency=account.currency)
C. system = "Answer in English. The late fee is 49 USD."
D. date = format_date(order.date, locale=account.locale)

**Answer:** C. A hard-coded language and fee in the prompt override the account and the table. The first line takes the language from the account, the last formats the date from it, and the second takes the fee from the table.

**Quick check:** A bank's assistant is strong in English but weaker in Swahili. What do you do first?

A. Ship it and wait for complaints
B. Build a Swahili test set and score it on its own
C. Translate the English test set and average the scores
D. Make the system prompt longer

**Answer:** B. Averaging hides a weak language. A Swahili test set, with answers checked by a native speaker, shows the real gap and tells you when the assistant is ready.

## Can you answer these from memory?

**Flash cards**

- **Where does the reply language come from?** The saved account, set in code and passed in the system prompt.
- **Why can one text cost more in one language?** The tokeniser cuts some languages into many more tokens.
- **Direct model or translate through English?** Direct keeps the wording. Translation adds hops. Test both.
- **Where do fees and dates come from?** A table in code, never typed by the model.
- **Is one English test enough?** No. Score each language on its own, with native reviewers.
- **What breaks in numbers?** Separators differ by country. Format numbers for the locale in code.

## Likely follow-up questions

- Q005 Why do token counts differ across languages and models? https://designervenkat.online/interview/ai/why-do-token-counts-differ-across-languages-and-models
- Q368 Build a cost model for the system. https://designervenkat.online/interview/ai/build-a-cost-model-for-the-system
- Q369 How do you design for low latency? https://designervenkat.online/interview/ai/how-do-you-design-for-low-latency
- Q372 Design an eval and monitoring platform. https://designervenkat.online/interview/ai/design-an-eval-and-monitoring-platform
- Q267 How do you evaluate safety? https://designervenkat.online/interview/ai/how-do-you-evaluate-safety
