Translations
Info
All page names need to be in English.
en da  de  fr  it  ja  km  nl  ru  zh

Blueprints/Extbase-Translations

From TYPO3Wiki
Jump to: navigation, search

<- Back to blueprints overview

Blueprint: Extbase Translation Handling

Proposal Translation handling with extbase
Owner/Starter Frank Nägler
Participants/Members -
Status Draft, Discussion, Voting Phase, Accepted, Declined, Withdrawn
Current Progress Unknown, Started, Good Progress, Bad Progress, Stalled, Review Needed
Topic for Gerrit N/A

Target Versions/Milestones

  • Started during TYPO3 CMS 6.3 development

Goals / Motivation

At the moment it is not possible with extbase to translate a record (model). While there are properties for sys_language_uid and l10n_parent but the use of these properties within extbase is faulty.

Currently the properties _localizedUid and _languageUid are mapped to the two fields, however, there are some various problems. Firstly, the properties wich starts with an underscore (_) will be excluded by AbstractDomainObject::_getProperties(). Secondly, the Backend::objectUpdate() is flawed because these not make use of DataMapper::getTranslationOriginColumnName() to determine the correct field in the database.

Concept

The concept is simple: Make it possible to translate each record with a simple repository method like translate($recordObject, $targetLanguageUid).

To make this possible some changes in the Backend an Repository are necessary.

  1. Allow the use of the properties sys_language_uid and l10n_parent, e.g. by appropriate getter and setter.
  2. Introduction of a new repository method for translating records. (translate($originalObject, $targetLanguageUid))
  3. Introduction of a new repository method for check the existence of a translation (hasTranslation($originalObject, $languageUid = null))

Implementation Details

Definition of the new methods:

PHP script:
    /**
     * Check the existence of a translataion.
     *
     * @param object $originalObject The object to check
     * @param int $languageUid the language uid
     *
     * @return boolean
     */
    public function hasTranslation($originalObject, $languageUid = null) {
    	// if $languageUid !== null check existence of given language
    	// else check the existence of any langauge
    }
    
    /**
     * Translate a domain model into the specified language.
     *
     * @param object $originalObject The object to translate
     * @param int $targetLanguageUid the target language uid
     *
     * @return \TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject
     * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
     */
    public function translate($originalObject, $targetLanguageUid) {
    	// translate given $originalObject into the given target language
    	// after translation return the translated object
    }

A WIP patch is started: https://review.typo3.org/#/c/32866/

Risks

I think there are no risks, possibly the changes in the updateObject() method could lead to side effects, here the extbase experts have to say something.

Issues and reviews

Dependencies upon other Blueprints

  • At the moment not known.

External links for clarification of technologies

  • At the moment no external links