Function __global->get_translated_text

Definitions

sources/lang.php

  • Try to return the human-readable version of the content language string ID, passed in as $entry.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$entry mixed No No required parameter N/A N/A The ID (if multi-lang-content on), or the string itself (if multi-lang-content is off)
$db ?object No No Null N/A N/A The database connector to use (null: standard site connector)
$lang ?LANGUAGE_NAME No No Null N/A N/A The language (null: uses the current language)
$force boolean No No False N/A N/A Whether to force it to the specified language

Returns

  • The human-readable version (null: could not look up when $force was on)
  • Type: ?string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Try to return the human-readable version of the content language string ID, passed in as $entry.
 *
 * @param  mixed $entry The ID (if multi-lang-content on), or the string itself (if multi-lang-content is off)
 * @param  ?object $db The database connector to use (null: standard site connector)
 * @param  ?LANGUAGE_NAME $lang The language (null: uses the current language)
 * @param  boolean $force Whether to force it to the specified language
 * @return ?string The human-readable version (null: could not look up when $force was on)
 */

function get_translated_text($entry, ?object $db = null, ?string $lang = null, bool $force = false) : ?string