Merges this translation with other translation.

@param Translation $translation The translation to merge with
@param int         $options

@return self
356129
public function mergeWith(Translation $translation, $options = Merge::DEFAULTS)
    {
        Merge::mergeTranslation($translation, $this, $options);
        Merge::mergeReferences($translation, $this, $options);
        Merge::mergeComments($translation, $this, $options);
        Merge::mergeExtractedComments($translation, $this, $options);
        Merge::mergeFlags($translation, $this, $options);

        return $this;
    }
122564
public function setTranslations(ArrayCollection $translations)
    {
        foreach ($translations as $translation) {
            $translation->setObject($this);
        }

        $this->translations = $translations;
    }
965697
public function hardTranslationSetMerge(Locale $locale, $from, $into)
    {
        foreach ($from as $translation) {
            $translationString = $translation->getTranslation();
            $original = $translation->getOriginal();
            $context = $translation->getContext();
            $merged = $this->addOrCreateString($into, $context, $original);
            $merged->setTranslation($translationString);

            // The following raises an array to string warning
            // $merged->setPluralTranslation($translation->getPluralTranslation());
        }
    }
218739
public function addTranslation(\Lexik\Bundle\TranslationBundle\Model\Translation $translation)
    {
        $translation->setFile($this);

        $this->translations[] = $translation;
    }
669537
public function merge($definition)
    {
        $constraints = $this->explodeConstraints($definition);

        foreach ($constraints as $index=>$definition) {

            list($name, $parameters) = is_array($definition) ?
                                       [$index, $definition] :
                                       $this->nameAndParameters($definition);

            $constraint = $this->newConstraint(
                Type::snake_case($name),
                $parameters,
                ''
            );
            $this->constraints[$constraint->name()] = $constraint;

        }
        return $this;
    }
797027
public static function generate(Translations $translations, array $options = [])
    {
        $options += static::$options;

        return self::toArray($translations, $options['includeHeaders'], true);
    }
768192
public function loadTranslations($translations)
    {
        if (is_object($translations) && $translations instanceof Translations) {
            $translations = PhpArray::generate($translations, ['includeHeaders' => false]);
        } elseif (is_string($translations) && is_file($translations)) {
            $translations = include $translations;
        } elseif (!is_array($translations)) {
            throw new \InvalidArgumentException(
                'Invalid Translator: only arrays, files or instance of Translations are allowed'
            );
        }

        $this->addTranslations($translations);

        return $this;
    }
1167900
public function save(array $options = []) {
        $saved = parent::save($options);

        array_walk($this->translations, function($translation, $locale)  {
            if(! array_filter($translation))
                return false;

            $this->newTranslation($locale, $translation)
                ->save();
        });

        return $saved;
    }
1005198
protected function replace($translation, $replacement = []) {
        foreach ($replacement as $key => $value) {
            $translation = str_replace(':'.$key, $value, $translation);
        }

        return $translation;
    }
1066659
public function setTranslator($translator)
    {
        ObjectHelper::isInstanceOf($translator, [Organization::class, PersonInterface::class]);
        
        $this->_translator = $translator;
        return $this;
    }
1350375
public function addTranslation(CountryTranslation $trans)
    {
        if (!$this->translations->contains($trans)) {
            $this->translations->add($trans);
            $trans->setObject($this);
        }

        return $this;
    }
1310632
public function addNodeTranslation(NodeTranslation $nodeTranslation)
    {
        $this->nodeTranslations[] = $nodeTranslation;
        $nodeTranslation->setNode($this);

        return $this;
    }
132314
public function addTranslation(\Haven\PersonaBundle\Entity\StateTranslation $translations)
    {
        $this->translations[] = $translations;
    
        return $this;
    }
225724
public function addTranslation(TranslationInterface $translation)
    {
        if (!$this->translations->contains($translation)) {
            $this->translations[$translation->getLocale()] = $translation;
            $translation->setTranslatable($this);
        }
    
        return $this;
    }
1029458
public function setTranslator(\Symfony\Component\Translation\Translator $translator)
    {
        $this->translator = $translator;
        return $this->translator;
    }
193049
public function merge($options)
    {
        if (is_array($options)) {
            $this->options = array_merge_recursive($this->options, $options);
        } elseif ($options instanceof self) {
            $this->options = array_merge_recursive($this->options, $options->options);
        }
    }
1091125
public static function translate_plural($string, Translation $translation = null) {
		if ($translation !== null) {
			$translation = self::get($translation->language, $translation->application_name);
		} else {
			$translation = self::get();
		}

		return $translation->translate_string($string);
	}