Skip to content
New: Customize your theme with an AI assistant. Read the guide

RTL & Arabic

Files: src/config/language.json, src/config/fonts.json, src/i18n/ar.json, src/config/menu.ar.json, src/content/**/arabic/ · Skill level: Beginner

Covena supports right-to-left (RTL) languages on every page, and ships Arabic as a complete example at /ar/. Every page, menu, and label has an Arabic version. For how languages work in general, see Internationalization.

What Mirrors

One value turns a language right to left: "dir": "rtl" in its entry in src/config/language.json. The page then gets dir="rtl" and everything follows:

  • The layout: columns, cards, the header, the footer, and the mobile menu, which slides in from the other side.
  • The menus: the desktop panel and flyouts open the other way, and the left and right arrow keys swap.
  • Icons that point in a direction, such as arrows. Icons without a direction stay as they are.
  • Sliders, marquees, and scroll motion, which move and wipe the other way.

Some things stay left to right on purpose: phone numbers, email addresses, and code.

Arabic Type

Arabic pages use IBM Plex Sans Arabic. It loads only on Arabic pages, because its entry in src/config/fonts.json has "languages": ["ar"], so English and French pages never download it.

Arabic has no italic, so the italic accent word in headings (the word in <em>) is set upright at weight 500 instead. Only weights 400 and 500 are loaded. These rules are the :lang(ar) rules in src/styles/base.css.

Numbers on Arabic pages use Western digits, such as “1,800”, and prices put the currency after the figure: “1,250 £”. See Internationalization.

Edit The Arabic Text

WhatFile
Page and section textthe arabic/ folder in each content folder, such as src/content/sections/arabic/
Buttons, labels, the address, and opening hourssrc/i18n/ar.json
Menussrc/config/menu.ar.json
The tagline in page titlescommon.tagline in src/i18n/ar.json

Write internal links without a language (/fees/). The theme turns them into /ar/fees/ on Arabic pages.

Add Another RTL Language

  1. Add the language with --dir rtl (Hebrew as the example):

    Terminal window
    npm run generate-multilingual-content -- --lang he --name עברית --dir-name hebrew --locale he-IL --og he_IL --dir rtl
  2. Translate the new hebrew/ folders, src/config/menu.he.json, and src/i18n/he.json.

  3. Add a font that covers the script to src/config/fonts.json with "languages": ["he"], following the IBM Plex Sans Arabic entry.

  4. Restart the dev server and check the pages at /he/.

Remove Arabic

Add "ar" to disableLanguages under [settings.multilingual] in config.toml:

[settings.multilingual]
disableLanguages = ["ar"]

Restart npm run dev. The Arabic files stay, so you can turn it back on later.

For Developers

Keep new code working right to left. The theme’s own rules, from AGENTS.md:

  • Use logical classes: ms/me, ps/pe, start/end, text-start/text-end, rounded-s/rounded-e, border-s/border-e. Never ml/mr, pl/pr, left/right, or text-left for layout.
  • In raw CSS use margin-inline, padding-inline, inset-inline, and text-align: start.
  • translate-x-* and gradient directions don’t flip by themselves. Add an rtl: variant, such as rtl:-scale-x-100 on an arrow.
  • Direction-bearing icons mirror in one place: the directionalIcons list in src/layouts/helpers/Icons.astro.
  • Read the direction through getLangDir in src/lib/utils/i18nUtils.ts. Never check a literal language code.

Check a page at /ar/ after any layout change.

Do It With AI

Check that [COMPONENT FILE] works right to left. Replace any physical class (ml-, mr-,
pl-, pr-, left-, right-, text-left, text-right) with its logical version (ms-, me-, ps-,
pe-, start-, end-, text-start, text-end). Add rtl:-scale-x-100 to arrows that point
sideways. Don't change anything else, then show me the page at /ar/.
Type something to search...