Translate key .

@param $key
@param $translation
@param null $locale
@return bool
161629
public function translate($key, $translation, $locale = null) {
        $locale = $this->locale($locale);

        return Lang::get($key, null, $locale);
    }
118918
public function translate($locale = null)
    {
        if (!$locale) {
            $locale = \localizer\locale()->id();
        } else {
            $locale = (int)$locale;
        }

        return $this->getTranslation($locale);
    }
533733
public function searchHelpTextByKeyLocale($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.'%');

        return $qb->getQuery()->getResult();
    }
67231
public function translate($key, $translation, $locale = null, $driver = null) {
        $driver = ! is_null($driver) ? $this->getDriver($driver) : $this->driver();

        return $driver->translate(
            $key, $translation, $locale
        );
    }
1339499
private function getRealKey(string $key, string $locale = null): string
    {
        if (!$locale) {
            $locale = $this->defaultLanguage;
        }
        
        if (\strpos($key, '.') === false) {
            $key = implode([$this->defualtCategory, $key], '.');
        }

        return implode('.', [$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;
    }
814886
public function get($key, $locale = null)
    {
        return $this->translator->get("log-viewer::levels.$key", [], $locale ?: $this->getLocale());
    }
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;
    }
1085748
public function getByKey($key, $locale, $group = null) {
        $query = $this->source
            ->select('languages.slug as locale', 'translations.*')
            ->join('languages', 'languages.id', '=','translations.language_id')
            ->where('languages.slug', $locale)
            ->whereKey($key);

        if($group)
            $query->where('group', $group);

        return $query
            ->first();
    }
1065147
public function forgetTranslation($key, $locale)
    {
        $translations = $this->getTranslations($key);
        unset($translations[$locale]);

        if ($this->hasSetMutator($key))
            $this->attributes[$key] = $this->asJson($translations);
        else
            $this->setAttribute($key, $translations);

        return $this;
    }
671496
public function updateTranslation($locale, $domain, $key, $value)
    {
        $unit = $this->findByDomainAndKey($domain, $key);
        $unit->setTranslation($locale, $value);
        $this->persist($unit);
    }
940024
protected function getTranslation($key, $locale) {
        if( isset($this->translations[$locale][$key]) )
            return $this->translations[$locale][$key];

        return $key;
    }
448200
public function has($key, $locale = null) {
        $locale = $this->locale($locale);

        return Lang::has($key, $locale);
    }
757558
public function _($translateKey, $defaultTranslation = "", $placeholders = null)
	{
		$translation = $translateKey;
		
		if (is_array($defaultTranslation) && $placeholders === null) {
			$placeholders = $defaultTranslation;
		} else {
			if ($defaultTranslation!="") {
				$translation = $defaultTranslation;
			}
		}
		if ($this->exists($translateKey)) {
			$translation = $this->_translate[$translateKey];
		}
		return $this->replacePlaceholders($translation, $placeholders);
	}
1270595
protected function handlePlugins($locale, $translation, $params) {
		foreach ($this->plugins as $plugin) {
			$translation = $plugin->handle($locale, $translation, $params);
		}
		
		return $translation;
	}
157689
private function translateWithLang($key, $lang) {
        if (!isset($this->translations[$lang]) || !isset($this->translations[$lang][$key])) {
            return null;
        }

        return $this->translations[$lang][$key];
    }
729693
public function hasTranslation($locale = null)
    {
        $locale = $locale ?: \localizer\locale()->id();

        foreach ($this->cachedTranslations() as $translation) {
            if ((int) $translation->getAttribute($this->getLocaleKey()) === (int) $locale) {
                return true;
            }
        }

        return false;
    }