Add metabox translation.

@param string $key
@param string $translation

@return MetaboxInterface
552025
public function addTranslation(string $key, string $translation): MetaboxInterface
    {
        $this->l10n[$key] = $translation;

        return $this;
    }
10011
protected function addTranslation($localeName, $keyName, $text)
    {
        $locale = new LocaleTransfer();
        $locale->setLocaleName($localeName);
        $translation = [];

        $translation['text'] = $text;
        $translation['created'] = false;
        $translation['updated'] = false;

        if (!$this->glossaryFacade->hasTranslation($keyName, $locale)) {
            $this->glossaryFacade->createAndTouchTranslation($keyName, $locale, $text, true);
            $translation['created'] = true;

            return $translation;
        }

        $this->glossaryFacade->updateAndTouchTranslation($keyName, $locale, $text, true);
        $translation['updated'] = true;

        return $translation;
    }
276557
public static function translate($string, Translation $translation = null) {
		if ($translation !== null) {
			$translation = self::get($translation->language, $translation->application_name);
		} else {
			$translation = self::get(\Application::get()->language, \Application::get()->name);
		}

		return $translation->translate_string($string);
	}
1207313
public function addTranslation(TranslationInterface $translation)
    {
        if (!$this->translations->containsKey($translation->getLocale())) {
            $this->translations->set($translation->getLocale(), $translation);
            $translation->setTranslatable($this);
        }

        return $this;
    }
1047320
public function addTranslation(BlogContentTranslation $translations) {
        $translations->setParent($this);
        $this->translations[] = $translations;

        return $this;
    }
339402
private static function register( $string_key, $translation ) {

		/**
		 * Converts string into reference object variable
		 * Uses the same logic as JS to create the same references
		 */
		$ref = '__' . $string_key;

		// Add it to the strings localized
		self::$strings[ $ref ] = $translation;

		// Remove the old key
		unset( self::$strings[ $string_key ] );
	}
828148
public function add($key, $message)
    {
        if ($this->isUnique($key, $message)) {
            $this->messages[$key][] = $message;
        }

        return $this;
    }
1294985
public static function createFromFieldTranslation(FieldTranslation $translation): self
    {
        $message = new self();
        $message->setLocale($translation->getLocale());
        $message->setValue($translation->getValue());

        return $message;
    }
1092869
public function addTranslation(\Sulu\Bundle\Sales\ShippingBundle\Entity\ShippingStatusTranslation $translations)
    {
        $this->translations[] = $translations;
    
        return $this;
    }
545707
private function translate($key, $translations)
    {
        if (!is_null($translations) && isset($translations[$key])) {
            return $translations[$key];
        }

        return $key;
    }
901688
public function setTranslations(string $key, array $translations)
    {
        $this->guardAgainstUntranslatableAttribute($key);

        foreach ($translations as $locale => $translation) {
            $this->setTranslation($key, $locale, $translation);
        }

        return $this;
    }
144506
public function addMeta($key, $data = null)
    {
        if (is_array($key)) {
            $this->meta += $key;
        } else {
            $this->meta[$key] = $data;
        }

        return $this;
    }
1349831
public function setTranslationsForKey(array $messages, $key)
    {
        foreach ($messages as $language => $value) {
            $this->setTranslation($key, $value, $language);
        }
    }
225724
public function addTranslation(TranslationInterface $translation)
    {
        if (!$this->translations->contains($translation)) {
            $this->translations[$translation->getLocale()] = $translation;
            $translation->setTranslatable($this);
        }
    
        return $this;
    }
659685
public static function createFromCategoryTranslation(CategoryTranslation $translation): self
    {
        $message = new self();
        $message->setLocale($translation->getLocale());
        $message->setTitle($translation->getTitle());
        $message->setDescription($translation->getDescription());

        return $message;
    }
964494
public function add($key, $message)
    {
        $fullKey = static::SESSION_NAME.'.'.$key;
        $base = Base::instance();
        if ($base->exists($fullKey)) {
            $base->push($fullKey, $message);
        } else {
            $base->set($fullKey, [$message]);
        }

        return $this;
    }
157689
private function translateWithLang($key, $lang) {
        if (!isset($this->translations[$lang]) || !isset($this->translations[$lang][$key])) {
            return null;
        }

        return $this->translations[$lang][$key];
    }