DEV Community

Building a bilingual Arabic and English site with Astro: RTL, fonts, and SEO notes

I build websites for businesses in Kuwait, and most of them need both Arabic and English versions. Here are the practical things that mattered when I moved my builds to Astro, in case they save you time.

RTL is a layout decision, not a translation

Arabic is right-to-left, so the whole layout mirrors: navigation, icons, breadcrumbs, even image carousels. The cleanest approach I found:

<html lang = "ar" dir = "rtl" >

Set dir at the document level per locale, then use logical CSS properties (margin-inline-start, padding-inline-end, inset-inline-start) instead of margin-left / right. With logical properties, one stylesheet serves both directions and you avoid a parallel set of RTL overrides.

Fonts: Arabic first, then Latin

Arabic glyphs need a font that actually covers them. I load an Arabic webfont (IBM Plex Sans Arabic works well) and a Latin font, and stack them so Latin characters fall through to the Latin font inside Arabic pages:

font-family : 'IBM Plex Sans Arabic' , 'Inter' , sans-serif ;

Self-host both. It avoids a render flash and keeps the Largest Contentful Paint stable, which matters for Core Web Vitals.

hreflang is not optional

For each page pair, emit reciprocal hreflang links (ar, en, and x-default). Search engines mix up Arabic and English versions constantly without them, and the wrong language ranks for the wrong query. In Astro I generate these from a shared route map so the two versions can never drift apart.

Arabic slugs vs English slugs

I keep URLs in English for both locales (/en/services/..., /ar/services/...). Arabic slugs get percent-encoded into unreadable strings in shares and reports, and support tools handle ASCII paths more predictably.

Numbers, dates, and mixed-direction text

Phone numbers and prices inside Arabic paragraphs are the classic bidirectional-text trap. Wrap them in <bdi> or a dir="ltr" span so they render in the right order. Also decide per project whether to use Western (0-9) or Eastern Arabic (٠-٩) numerals and stay consistent; Kuwaiti business sites mostly use Western numerals.

These notes come from client work I publish under webinOO. If you maintain a bilingual site, I would be curious what bit you: fonts, RTL layouts, or search engines picking the wrong language?

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.