---
title: "Multilingual AI product design: Arabic, English, Spanish"
description: "Design an AI product for Arabic, English and Spanish users: UI locale vs model language, RTL and mixed text, numbers, dates, detection and cost."
url: https://broadrouter.com/blog/multilingual-product-design/
lang: en
updated: 2026-11-15
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# Design an AI experience for multiple languages

By the BroadNet Inference team · 7 min read · Published 2026-11-15

Store two settings: the interface locale and the content language, and never infer one from the other. Set direction from the locale, isolate user and model text with dir="auto" or bdi, format numbers and dates with the locale, normalise digits on input, treat language detection as a hint, and evaluate quality and cost per language.

## Key takeaways

-   Interface locale and model language are different settings. An Arabic interface can serve an English message, and a Spanish user can upload an Arabic invoice.
-   Set dir on the page from the locale, use CSS logical properties, and wrap any text you did not write (user input, model output, names) in a direction-isolated element.
-   Let Intl format numbers and dates. In our Node 24 test, ar-SA printed ١٬٢٣٤٫٥ and ar-AE printed 1,234.5 for the same number; es-ES printed 1234,5 without a thousands separator.
-   Script-based language detection is a hint. Our simple detector labelled Arabizi as Spanish.
-   Evaluate and budget per language: the same content can need a different number of tokens in Arabic, English and Spanish.

**On this page**

1.  Why keep the interface locale separate from the model language?
2.  How do you support right-to-left and mixed-direction text?
3.  How should numbers and dates differ by locale?
4.  Can you detect the language of each message?
5.  What else changes when the language changes?
6.  How do you evaluate and budget each language?
7.  Where BroadNet Inference fits

An AI feature for Arabic, English and Spanish users is three products sharing one codebase. The screen must flip direction for Arabic. Messages mix scripts in a single line. Numbers and dates change shape by region. The model may answer in the wrong language, and each language costs a different amount. Most of these problems come from one design mistake: treating “the language” as a single setting.

