You are here

function _potx_add_format_interval_strings in Translation template extractor 6.3

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

Add format_interval special strings, which cannot be extracted otherwise. This is called for common.inc

Parameters

$file: Name of the file parsed.

$save_callback: Callback function used to save strings.

$api_version: Drupal API version to work with.

1 call to _potx_add_format_interval_strings()
_potx_process_file in ./potx.inc
Process a file and put extracted information to the given parameters.

File

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

Code

function _potx_add_format_interval_strings($file, $save_callback, $api_version = POTX_API_CURRENT) {
  $components = array(
    '1 year' => '@count years',
    '1 week' => '@count weeks',
    '1 day' => '@count days',
    '1 hour' => '@count hours',
    '1 min' => '@count min',
    '1 sec' => '@count sec',
  );
  if ($api_version > POTX_API_6) {

    // Month support added in Drupal 7.
    $components['1 month'] = '@count months';
  }
  foreach ($components as $singular => $plural) {

    // Intervals support no context.
    $save_callback($singular . "\0" . $plural, POTX_CONTEXT_NONE, $file);
  }
}