Supporting right-to-left languages: Arabic and Hebrew
To support right-to-left languages you need to make some changes to your templates.
Why
Right to left languages are often difficult to support on web sites. Zotonic adds some support to help you.
Assumptions
You need mod_translation enabled and Zotonic 0.8 or later.
How
Zotonic supports per page translation of content. This means that your page can have a mix of languages.
The idea is to give your <body/> tag the text direction of the main item visible on the page. Individual items, for example in menus or context lists, need their own text direction.
You can specify the text direction element attributes by including a template:
<body {% include "_language_attrs.tpl" id=id %} >This will generate the following, when Zotonic selected Arabic for the page with id id.
<body xml:lang="ar" lang="ar" dir="rtl" class="rtl">
When you want to add an extra class added to the rtl or ltr class you can use:
<body {% include "_language_attrs.tpl" id=id class="my-body-class" %} >And when you want to force a specific language:
<body {% include "_language_attrs.tpl" language=`en` %} >Troubleshooting
No troubleshooting yet.
This page is part of the Zotonic documentation, which is licensed under the Apache License 2.0.