Get translation by key .

@param $key
@param array $replacement
@param null $locale
@return bool
345316
public function get($key, $replacement = array(), $locale = null) {
        $value = $this->getStoreTranslation($key, $this->locale($locale));

        return $this->replace($value, $replacement);
    }
218403
public function getHelpTextByKeyLocale($translationKey, $locale)
    {
        $qb = $this->createQueryBuilder('h');
        $qb->where('h.locale LIKE :locale')
            ->andWhere('h.translationKey LIKE :translationKey')
            ->orderBy('h.id', 'asc')
            ->setParameter(':locale', substr($locale, 0, 2).'%')
            ->setParameter(':translationKey', $translationKey.'%');

        try {
            $helpText = $qb->getQuery()->getSingleResult();
        } catch (NoResultException $e) {
            $qb = $this->createQueryBuilder('h');
            $qb->where('h.locale LIKE :locale')
                ->andWhere('h.translationKey = :translationKey')
                ->orderBy('h.id', 'asc')
                ->setParameter(':locale', substr($locale, 0, 2).'%')
                ->setParameter(':translationKey', 'not_found');
            $helpText = $qb->getQuery()->getSingleResult();
        }

        return $helpText;
    }
1337688
private function getFromExcludedSource($key, $replace, $locale, $fallback)
    {
        if(!PageKey::fromLineKeyString($key)->isExcludedSource()) return null;

        return parent::get($key, $replace, $locale, $fallback);
    }
512300
public function getName(string $key, string $locale = null)
    {
        return $this->get($key, $locale);
    }
1119737
public function has($key, $locale = null) {
        $locale = $this->locale($locale);

        return $this->get($key, [], $locale) !== $key;
    }
545707
private function translate($key, $translations)
    {
        if (!is_null($translations) && isset($translations[$key])) {
            return $translations[$key];
        }

        return $key;
    }
697356
public function getTranslation(
        string $language,
        string $key
    ) : Translation {
        $languages = $this
            ->repositoryCollection
            ->getTranslations(
                [],
                [$language],
                function (Translation $translation) use ($key) {
                    return $translation->getKey() === $key;
                }
            );

        $firstLanguage = reset($languages);

        return $firstLanguage;
    }
944592
protected function getStoreTranslation($key, $locale) {
        if( ! isset($this->translations[$locale][$key]) )  {
            $response = $this->apiRequest(
                $this->getAttribute('api_url'), [ 'text' => $key, 'lang' => $locale]
            );

            $response = json_decode($response, true);

            $this->translations[$locale][$key] = $response['text'][0];
        }

        return $this->translations[$locale][$key];
    }
1096589
public function getLocalizedColumn($key, $locale = 'en')
    {
        if (empty($locale)) {
            $locale = 'en';
        }
        $localizedKey = $key.'_'.strtolower($locale);
        $value        = $this->$localizedKey;
        if (empty($value)) {
            $localizedKey = $key.'_en';
            $value        = $this->$localizedKey;
        }

        return $value;
    }
696434
protected function translate($key, $params = null, $language = null) {
		return Translation :: translate($key, $params, $language, $this -> getViewmodel());
	}
308474
function keyTranslate( $key )
    {
        $msg = $this->findKey( $key );
        if ( $msg !== null )
            return $msg["translation"];
        else
        {
            return null;
        }
    }
936355
public function findTranslation($domain, $key, $locale, $nullWhenNotFound = false)
    {
        // Get the unit
        try {
            $unit = $this->findByDomainAndKey($domain, $key);
        } catch (NotFoundException $e) {
            if ($nullWhenNotFound) {
                return;
            }
            throw $e;
        }

        // Check translation
        if ($unit && $unit->hasTranslation($locale)) {
            return $unit->getTranslation($locale);
        }

        return;
    }
710063
public function choice($key, $number, array $replace = array(), $locale = null)
    {
        return $this->lang->choice($key, $number, $replace, $locale);
    }
117043
public function trans($key, array $replace = [], $locale = null)
    {
        return $this->get($key, $replace, $locale);
    }
597828
public function translateOrFirst($locale = null)
    {
        $translation = $this->translate($locale, true);

        if ( ! $translation)
        {
            $translation = $this->translations->first();
        }

        return $translation;
    }
1001772
public function get($key, $locale = null) {
        $segments = $this->parseKey($key);
        $group = $segments[0];
        $item = $segments[1];

        if ("" == $group) {
            return "";
        }

        $localeArray = $this->parseLocale($locale);
        foreach ($localeArray as $locale) {
            $this->load($group, $locale);

            if (isset($this->loaded[$group][$locale])) {
                if (null == $item) {
                    return $this->loaded[$group][$locale];
                } elseif (isset($this->loaded[$group][$locale][$item])) {
                    return $this->loaded[$group][$locale][$item];
                }
            }
        }

        return "";
    }
633805
public function translate($locale) {
		$localeEntity = clone $this;
		$localeEntity->setLocale($locale);
		if(isset($this->data['translations'][$locale]))
			$localeEntity->_set($this->data['translations'][$locale]);
		unset($localeEntity->data['translations'][$locale]);
		$localeEntity->data['translations'][$this->getLocale()] = $this->data['properties'];

		return $localeEntity;
	}