Most AI assistants are built English-first. When you build one for Persian (Farsi) speakers, a surprising number of assumptions break. Here are the main challenges we ran into while building Ziroo, a Persian AI assistant.
1. Right-to-left layout is more than dir="rtl"
Setting dir="rtl" on the root flips the page, but a chat UI mixes Persian text with English words, code, URLs and numbers. Each message bubble needs dir="auto" so the browser picks direction from the first strong character. Code blocks must always stay LTR, otherwise brackets and indentation look broken. Icons with direction (send arrows, back buttons) should be mirrored using logical CSS properties like margin-inline-start instead of margin-left.
2. Bidirectional text in streaming responses
LLM output arrives token by token. A line that begins with an English word may be rendered LTR until the Persian text arrives, then jump. We render with unicode-bidi: plaintext per paragraph so each line settles on its own direction and the jump disappears.
3. Normalizing characters
Persian shares the Arabic script, but keyboards produce different code points: Arabic ي and ك versus Persian ی and ک. Search, shopping queries and caching all fail silently unless input is normalized. Zero-width non-joiners (ZWNJ, U+200C) also matter: "میخواهم" is one word, not two, and tokenizers should keep it that way.
4. Digits and dates
Users type Persian digits (۱۲۳), Arabic-Indic digits (١٢٣) and Latin digits interchangeably. Prices in a shopping assistant must be parsed from all three. Dates usually mean the Solar Hijri calendar, so "next Friday" needs a Jalali-aware date library.
5. Prompting and tone
Models often answer Persian questions in English or in an overly formal register. A good system prompt, plus few-shot examples in natural conversational Persian, fixes most of it.
Wrapping up
None of these are hard individually, but together they decide whether a product feels native. If you want to see how this works in practice, try the web chat at ziroo.me. I'd love to hear how others handle RTL in AI interfaces.
Top comments (0)