eZPublishCommunityProject  2013.9
eZ\Publish\Core\Helper\TranslationHelper Class Reference

Helper class for translation. More...

Public Member Functions

 __construct (ConfigResolverInterface $configResolver)
 
 getTranslatedField (Content $content, $fieldDefIdentifier, $forcedLanguage=null)
 Returns Field object in the appropriate language for a given content. More...
 
 getTranslatedName (Content $content, $forcedLanguage=null)
 Returns content name, translated. More...
 

Protected Attributes

 $configResolver
 

Detailed Description

Helper class for translation.

Constructor & Destructor Documentation

eZ\Publish\Core\Helper\TranslationHelper::__construct ( ConfigResolverInterface  $configResolver)

Member Function Documentation

eZ\Publish\Core\Helper\TranslationHelper::getTranslatedField ( Content  $content,
  $fieldDefIdentifier,
  $forcedLanguage = null 
)

Returns Field object in the appropriate language for a given content.

By default, this method will return the field in current language if translation is present. If not, main language will be used. If $forcedLanguage is provided, will return the field in this language, if translation is present.

Parameters
\eZ\Publish\API\Repository\Values\Content\Content$content
string$fieldDefIdentifierField definition identifier.
string$forcedLanguageLocale we want the field translation in (e.g. "fre-FR"). Null by default (takes current locale)
Returns
|null
eZ\Publish\Core\Helper\TranslationHelper::getTranslatedName ( Content  $content,
  $forcedLanguage = null 
)

Returns content name, translated.

By default this method returns the name in current language, unless $forcedLanguage is provided.

Parameters
\eZ\Publish\API\Repository\Values\Content\Content$content
string$forcedLanguageLocale we want the content name translation in (e.g. "fre-FR"). Null by default (takes current locale)
Returns
string

Member Data Documentation

eZ\Publish\Core\Helper\TranslationHelper::$configResolver
protected

The documentation for this class was generated from the following file: