public function addTranslationUnit(tao_helpers_translation_TranslationUnit $translationUnit)
    {
        
        // If the translation unit exists, we replace the target with the new one if it exists.
        foreach ($this->getTranslationUnits() as $tu) {
            
            if ($tu->getSource() == $translationUnit->getSource()) {
                // If we are here, it means that this TU is being overriden by
                // another one having the same source...
                //
                // Let's make sure we don't override the existing one with an empty target!
                if ($translationUnit->getTarget() !== '') {
                    $tu->setTarget($translationUnit->getTarget());
                    $tu->setAnnotations($translationUnit->getAnnotations());
                }

                return;
            }
        }
        
        // If we are here, it means that this TU does not exist.
        $translationUnit->setSourceLanguage($this->getSourceLanguage());
        $translationUnit->setTargetLanguage($this->getTargetLanguage());
        array_push($this->translationUnits, $translationUnit);
    }
public function addTranslationUnit(tao_helpers_translation_TranslationUnit $translationUnit)
    {
        
        // If the translation unit exists, we replace the target with the new one if it exists.
        foreach ($this->getTranslationUnits() as $tu) {
            
            if ($tu->getSource() == $translationUnit->getSource()) {
                // If we are here, it means that this TU is being overriden by
                // another one having the same source...
                //
                // Let's make sure we don't override the existing one with an empty target!
                if ($translationUnit->getTarget() !== '') {
                    $tu->setTarget($translationUnit->getTarget());
                    $tu->setAnnotations($translationUnit->getAnnotations());
                }

                return;
            }
        }
        
        // If we are here, it means that this TU does not exist.
        $translationUnit->setSourceLanguage($this->getSourceLanguage());
        $translationUnit->setTargetLanguage($this->getTargetLanguage());
        array_push($this->translationUnits, $translationUnit);
    }
public function addTranslationUnit ( tao_helpers_translation_TranslationUnit $ translationUnit ) { // If the translation unit exists, we replace the target with the new one if it exists. foreach ( $ this -> getTranslationUnits ( ) as $ tu ) { if ( $ tu -> getSource ( ) == $ translationUnit -> getSource ( ) ) { // If we are here, it means that this TU is being overriden by // another one having the same source... // // Let's make sure we don't override the existing one with an empty target! if ( $ translationUnit -> getTarget ( ) !== '' ) { $ tu -> setTarget ( $ translationUnit -> getTarget ( ) ) ; $ tu -> setAnnotations ( $ translationUnit -> getAnnotations ( ) ) ; } return ; } } // If we are here, it means that this TU does not exist. $ translationUnit -> setSourceLanguage ( $ this -> getSourceLanguage ( ) ) ; $ translationUnit -> setTargetLanguage ( $ this -> getTargetLanguage ( ) ) ; array_push ( $ this -> translationUnits , $ translationUnit ) ; }
Adds a TranslationUnit instance to the file.
It is appenned at the end of
collection.

@access public
@author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
@param  TranslationUnit translationUnit
@return mixed
Adds a TranslationUnit instance to the file . It is appenned at the end of collection .