You are here

function _potx_save_string in Translation template extractor 6.2

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

Default $save_callback used by the potx system. Saves values to global arrays to reduce memory consumption problems when passing around big chunks of values.

Parameters

$value: The string value. If NULL, the array of collected values are returned for the given $string_mode.

$file: Name of file where the string was found.

$line: Line number where the string was found.

$string_mode: String mode: POTX_STRING_INSTALLER, POTX_STRING_RUNTIME or POTX_STRING_BOTH.

1 string reference to '_potx_save_string'
potx_select_form_submit in ./potx.module
Generate translation template or translation file for the requested component.

File

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

Code

function _potx_save_string($value = NULL, $file = NULL, $line = 0, $string_mode = POTX_STRING_RUNTIME) {
  global $_potx_strings, $_potx_install;
  if (isset($value)) {
    switch ($string_mode) {
      case POTX_STRING_BOTH:

        // Mark installer strings as duplicates of runtime strings if
        // the string was both recorded in the runtime and in the installer.
        $_potx_install[$value][$file][] = $line . ' (dup)';

      // Break intentionally missing.
      case POTX_STRING_RUNTIME:

        // Mark runtime strings as duplicates of installer strings if
        // the string was both recorded in the runtime and in the installer.
        $_potx_strings[$value][$file][] = $line . ($string_mode == POTX_STRING_BOTH ? ' (dup)' : '');
        break;
      case POTX_STRING_INSTALLER:
        $_potx_install[$value][$file][] = $line;
        break;
    }
  }
  else {
    return $string_mode == POTX_STRING_RUNTIME ? $_potx_strings : $_potx_install;
  }
}