Function Hook_translation_bing_translator->translate_text

Definitions

sources/hooks/systems/translation/bing_translator.php

  • Translate some text.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$text string No No required parameter N/A N/A The text to translate
$context integer No No required parameter N/A N/A A TRANS_TEXT_CONTEXT_* constant
$context_metadata mixed No No required parameter N/A N/A Context metadata for the particular translation effort
$from ?LANGUAGE_NAME No No required parameter N/A N/A Source language (null: autodetect from the text itself)
$to LANGUAGE_NAME No No required parameter N/A N/A Destination language
&$errormsg ?string Yes No required parameter N/A N/A Error message (returned by reference) (null: not set yet)

Returns

  • Translated text (null: some kind of error)
  • Type: ?string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Translate some text.
 *
 * @param  string $text The text to translate
 * @param  integer $context A TRANS_TEXT_CONTEXT_* constant
 * @param  mixed $context_metadata Context metadata for the particular translation effort
 * @param  ?LANGUAGE_NAME $from Source language (null: autodetect from the text itself)
 * @param  LANGUAGE_NAME $to Destination language
 * @param  ?string $errormsg Error message (returned by reference) (null: not set yet)
 * @return ?string Translated text (null: some kind of error)
 */

public function translate_text(string $text, int $context, $context_metadata, ?string $from, string $to, ?string &$errormsg) : ?string