Returns the translation of a message.

@var string $message  The string to translate.

@return string  The string translation, or the original string if no
translation exists.
554929
public static function t($message)
    {
        if (!isset(static::$_handlers[static::$_domain])) {
            static::loadHandler('Horde_Translation_Handler_Gettext');
        }
        return static::$_handlers[static::$_domain]->t($message);
    }
858304
public function t($message, $param = [], $name = 'app') {
        return Factory::i18n()->translate($message, $param, $name);
    }
1346500
public function transformVariables($message)
    {
        $patterns = [];
        $replacements = [];

        preg_match_all(static::VARIABLE_REGEX, $message, $matches);
        foreach ($matches[0] as $variable) {
            $replacements[] = $this->values[$variable];
            $patterns[] = '#' . preg_quote($variable) . '#';
        }
        $message = preg_replace($patterns, $replacements, $message);

        return $message;
    }
858498
protected function translateMessages(array $messages)
    {
        $results = array();
        foreach( $messages as $message ) {
            $results[] = Translate::message($message);
        }

        return $results;
    }
368633
private function getMessage(string $message): string
    {
        $hasTranslation = $this->messages !== null && array_key_exists($message, $this->messages) === false;

        return $hasTranslation === true ? $this->messages[$message] : $message;
    }
808743
private function prepareMessage($message) {
    return is_string($message) ? $message :
      (is_object($message) && method_exists($message, '__toString') ? $message->__toString() :
            StringUtil::getDump($message));
  }
859722
public function translate($message, $parameters = array())
    {
        if (count($parameters) === 0) {
            return $this->translations[$message];
        } else {
            return vsprintf($this->translations[$message], $parameters);
        }
    }
241663
protected function isValidMessage($message): Message
    {
        if ($message instanceof Message) {
            return $message;
        }

        if (\is_string($message) || $message instanceof Attachment) {
            return Message::create($message);
        }

        throw new MessengerException(sprintf(
            'message must be a string or an instance of %s or %s.',
            Message::class,
            Attachment::class
        ));
    }
511144
public static function normalizeMessage($message)
    {
        if (Mbstring::isUtf8($message)) {
            $message = str_replace('%20', ' ', rawurlencode($message));
        }

        return trim(explode("\n", $message)[0]);
    }
1315814
public static function createMessage(string $message): string
    {
        $lastErrorMessage = error_get_last();
        if ($lastErrorMessage !== null) {
            $message .= "; ".$lastErrorMessage["message"];
        }
        return $message;
    }
129262
public function getChannel($message)
    {
        if (is_int($message)) {
            return $this->channels[$message];
        }
        return $this->channels[$message->getChannel()];
    }
315740
def gettext(message):
    
    global _default
    _default = _default or translation(DEFAULT_LANGUAGE)
    translation_object = getattr(_active, 'value', _default)
    result = translation_object.gettext(message)
    return result
217212
private function translateMessage(string $message, string $adminName, AdminConfiguration $configuration): string
    {
        $pattern = $configuration->getParameter('translation_pattern');
        $message = StringUtils::getTranslationKey($pattern, $adminName, $message);

        return $this->translator->trans($message);
    }
840773
public static function translate($text)
    {
        $args = func_get_args();
        unset($args[0]);
        
        if (isset(self::$messages[$text])) {
            $text = self::$messages[$text];
        }
        
        return vsprintf($text, $args);
    }
1232812
private function formatMessage($message)
    {
        $formattedMessage = implode('', (array)$message);
        $formattedMessage = str_replace(PHP_EOL, '', $formattedMessage);
        $formattedMessage = strip_tags($formattedMessage);
        $formattedMessage = preg_replace([
            '/\\x1b[[][^A-Za-z]*[A-Za-z]/',
            '/[-=]{2,}/',
        ], '', $formattedMessage);

        return $formattedMessage !== null
            ? trim($formattedMessage, " \t\n\r\0\x0B-=")
            : (string)$formattedMessage;
    }
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);
    }
462731
public function translate($message, array $params = array())
    {
        // Update the current message with the domain translation, if we have one.
        if (isset($this->messages[$message]) && ! empty($this->messages[$message])) {
            $message = $this->messages[$message];
        }

        if (empty($params)) {
            return $message;
        }

        $formatter = new MessageFormatter();

        return $formatter->format($message, $params, $this->locale);
    }