Skip to content

Key Concepts › Localization

RTL & Arabic

Every Tjjar storefront ships in Arabic and English, and Arabic is the default. A theme that works in English and breaks in Arabic is a broken theme, not a theme with a known issue.

Direction comes from the context

layout.jinja sets it once, and everything inherits:

<html lang="{{ request.locale }}" dir="{{ request.direction }}">

request.direction is rtl or ltr. Do not compute it yourself from the locale, and do not hardcode either value.

Use logical CSS properties, never physical ones

This is the single rule that makes a theme mirror correctly. A physical property names a side of the screen; a logical property names a side of the text flow, and flips automatically.

Instead ofWrite
margin-leftmargin-inline-start
padding-rightpadding-inline-end
left: 0inset-inline-start: 0
text-align: lefttext-align: start
border-leftborder-inline-start
float: leftfloat: inline-start
/* Correct — mirrors on its own */
.product-card__badge {
  inset-inline-start: 0.75rem;
  padding-inline: 0.5rem 0.75rem;
  text-align: start;
}

/* Wrong — the badge stays on the left in Arabic and collides with the image */
.product-card__badge {
  left: 0.75rem;
  padding: 0 0.75rem 0 0.5rem;
  text-align: left;
}

There is no rtl: override you should be reaching for. If you find yourself writing direction-specific rules, the underlying property is almost always physical and should be logical instead.

Things that must not flip

Mirroring is about layout, not about everything. These stay as they are:

  • Numbers, prices, SKUs and phone numbers. Always left-to-right, always Latin digits.
  • Latin brand names and code. IBM Plex, product.price — isolate them, see below.
  • Media playback controls and progress bars that represent time.
  • Logos, unless the merchant supplied a separate Arabic wordmark — and they can, via the logo_ar and logo_en brand slots.

Icons that indicate direction do flip: a "next" chevron points left in Arabic. Use transform: scaleX(-1) under [dir='rtl'] for those specific icons, or ship a mirrored asset.

Isolate Latin runs inside Arabic text

This is the most common and least obvious bug in Arabic interfaces. When a Latin string sits inside an Arabic sentence, the bidirectional algorithm can reorder it — trailing punctuation and brackets jump to the wrong end, so {% extends %} renders as %} extends {%.

Wrap any Latin run you interpolate into Arabic prose:

.code,
.sku,
.order-number {
  unicode-bidi: isolate;
  direction: ltr;
}
<p>{{ t.order.placed }} <span class="order-number">{{ order.number }}</span></p>

Without the isolation, an order number ending in # displays the # on the wrong side, and a shopper reads the number back incorrectly to support.

Typography

The platform serves IBM Plex Sans Arabic and sets a slightly larger size and looser line height for Arabic, because Arabic letterforms need more vertical room than Latin at the same nominal size. You inherit this. If you load your own font, make sure it has real Arabic coverage — a Latin font with a fallback produces a page where half the words are in a different typeface.

Avoid text-transform: uppercase. It does nothing in Arabic, so a heading styled that way looks deliberate in English and inconsistent in Arabic.

Bilingual copy

Merchant-authored copy — the section headings a merchant types in the Theme Editor — arrives with the active language already chosen for you:

<h2>{{ section.settings.heading }}</h2>

Your own strings come from locales/ar.json and locales/en.json, read as t:

<button>{{ t.cart.add }}</button>

Both files must contain the same keys. The validator fails a theme where they diverge — a missing Arabic key means a shopper sees an English word in the middle of an Arabic page.

Testing

Append ?locale=ar to any preview URL. Check specifically for:

  • Layout that did not mirror (a physical property somewhere).
  • Latin text reordered inside an Arabic sentence (missing isolation).
  • English strings appearing on the Arabic page (a missing locale key).
  • Horizontal scrolling, which usually means a fixed width tuned to English text length.