Function __global->translate_text

Definitions

sources/translation.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 0 N/A N/A A TRANS_TEXT_CONTEXT_* constant
$from ?LANGUAGE_NAME No No Null N/A N/A Source language (null: autodetect from the text itself)
$to ?LANGUAGE_NAME No No Null N/A N/A Destination language (null: current user's language)
$hook ?string No No Null N/A N/A Specific hook to use (null: first that'll do it)
&$errormsg ?string Yes No Null 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  ?LANGUAGE_NAME $from Source language (null: autodetect from the text itself)
 * @param  ?LANGUAGE_NAME $to Destination language (null: current user's language)
 * @param  ?string $hook Specific hook to use (null: first that'll do it)
 * @param  ?string $errormsg Error message (returned by reference) (null: not set yet)
 * @return ?string Translated text (null: some kind of error)
 */

function translate_text(string $text, int $context = 0, ?string $from = null, ?string $to = null, ?string $hook = null, ?string &$errormsg = null) : ?string