Skip to content

AI Features for Persian (RTL) Products: Practical Notes

By Morteza Bazrafshan2 min readAIPersianLocalization

If your users read Persian, an AI feature has a few extra things to get right. These are practical observations from building products for Persian speakers, not benchmarks.

Test in Persian, with Persian reviewers

A prompt that works well in English can behave differently in Persian: tone, formality and word choice shift. Build your evaluation set (see judging AI output) from real Persian inputs, and have a native speaker review the results. Automated checks will not catch an answer that is technically correct but sounds stiff or translated.

Tokens can cost more

Tokenizers are often tuned for English, so the same meaning in Persian may use more tokens, which affects both cost and how much fits in the context window. Measure with your provider's tokenizer rather than assuming. See AI cost and tokens.

Mixed-direction text

Persian text frequently contains Latin words, numbers, URLs and code. When rendering model output:

  • Set dir="rtl" and lang="fa" on Persian blocks, and let the browser's bidi algorithm handle inline Latin.
  • Use dir="auto" for user-generated or model-generated snippets where direction is unknown.
  • Wrap code, URLs and identifiers in dir="ltr" elements so punctuation does not jump to the wrong side.
  • Prefer CSS logical properties (margin-inline-start, text-align: start) over left/right.

Numerals and dates

Decide whether you display Persian digits (۱۲۳) or Latin ones, and be consistent, including in model output. Tell the model which you want. For dates, decide between Jalali and Gregorian per context, and state the calendar in the prompt, since models may mix them up. Do arithmetic and date conversion in code, not in the model.

Normalize input

Persian text has look-alike characters (Arabic vs Persian "ye" and "kaf"), zero-width non-joiners and varied spacing. Normalize before search, matching or deduplication, and keep the original for display.

Fonts and typography

Use a font with good Persian support and proper weights, load it with font-display: swap, and set a slightly larger line height than you would for Latin text. Check that your UI does not clip taller ascenders and descenders.

Writing the prompts

For the prompt side of Persian products, see the Persian-language post نوشتنِ پرامپت برای فارسی‌زبان‌ها.

Voice and honesty

Match the register your brand uses, formal or conversational, in the prompt with a couple of examples. And, as in any language, tell users clearly when they are talking to AI.

Frequently asked questions

Does Persian cost more tokens than English?

Often yes, because tokenizers are usually tuned for English. Measure with your provider's tokenizer rather than assuming.

How do I display mixed Persian and English text?

Set dir and lang on Persian blocks, use dir auto for unknown text, and wrap code and URLs in left-to-right elements so punctuation stays in place.

Related posts