Get a translated message without context.

@param string $message
@param array  $params
@param string $language
@return string
16157
public static function __($message, $params = [], $language = null)
    {
        return Yii::t(static::$defaultContext, $message, $params, $language);
    }
741149
private function loadTranslation($language)
    {
        $class = $this->translationClass;
        if (!$class) {
            throw new InvalidParamException('Translation class not set.');
        }
        $translation = new $class;
        $translation->{$this->languageAttribute} = $language;

        return $translation;
    }
1142194
public function setMessage($message, $param=null)
    {
        if ($param) {
            $message = sprintf($message, $param);
        }
        $this->message = $message;
        
        return $this;
    }
1151584
public function translate($text, array $params = [], $source = 'app')
    {
        $messages = $this->load($source);
        $message = vsprintf(isset($messages[$text]) ? $messages[$text] : $text, $params);

        return $message ? $message : $text;
    }
1333171
public static function translate(string $message, ...$args): string
    {
        $message = self::$translator->translate($message);

        return sprintf($message, ...$args);
    }
267169
private function getLanguage(string $language): string
    {
        $language = trim($language);

        if (strlen($language) !== 2) {
            throw new InvalidArgumentException("Unexpected language code ({$language}), codes should be 2 characters");
        }

        return $language;
    }
939652
public function get($message)
    {
        if (isset($this->messages[$message])) {
            $message = $this->messages[$message][0];
        }
        return $this->replacePlaceholders($message, array_slice(func_get_args(), 1));
    }
729299
public function translate($message, $textDomain = 'default', $locale = null)
    {
        $textDomain = $textDomain !== 'default' ? $textDomain : $this->domain();
        $locale = $locale ?: (string) $this->currentLanguage();

        return $this->translationService()->translate($message, $textDomain, $locale);
    }
275871
protected static function formatMessage(string $locale, string $message, array $args): string
    {
        // underlying `format` method cannot work with arguments that are not convertible to string
        // therefore we have to check that only those that actually can be used
        assert(call_user_func(function () use ($args) : bool {
            $result = true;
            foreach ($args as $arg) {
                $result = $result &&
                    is_scalar($arg) === true ||
                    $arg === null ||
                    (is_object($arg) === true && method_exists($arg, '__toString') === true);
            }

            return $result;
        }));

        $formatter = MessageFormatter::create($locale, $message);
        $message   = $formatter->format($args);
        assert($message !== false, $formatter->getErrorMessage());

        return $message;
    }
86596
public function translate($category, $message, $language, $basePath)
    {
        $messages = $this->loadMessages($category, $language, $basePath);

       // Core::p($category);

        if ($language == Config::i()->getDefaultLang() && empty($messages[$message])) {
            return $message;
        } elseif (!empty($messages[$message])) {
            return $messages[$message];
        } else {
            return $message;
        }

        return false;
    }
1074239
public function lang_get($params) {
        if (isset($params['line'])) {
            $parameters = isset($params['params']) ? $params['params'] : array();
            $default = isset($params['default']) ? $params['default'] : null;
            $language = isset($params['lang']) ? $params['lang'] : null;
            return Lang::get($params['line'], $parameters, $default, $language);
        }
        return false;
    }
507485
public function getMessageText(Message $message, $langcode = '') {
    /** @var \Drupal\message\Entity\MessageTemplate $message_template */
    $message_template = $message->getTemplate();

    $message_arguments = $message->getArguments();
    $message_template_text = $message_template->get('text');

    // If we have a language code here we can try to get a translated text.
    if (!empty($langcode)) {
      $language_manager = \Drupal::languageManager();
      if ($language_manager instanceof ConfigurableLanguageManagerInterface) {
        // Load the language override for the message template.
        $config_translation = $language_manager->getLanguageConfigOverride($langcode, 'message.template.' . $message_template->id());
        $translated_text = $config_translation->get('text');

        // Replace the text *only* if we have an translation available.
        if ($translated_text) {
          $message_template_text = $translated_text;
        }
      }
    }

    $output = $this->processArguments($message_arguments, $message_template_text, $message);

    $token_options = $message_template->getSetting('token options', []);
    if (!empty($token_options['token replace'])) {
      // Token should be processed.
      $output = $this->processTokens($output, !empty($token_options['clear']), $message);
    }

    return $output;
  }
178572
public static function c($message, $number, $args = [], $domain = 'core', $locale = 'en_EN')
    {
        return self::getInstance()->translator->transChoice($message, $number, $args, $domain, $locale);
    }
645527
public String getMessage(String key, Locale locale, Object[] parameters)
	{
		if (null == locale)
		{
			return getMessage(key, parameters);
		}
		if (null == parameters)
		{
			return getMessage(key, locale);
		}
		if (null != key)
		{
			MessageFormat _messageFormat = new MessageFormat(getMessage(key, locale));
			return _messageFormat.format(parameters);
		}

		return null;
	}
864260
protected function format($message, array $params) {
		if($fm = $this->formatParameters)
			$fm($params);

		foreach($params as $k=>$v) {
			if(is_string($v) || is_numeric($v))
				$message = str_replace(':'.$k, $v, $message);
		}
		return ucfirst($message);
	}
703183
private function _prepareMessage($message)
    {
        if (is_string($message) || is_numeric($message)) {
            return $message;
        }
        
        if (is_array($message)) {
            return json_encode($message, JSON_UNESCAPED_UNICODE);
        }
        
        return null;
    }
851131
public function translate($message, ... $parameters): string {
    $count = $parameters[0] ?? 0;
    $params = $parameters[1] ?? [];
    list($domain, $m) = $this->extractDomainAndMessage($message);
    $texts = Arrays::get($this->loader->getTexts(), $domain, []);
    $parts = explode(".", $m);
    if(count($parts) === 1) {
      $parts = [$m];
    }
    $text = $this->multiLevelTrans($parts, $texts);
    if($text === "") {
      $this->onUntranslated($message);
      return $message;
    }
    if($this->messageSelector->isMultiChoice($text)) {
      $text = $this->messageSelector->choose($text, $count);
    }
    $params["count"] = $count;
    foreach($params as $key => $value) {
      $text = str_replace("%$key%", $value, $text);
    }
    return $text;
  }