Message-ID: <489449961.3816.1485855454144.JavaMail.confluence@ip-10-127-227-164> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_3815_1489947361.1485855454144" ------=_Part_3815_1489947361.1485855454144 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html ez_trans_prop

ez_trans_prop

=20
=20
=20
=20

Description

ez_trans_prop() is a generic, low level Twig helper which g= ets the translated value of a multi valued(translations) property.

If the current language cannot be found as a translation for content, the m= ain language (see=20 further down for d= etails) will be used if this is supported by the provided=20 object. This behavior is identical when  forcing a language using  forcedLanguage.

Prototype and Arguments

ez_trans_prop( ValueObject obje= ct, string property[, string&nbs= p;forcedLanguage)

Argument name Type Description
object eZ\Publish\API\Repository\Va= lues\ValueObject ValueObject object property belongs to.
property string Property to get translated value f= rom, logic is using one of the following (in this order):
  • object method "get{property}" 
  • object property  "{property}s"
forcedLanguage string Optional language we want to force= (e.g. "eng-US"), otherwise takes prioritized languag= es from SiteAccess settings.
Main language use

Main language is attempted to be applied in the following way for V= alue objects that support this:

  • When attribute is retrieved via = object property: Use mainLanguageCode= property if it exists as fallback language, but only if eit= her alwaysAvailable property does n= ot exists or is true.
  • When attribute is retrieved via object = method: Provide $language =3D null as the only argum= ent to the method, depends on logic of ValueObject if this gives a fallback= value or not

Usage of ez_trans_prop

Example below shows how this function can be used to get the Content nam= e with exact same result as using ez_content_name(content)

=20
{{ ez_trans_prop( versionInfo, "name" ) }}
=20

Example for ContentType->names:

=20
{{ ez_trans_prop( contentType, "name" ) }}
=20
=20
=20
=20
=20

=20
=20
=20
------=_Part_3815_1489947361.1485855454144--