Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,110 of 9,110 pages
About the help in other languages
All help pages

Right-to-left sites

Build a public site in Arabic, Hebrew, Persian or another right-to-left language - where the direction comes from, setting dir on the page and on content, CSS logical properties, and how to test.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/creators/website-creators/right-to-left-sites.md

On this page

Right-to-left sites

This page is for website creators who build a public site, or a language of one, in a right-to-left script. The administration turns around by itself for right-to-left interface languages (Right-to-left languages in the administration); a public design does what its templates and stylesheets say, so this page shows what to add.

Contents

  1. Where the direction comes from
  2. The page
  3. Content in a right-to-left language
  4. Stylesheets
  5. Testing

Where the direction comes from

The only source is the locale file: share/locale/<locale>.ini, [LanguageSettings] TextDirection=rtl. 43 locale files carry it; the list is in Languages in Exponential. The kernel exposes it:

WhereWhat
$site.text_directionrtl or ltr for the current interface locale of the siteaccess
$code|locale().is_right_to_leftfor any locale code in a template
eZLocale::textDirectionOf( 'heb-IL' )the same in PHP

The page

Print the direction on <html> in your pagelayout, as the administration pagelayouts do:

<html lang="{$site.http_equiv.Content-language|wash}"{if eq( first_set( $site.text_direction, 'ltr' ), 'rtl' )} dir="rtl"{/if}>

The siteaccess's Locale decides $site.text_direction, so an Arabic siteaccess with Locale=ara-SA gets dir="rtl" and an English one gets nothing.

Content in a right-to-left language

A page may show content in another direction than the interface, for example an Arabic quote on an English page. design/standard/templates/parts/exp_content_direction.tpl prints lang="..." dir="rtl" for a right-to-left content locale and nothing for a left-to-right one; include it on the element that wraps the content. The online editors switch their direction for right-to-left texts, so editors write in the right direction.

Stylesheets

Instead ofWrite
margin-left, padding-rightmargin-inline-start, padding-inline-end
left: 0, right: 0inset-inline-start: 0, inset-inline-end: 0
text-align: lefttext-align: start
float: leftflex or grid layouts, which follow the direction
arrow icons pointing "forward"flip them with [dir="rtl"] .icon-forward { transform: scaleX(-1); }

With logical properties one stylesheet serves both directions; no -rtl.css copy to maintain.

Testing

  • To do: Open the right-to-left siteaccess: <html dir="rtl"> is present, columns and menus mirror.
  • To do: Mixed text (numbers, Latin words in Arabic text) reads correctly.
  • To do: Forms: labels, inputs and error messages align to the start side.
  • To do: Icons that point along the line point the right way.
  • To do: The left-to-right sites look exactly as before.
  • To do: Check at a narrow width too; menus that collapse often break first.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x