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

Translations, locales and right-to-left

Internationalization in Exponential for developers used to Symfony Translation, Laravel's lang files, gettext in Django and Rails I18n - interface strings in Qt Linguist .ts catalogues, the i18n operator and…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/web-framework-developers/i18n-l10n-and-rtl.md

On this page

Translations, locales and right-to-left

This page is for developers who translate an application with message catalogues and format dates and numbers by locale. Exponential separates two things that frameworks often mix: the interface (texts in templates and PHP, translated with catalogues) and the content (translated by editors, each object version holding one set of values per language).

Contents

  1. Interface texts
  2. Locales and formatting
  3. Content in several languages
  4. Right-to-left
  5. Compared with other frameworks

Interface texts

WhereHow
Templates{'Latest items'|i18n( 'extension/expdemo' )}; placeholders: {'%count items'|i18n( 'extension/expdemo',, hash( '%count', $count ) )}
PHPezpI18n::tr( 'extension/expdemo', 'Latest items' ) (kernel/common/ezpi18n.php)
Cataloguesextension/<ext>/translations/<locale>/translation.ts, Qt Linguist XML; the kernel's in share/translations/<locale>/translation.ts
Registrationsite.ini [RegionalSettings] TranslationExtensions[]=<ext>

The first argument is the context, which groups strings the way a translation domain does. The source text is the key, as in gettext (View results: translated texts, i18n operator, Translation catalogues). The interface language of a siteaccess is site.ini [RegionalSettings] Locale.

Locales and formatting

Locales are INI files in share/locale/ (eng-GB.ini, ger-DE.ini, ara-SA.ini ...), read by eZLocale. They hold date, time, number and currency formats and the text direction. Templates format with the locale operators l10n, datetime and locale (Dates, numbers and l10n):

{$node.object.published|l10n( 'shortdate' )}
{$price|l10n( 'currency' )}

Locale codes are the three-letter language plus country form (eng-US, ger-DE), not en_US; the standard page explains how they relate to BCP 47 tags (Language tags).

Content in several languages

  • Each content object can be translated into the languages of the installation; every version holds one set of attribute values per language. Editors translate in the administration; there is no translation table to design.
  • A siteaccess shows content in the languages of site.ini [RegionalSettings] SiteLanguageList[], in order, falling back to the next one (Content languages).
  • A typical multilingual site uses one siteaccess per language, matched by path or host (Siteaccesses, Multilingual sites).
  • URL aliases exist per translation (Pretty URLs).
  • In PHP, $object->fetchDataMap( false, 'ger-DE' ) reads one language.

Right-to-left

The direction comes only from the locale file ([LanguageSettings] TextDirection=rtl); eZLocale::isRightToLeft() and eZLocale::textDirectionOf( 'heb-IL' ) answer it in PHP, and $site.text_direction in templates. Print it on <html> in your pagelayout:

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

Write stylesheets with logical properties (margin-inline-start, text-align: start) so one stylesheet serves both directions (Right-to-left sites, Right-to-left languages in the administration).

Compared with other frameworks

FrameworkInterface stringsContent translationsExponential
SymfonyTranslation component, XLIFF or YAMLseparate bundles.ts catalogues; translations built into content
Laravellang/ files, __()packagesthe same
Djangogettext .po, gettext()packages such as model translation appsthe same
RailsI18n YAML, t()gemsthe same
SpringMessageSource, propertiesyour own designthe same

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