src/Translator.php
public function __($key, array $parameters = [], $locale = null, $default = null, $parseBBCode = true)
	{
		$parametersToUse = $parameters;

		if ($locale === null)
		{
			$locale = $this->getLocaleCurrent();
		}

		$translationFile = null;
		$translationKey = $key;

		// get
		try
		{
			list ($translationFile, $translationKey) = $this->parseKey($key, $locale);
			$translation = $this->get($locale, $translationFile, $translationKey);
		}
		// fallback
		catch (Exception $exception)
		{
			if ($exception instanceof InvalidTranslationKey)
			{
				$translationFile = $exception->getTranslationFile();
				$translationKey = $exception->getTranslationKey();
			}

			$translation = $default;
			if ($default === null)
			{
				// go fallback
				if ($locale !== $this->getLocaleDefault())
				{
					return $this->__($key, $parametersToUse, $this->getLocaleDefault(), $default, $parseBBCode);
				}

				// show error text
				$translation = $this->getTemplateMissingKey();
				$parametersToUse['locale'] = $locale;
				$parametersToUse['key'] = $key;
				$parametersToUse['file'] = $translationFile;
				$parametersToUse['translationKey'] = $translationKey;
			}

			$this->log($exception->getMessage(), Logger::ERR, [
				'trace' => $exception->getTrace(),
				'locale' => $locale,
				'key' => $key,
				'parameters' => $parameters
			]);
		}

		// parse parameters
		$translation = $this->parseParameters($translation, $parametersToUse);

		// parse BB Code
		if ($parseBBCode === true && empty($translation) === false && $this->getMarkupRenderer() !== null)
		{
			$translation = $this->getMarkupRenderer()->parse($translation);
		}

		return $translation;
	}
public function __($key, array $parameters = [], $locale = null, $default = null, $parseBBCode = true)
	{
		$parametersToUse = $parameters;

		if ($locale === null)
		{
			$locale = $this->getLocaleCurrent();
		}

		$translationFile = null;
		$translationKey = $key;

		// get
		try
		{
			list ($translationFile, $translationKey) = $this->parseKey($key, $locale);
			$translation = $this->get($locale, $translationFile, $translationKey);
		}
		// fallback
		catch (Exception $exception)
		{
			if ($exception instanceof InvalidTranslationKey)
			{
				$translationFile = $exception->getTranslationFile();
				$translationKey = $exception->getTranslationKey();
			}

			$translation = $default;
			if ($default === null)
			{
				// go fallback
				if ($locale !== $this->getLocaleDefault())
				{
					return $this->__($key, $parametersToUse, $this->getLocaleDefault(), $default, $parseBBCode);
				}

				// show error text
				$translation = $this->getTemplateMissingKey();
				$parametersToUse['locale'] = $locale;
				$parametersToUse['key'] = $key;
				$parametersToUse['file'] = $translationFile;
				$parametersToUse['translationKey'] = $translationKey;
			}

			$this->log($exception->getMessage(), Logger::ERR, [
				'trace' => $exception->getTrace(),
				'locale' => $locale,
				'key' => $key,
				'parameters' => $parameters
			]);
		}

		// parse parameters
		$translation = $this->parseParameters($translation, $parametersToUse);

		// parse BB Code
		if ($parseBBCode === true && empty($translation) === false && $this->getMarkupRenderer() !== null)
		{
			$translation = $this->getMarkupRenderer()->parse($translation);
		}

		return $translation;
	}
translation function

@param string $key this is the translation key WITH the translation file. Syntax "FILE.KEY". e.g.: header.pageTitle
@param string[] $parameters list of key value list to replace in the content of translated string. in Translation is the syntax
"[KEY]". key is case insensitive
@param string $locale if not defined, then $this->getUserLocale())
@param string $default
@param bool $parseBBCode
@return string