You are here

function _potx_status in Translation template extractor 6

Same name and namespace in other branches
  1. 5.2 potx.inc \_potx_status()
  2. 5 potx.inc \_potx_status()

Status notification function.

Parameters

$text: Text of status message, or POTX_STATUS_* constant to set status reporting mode.

$type: Type of message: 'status' or 'error'.

6 calls to _potx_status()
potx-cli.php in ./potx-cli.php
potx_select_form_submit in ./potx.module
Generate translation template or translation file for the requested module.
_potx_find_menu_hook in ./potx.inc
List of menu item titles. Only for Drupal 6.
_potx_find_perm_hook in ./potx.inc
Detect permission names from the hook_perm() implementations. Note that this will get confused with a similar pattern in a comment, and with dynamic permissions, which need to be accounted for.
_potx_marker_error in ./potx.inc
Output a marker error with an extract of where the error was found.

... See full list

File

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

Code

function _potx_status($text, $type = 'status') {
  static $reporting = POTX_STATUS_CLI;

  // Modify reporting type, if given.
  if (!is_string($text)) {
    $reporting = $text;
    return;
  }
  else {
    switch ($reporting) {
      case POTX_STATUS_MESSAGE:
        drupal_set_message($text, $type);
        break;
      case POTX_STATUS_CLI:
        fwrite($type == 'error' ? STDERR : STDOUT, $text);
        break;
      case POTX_STATUS_SILENT:

        // Do nothing.
        break;
    }
  }
}