You are here

function _potx_marker_error in Translation template extractor 7.2

Same name and namespace in other branches
  1. 8 potx.inc \_potx_marker_error()
  2. 5.2 potx.inc \_potx_marker_error()
  3. 5 potx.inc \_potx_marker_error()
  4. 6.3 potx.inc \_potx_marker_error()
  5. 6 potx.inc \_potx_marker_error()
  6. 6.2 potx.inc \_potx_marker_error()
  7. 7.3 potx.inc \_potx_marker_error()
  8. 7 potx.inc \_potx_marker_error()

Output a marker error with an extract of where the error was found.

Parameters

$file: Name of file

$line: Line number of error

$marker: Function name with which the error was identified

$ti: Index on the token array

$error: Helpful error message for users.

$docs_url: Documentation reference.

7 calls to _potx_marker_error()
_potx_find_context in ./potx.inc
Helper to find the value for 'context' on t() and format_plural().
_potx_find_format_plural_calls in ./potx.inc
Detect all occurances of format_plural calls.
_potx_find_log_calls in ./potx.inc
Detect all occurances of log() calls.
_potx_find_translation_annotations in ./potx.inc
Detect all occurances of @Translation annotations in doc comments.
_potx_find_t_calls in ./potx.inc
Detect all occurances of t()-like calls.

... See full list

File

./potx.inc, line 704
Extraction API used by the web and command line interface.

Code

function _potx_marker_error($file, $line, $marker, $ti, $error, $docs_url = NULL) {
  global $_potx_tokens;
  $tokens = '';
  $ti += 2;
  $tc = count($_potx_tokens);
  $par = 1;
  while ($tc - $ti > 0 && $par) {
    if (is_array($_potx_tokens[$ti])) {
      $tokens .= $_potx_tokens[$ti][1];
    }
    else {
      $tokens .= $_potx_tokens[$ti];
      if ($_potx_tokens[$ti] == "(") {
        $par++;
      }
      else {
        if ($_potx_tokens[$ti] == ")") {
          $par--;
        }
      }
    }
    $ti++;
  }
  potx_status('error', $error, $file, $line, $marker . '(' . $tokens, $docs_url);
}