This post covers the product and interface side. Translating your app’s own strings (placeholders, plurals, ICU messages) is in [translating app strings to Arabic with an LLM](https://broadrouter.com/blog/translate-app-strings-to-arabic-llm/); prompt wording is in [Arabic prompt engineering](https://broadrouter.com/blog/arabic-prompt-engineering/).

## Why keep the interface locale separate from the model language?

Because they answer different questions. The **interface locale** (`ar-SA`, `en-US`, `es-MX`) decides layout direction, the language of your buttons, and how numbers and dates look. The **content language** is the language of a particular message, document or recording, and decides what you ask the model to do.

They diverge all the time. A Saudi user with an Arabic interface pastes an English contract. A Spanish user uploads an Arabic invoice photo. A bilingual agent switches language mid-conversation ([code-switching](https://broadrouter.com/glossary/code-switching/)). If the code sends “answer in Arabic” because the interface is Arabic, the English contract gets an Arabic summary nobody asked for.

So store both per user, and per message:

-   `ui_locale`: chosen by the user, defaulting to the browser’s language.
-   `answer_language`: an explicit user choice if they made one, otherwise the detected language of the message.
-   For audio, `audio_language`: what you pass to the transcription model. BroadNet’s API reference says to always send `language` with a transcription request, or Arabic can come back in Latin letters.

## How do you support right-to-left and mixed-direction text?

Three layers, from the W3C’s guidance:

1.  **Page direction from the locale.** Set `dir="rtl"` and `lang="ar"` on the `html` element for Arabic. The W3C says not to use CSS to set the base direction, and to use logical values (`start` and `end`) for margins, padding and alignment rather than left and right.
2.  **Logical CSS.** `margin-inline-start` instead of `margin-left`, `text-align: start` instead of `left`. MDN describes logical properties as controlling layout “through logical rather than physical direction”. One stylesheet then serves both directions.
3.  **Isolate text you didn’t write.** User messages, model answers, product names and order codes have their own direction. The W3C’s rule: if you don’t know the direction of text inserted at run time, add `dir="auto"` to the element that wraps it, or wrap it in a `bdi` element. Without isolation, an English order code at the end of an Arabic sentence can jump to the wrong side, and punctuation lands in odd places.

For a chat interface that means `dir="auto"` on every message bubble, since each message picks its direction from its first strong character, and `bdi` around names and codes inside your own interface strings. Where there is no markup (push notifications, SMS, CSV exports), the Unicode Bidirectional Algorithm’s isolates do the same job: U+2068 FIRST STRONG ISOLATE before the text and U+2069 POP DIRECTIONAL ISOLATE after it.

Model output adds one more case: Markdown. A model answering in Arabic may include English code, URLs or table cells. Render code blocks with `dir="ltr"` explicitly, and give each paragraph and table cell `dir="auto"`.

## How should numbers and dates differ by locale?

Let the platform format them, and test what it actually produces. We ran `Intl.NumberFormat` and `Intl.DateTimeFormat` in Node 24.22.1 (ICU 78.3, CLDR 48) for 1234.5 and 15 November 2026:

| Locale | Number | Date (long) | Direction |
| --- | --- | --- | --- |
| en-US | 1,234.5 | November 15, 2026 | ltr |
| ar-SA | ١٬٢٣٤٫٥ | ١٥ نوفمبر ٢٠٢٦ | rtl |
| ar-SA-u-nu-latn | 1,234.5 | 15 نوفمبر 2026 | rtl |
| ar-AE | 1,234.5 | 15 نوفمبر 2026 | rtl |
| es-ES | 1234,5 | 15 de noviembre de 2026 | ltr |
| es-MX | 1,234.5 | 15 de noviembre de 2026 | ltr |

Four things to notice. Arabic locales differ on digits: Saudi defaults to Arabic-Indic, the UAE to Western, and the `-u-nu-latn` extension (see MDN’s `numberingSystem`) switches a locale to Western digits. Spanish differs by region: Spain uses a comma decimal and, for a four-digit number, no thousands separator; Mexico uses a dot. Month names vary across the Arab world too: `ar-MA` printed نونبر for November where `ar-SA` printed نوفمبر. And browsers ship their own ICU versions, so run the same checks in your target browsers.

Plurals follow CLDR rules: `Intl.PluralRules` for `ar` returned six categories for 0, 1, 2, 3, 11 and 100 (zero, one, two, few, many, other), while English and Spanish returned only one and other for those numbers. The strings side of this is in the [app strings post](https://broadrouter.com/blog/translate-app-strings-to-arabic-llm/).

On input, accept both digit forms. A user may type ١٢٣٤ into a quantity field; normalise to ASCII digits before parsing, and before sending numbers to a model if your prompts compare them.

## Can you detect the language of each message?

Partly. Telling Arabic script from Latin script is easy and reliable: count characters in the Arabic Unicode block. Telling English from Spanish, or reading very short messages, needs a trained model. fastText publishes two language-identification models for 176 languages (`lid.176.bin`, 126 MB, and the compressed `lid.176.ftz`, 917 kB).

Here is a small helper module for the decisions above. The detector is deliberately simple, to show where simple fails.

```javascript
// UI locale and content language are separate values. Never derive one from the other silently.
const RTL = new Set(['ar', 'he', 'fa', 'ur']);

/** Rough script-based guess: enough to pick a direction and a prompt, not a language-ID model. */
export function guessLanguage(text) {
  const arabic = (text.match(/[؀-ۿݐ-ݿ]/g) || []).length;
  const latin = (text.match(/[A-Za-zÀ-ÿ]/g) || []).length;
  if (arabic + latin < 3) return 'und';
  if (arabic / (arabic + latin) > 0.6) return 'ar';
  if (arabic / (arabic + latin) > 0.2) return 'mixed';
  return /[ñ¿¡áéíóú]|\b(el|la|los|las|de|que|por|para|está|dónde)\b/i.test(text) ? 'es' : 'en';
}

/** Wrap user or model text for display inside UI text of either direction (W3C: bdi / dir="auto"). */
export const isolate = (s) => `<bdi>${s.replace(/[&<>"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' })[c])}</bdi>`;

/** Plain-text equivalent for places with no markup (notifications, CSV, SMS): FSI ... PDI. */
export const isolateText = (s) => `⁨${s}⁩`;

export function formatters(uiLocale) {
  return {
    dir: RTL.has(new Intl.Locale(uiLocale).language) ? 'rtl' : 'ltr',
    number: new Intl.NumberFormat(uiLocale),
    date: new Intl.DateTimeFormat(uiLocale, { dateStyle: 'long', timeZone: 'UTC' }),
    plural: new Intl.PluralRules(uiLocale),
  };
}

/** Normalise digits a user typed before parsing: Arabic-Indic and Persian to ASCII. */
export const toAsciiDigits = (s) =>
  s.replace(/[٠-٩]/g, (d) => d.charCodeAt(0) - 0x0660).replace(/[۰-۹]/g, (d) => d.charCodeAt(0) - 0x06F0);

/** System prompt: the answer language comes from the content, or the user's explicit choice, not the UI. */
export function systemPrompt({ answerLanguage }) {
  const name = { ar: 'Arabic', en: 'English', es: 'Spanish' }[answerLanguage] ?? 'the language of the user\'s message';
  return `Answer in ${name}. Keep product names, code, URLs and numbers exactly as written.`;
}
```

We ran it in Node 24. It labelled وين طلبي؟ as `ar`, “¿Dónde está mi pedido?” as `es`, “Where is my order?” as `en`, and an Arabic sentence containing the code ORD-5521 as `ar`. “ok” came back `und`, which correctly falls back to “the language of the user’s message” in the prompt. And “ana 3ayez a3raf el order fen”, Egyptian Arabic in Latin letters ([Arabizi](https://broadrouter.com/glossary/arabizi/)), came back `es`, because the word “el” looks Spanish. That is the honest result for a heuristic. If your users write Arabizi, detect it explicitly and treat it as Arabic, as in [handling Arabizi](https://broadrouter.com/blog/arabizi-llm-handling/), and let users correct the answer language with one tap.

The digit helper turned ٢٠٢٦-١١-١٥ into 2026-11-15, and `isolate()` escaped HTML before wrapping, so a company name like `Acme <Ltd>` can’t inject markup.

## What else changes when the language changes?

-   **Text length.** Translated interface text is often longer. The W3C cites IBM guidelines expecting English strings of up to 10 characters to grow to 200–300% of their length in European languages, and strings over 70 characters to about 130%. Design buttons and labels to wrap, and test the Spanish build at narrow widths.
-   **Fonts.** Choose a font family with a matching Arabic design, and check Arabic line height: diacritics need room above and below.
-   **Search and matching.** Arabic text needs normalisation before matching (diacritics, alef forms, tatweel). The [Arabic text normalizer](https://broadrouter.com/tools/arabic-text-normalizer/) shows each rule.
-   **Speech.** Pick the transcription model by the audio’s language, not the interface. BroadNet lists one Arabic model and one 14-language model that covers English, Spanish and Arabic; its multilingual model page says to choose the Arabic model for Arabic audio. The [multilingual speech-to-text](https://broadrouter.com/blog/multilingual-speech-to-text-api/) post compares the options.
-   **Dialect.** “Arabic” is not one target. Users in Riyadh, Cairo and Casablanca write differently; [Gulf and Egyptian dialects](https://broadrouter.com/blog/arabic-llm-gulf-egyptian-dialects/) covers what to test.

## How do you evaluate and budget each language?

Separately. One combined score hides a weak language, and one combined budget hides an expensive one.

Build a small evaluation set per language from real messages, with native speakers labelling the expected answers. Check that the answer is in the requested language, that names, numbers and codes survive unchanged, and that quality holds for each dialect you serve. Run the same set when you change model or prompt; the method is in [evaluating an LLM before switching](https://broadrouter.com/blog/evaluate-llm-before-switching/).

For cost, token counts differ by language and tokenizer. In BroadRouter’s measured dataset, the same Modern Standard Arabic text needs 1.31× (Qwen3.8 27B) to 1.77× (GLM 5.3) the tokens of its English translation. [Real cost by language](https://broadrouter.com/data/real-cost-by-language/) turns those counts into money per model, including Spanish, and the [Arabic token counter](https://broadrouter.com/tools/arabic-token-counter/) measures your own text. Log tokens per request with the content language attached, and you can see cost per language per user, not just per month.

Finally, get native review before launch. Machine translation and model output both produce Arabic and Spanish that is grammatical but wrong for your audience. A reviewer who uses the product in their own language catches what no test does.

## Where BroadNet Inference fits

BroadRouter is BroadNet’s own site. BroadNet Inference’s models are a reasonable fit for an Arabic, English and Spanish product: BroadNet reports testing [Qwen3.8 27B](https://broadrouter.com/models/qwen3.8-27b/) in Arabic, including Gulf and Egyptian dialect understanding; [Gemma 4 VL 26B](https://broadrouter.com/models/gemma-4-vl-26b/) runs on the $5 starting credit; and transcription covers Arabic ([BroadNet Transcribe Arabic](https://broadrouter.com/models/cohere-transcribe-arabic/), $0.0042 per minute) and 14 languages including English and Spanish ([BroadNet Transcribe](https://broadrouter.com/models/cohere-transcribe/), $0.002 per minute). Inference content is not retained; necessary account, billing and security metadata is retained as described in BroadNet’s privacy statement. Everything in this post about layout, direction, formatting and detection is your application’s job, whichever API you use.

Free tools for this

-   [Arabic token counter](https://broadrouter.com/tools/arabic-token-counter/) Arabic vs English token counts per tokenizer: the "Arabic tax" in tokens and money.
-   [Arabic text normalizer](https://broadrouter.com/tools/arabic-text-normalizer/) Tashkeel, tatweel, alef, ya, ta marbuta, digits and invisible characters, with a matching Python function.
-   [Speech-to-text cost calculator](https://broadrouter.com/tools/speech-to-text-cost-calculator/) Hours, calls or voice notes to a monthly transcription bill, against your current provider.

[All free tools](https://broadrouter.com/tools/)

## Terms in this article

[Right-to-left (RTL) text](https://broadrouter.com/glossary/rtl-text/)

Right-to-left (RTL) text is writing, such as Arabic or Hebrew, displayed from right to left. Computers store it in logical reading order, and the Unicode Bidirectional Algorithm decides display order when RTL text mixes with left-to-right text, digits, model names or code.

[Token](https://broadrouter.com/glossary/token/)

A token is the unit of text a language model reads and writes: a word, part of a word, a punctuation mark or a byte sequence produced by the model's tokenizer. LLM APIs count, limit and usually bill usage in tokens.

[Arabizi](https://broadrouter.com/glossary/arabizi/)

Arabizi is Arabic written informally in Latin letters, using digits for Arabic sounds with no Latin equivalent, such as 3 for ع. It is common in chat and social media, is mostly dialectal, has no standard spelling, and is often mixed with English or French.

[Arabic diacritics (tashkeel)](https://broadrouter.com/glossary/arabic-diacritics/)

Arabic diacritics, or tashkeel, are small marks written above or below letters to show short vowels, doubled consonants and the absence of a vowel. They are optional: most Arabic text, including news, omits them, so readers and software infer the vowels from context.

[Code-switching](https://broadrouter.com/glossary/code-switching/)

Code-switching is the use of two or more languages, or varieties of one language, within the same conversation or sentence, in speech or writing. Examples include Arabic speakers mixing English words into dialect, or moving between Modern Standard Arabic and their dialect.

[Modern Standard Arabic (MSA)](https://broadrouter.com/glossary/msa/)

Modern Standard Arabic (MSA) is the standardized form of Arabic used in writing, news, education and formal speech across the Arab world. It is nobody's native everyday language: people speak regional dialects such as Egyptian or Gulf Arabic and switch to MSA in formal settings.

[Tool calling](https://broadrouter.com/glossary/tool-calling/)

Tool calling, also called function calling, is an LLM API feature in which the model returns a structured request to run a function the developer has defined, with JSON arguments. The application runs the function and sends the result back; the model never runs code itself.

[Arabic text normalization](https://broadrouter.com/glossary/arabic-text-normalization/)

Arabic text normalization is the step that maps spelling variants of the same word to one form before matching: removing diacritics and tatweel, unifying alef forms, and often mapping ى to ي and ة to ه. It is applied to search keys and evaluation, not to text you display.

## Questions

### Should the AI answer in the interface language or the user's language?

Default to the language of the user's message, and let the user override it. The interface locale only tells you how to lay out the screen. An Arabic interface user who types in English usually wants an English answer.

### How do I display English text inside an Arabic chat bubble?

Give each message element dir="auto" so the browser sets its direction from the first strong character, and wrap inserted names, codes and URLs in a bdi element. In plain text, wrap them in U+2068 FIRST STRONG ISOLATE and U+2069 POP DIRECTIONAL ISOLATE.

### Should Arabic users see Arabic-Indic digits?

It depends on the region and your users. In our Node 24 test, the default for ar-SA and ar-EG was Arabic-Indic digits and for ar-AE and ar-MA Western digits. Pick per locale, offer a setting, and accept both on input by normalising digits before parsing.

### How do I detect the language of a chat message?

For Arabic versus Latin script, counting characters in the Arabic Unicode block works. For telling English from Spanish, or handling short or mixed messages, use a trained language-ID model such as fastText's lid.176, and still treat the result as a hint.

### Does Arabic cost more than English with an LLM API?

Often, per message, because many tokenizers need more tokens for the same Arabic content. The ratio depends on the model's tokenizer. Measure it on your own text and budget each language separately.

## Keep reading

-   [Translate app strings to Arabic with an LLM: placeholders and plurals](https://broadrouter.com/blog/translate-app-strings-to-arabic-llm/)
-   [Arabic prompt engineering: register, RTL, numerals and mixed text](https://broadrouter.com/blog/arabic-prompt-engineering/)
-   [Arabizi and LLMs: handling Franco-Arabic with numbers like 3 and 7](https://broadrouter.com/blog/arabizi-llm-handling/)
-   [Tokens per word in Arabic vs English: why Arabic costs more](https://broadrouter.com/blog/tokens-per-word-arabic-english/)
-   [Gulf, Egyptian and Levantine Arabic: how LLMs handle dialects](https://broadrouter.com/blog/arabic-llm-gulf-egyptian-dialects/)
-   [Multilingual speech-to-text API: 14 languages, one endpoint](https://broadrouter.com/blog/multilingual-speech-to-text-api/)
-   [Choosing an LLM API for Arabic: what to test](https://broadrouter.com/blog/choosing-an-llm-for-arabic/)
-   [Add diacritics to Arabic text with an LLM: prompt, checks, DER](https://broadrouter.com/blog/arabic-diacritization-llm/)
-   [Arabic grammar and spelling correction with an LLM: a how-to](https://broadrouter.com/blog/arabic-grammar-spelling-correction-llm/)
-   [Guide: Arabic speech-to-text API, step by step](https://broadrouter.com/guides/arabic-speech-to-text-api/)
-   [Guide: Use the OpenAI Node.js SDK with BroadNet Inference](https://broadrouter.com/guides/openai-node-sdk/)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-multilingual-product-design&utm_content=page-cta) ·

**Sources**

-   [W3C Internationalization, Structural markup and right-to-left text in HTML (checked 2026-11-15)](https://www.w3.org/International/questions/qa-html-dir)
-   [W3C Internationalization, Inline markup and bidirectional text in HTML: dir="auto", bdi and U+2068 (checked 2026-11-15)](https://www.w3.org/International/articles/inline-bidi-markup/)
-   [W3C Internationalization, Text size in translation, with IBM expansion guidelines (checked 2026-11-15)](https://www.w3.org/International/articles/article-text-size.en)
-   [Unicode Standard Annex #9, Unicode Bidirectional Algorithm: explicit directional isolates (checked 2026-11-15)](https://www.unicode.org/reports/tr9/)
-   [MDN, CSS logical properties and values (checked 2026-11-15)](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values)
-   [MDN, Intl.Locale.prototype.numberingSystem (checked 2026-11-15)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/numberingSystem)
-   [Unicode CLDR, language plural rules chart (checked 2026-11-15)](https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html)
-   [fastText, language identification: lid.176 models for 176 languages (checked 2026-11-15)](https://fasttext.cc/docs/en/language-identification.html)
-   [BroadNet Inference API reference: always send language with transcription (checked 2026-11-15)](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-multilingual-product-design&utm_content=sources)
-   [BroadNet Inference pricing.json: transcription languages per model (checked 2026-11-15)](https://inference.broadnet.ai/pricing.json?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-multilingual-product-design&utm_content=sources)
-   [BroadNet Inference pricing page: Qwen3.8 27B "Tested in Arabic: fluent writing, Gulf and Egyptian dialects understood" (checked 2026-11-15)](https://inference.broadnet.ai/pricing?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-multilingual-product-design&utm_content=sources)
-   [BroadNet model page, BroadNet Transcribe: "For Arabic audio, choose our Arabic transcription model" (checked 2026-11-15)](https://www.broadnet.ai/inference/models/cohere-transcribe)
