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

The i18n operator

Translating interface texts in templates with i18n: the context, the translator comment, placeholders with a hash or numbered with an array, washing, the x18n and d18n variants, and naming contexts for a theme.

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/designers/templates/i18n-operator.md

On this page

The i18n operator

This page is for designers who make template texts translatable. Every interface text a design prints goes through i18n (kernel/common/ezi18noperator.php, which calls ezpI18n::tr()).

Contents

  1. The call
  2. Contexts
  3. Placeholders
  4. Washing
  5. Variants

The call

{'Read more'|i18n( 'design/mytheme/line' )}
{'Read more'|i18n( 'design/mytheme/line', 'Link under a teaser' )}
ParameterMeaning
inputthe English source text
contextthe group of the text in the translation files
commenta note for translators (optional)
argumentsvalues for placeholders (optional)

If no translation exists for the current locale, the source text is shown.

Contexts

Use one context per area of your design, beginning with design/<theme>/: design/mytheme/pagelayout, design/mytheme/full/article, design/mytheme/forms. The same text in two contexts can have two translations, which matters for short words ("Open" a menu versus "Open" as a state).

Placeholders

Never build sentences by concatenating translated pieces: word order differs between languages. Put placeholders in the text.

Named, with a hash:

{'%count results for "%query"'|i18n( 'design/mytheme/search',, hash( '%count', $count, '%query', $query|wash ) )}

Numbered, with an array (the kernel's mail templates do this):

{"Collected information from %1"|i18n( "design/standard/content/edit",, array( $collection.object.name|wash ) )}

The empty second parameter skips the comment.

Washing

  • The translated text is not washed by i18n. Wash the values you put into placeholders (as above) when they come from content or the request.
  • In an attribute, wash the whole result: title="{'Close'|i18n( 'design/mytheme' )|wash}".

Variants

The kernel registers three names in the same class:

  • i18n: the normal case.
  • x18n: takes the extension name as an extra first parameter.
  • d18n: an alias of i18n for a variable input, so string extraction tools do not pick it up ({$label|d18n( 'design/mytheme' )}); the text must still exist in the translation file to be translated.

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