function _potx_add_date_strings in Translation template extractor 7
Same name and namespace in other branches
- 8 potx.inc \_potx_add_date_strings()
- 5.2 potx.inc \_potx_add_date_strings()
- 5 potx.inc \_potx_add_date_strings()
- 6.3 potx.inc \_potx_add_date_strings()
- 6 potx.inc \_potx_add_date_strings()
- 6.2 potx.inc \_potx_add_date_strings()
- 7.3 potx.inc \_potx_add_date_strings()
- 7.2 potx.inc \_potx_add_date_strings()
Add date strings, which cannot be extracted otherwise. This is called for locale.module.
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_date_strings()
- _potx_process_file in ./
potx.inc - Process a file and put extracted information to the given parameters.
File
- ./
potx.inc, line 1215 - Extraction API used by the web and command line interface.
Code
function _potx_add_date_strings($file, $save_callback, $api_version = POTX_API_CURRENT) {
for ($i = 1; $i <= 12; $i++) {
$stamp = mktime(0, 0, 0, $i, 1, 1971);
if ($api_version > POTX_API_6) {
// From Drupal 7, long month names are saved with this context.
$save_callback(date("F", $stamp), 'Long month name', $file);
}
elseif ($api_version > POTX_API_5) {
// Drupal 6 uses a little hack. No context.
$save_callback('!long-month-name ' . date("F", $stamp), POTX_CONTEXT_NONE, $file);
}
else {
// Older versions just accept the confusion, no context.
$save_callback(date("F", $stamp), POTX_CONTEXT_NONE, $file);
}
// Short month names lack a context anyway.
$save_callback(date("M", $stamp), POTX_CONTEXT_NONE, $file);
}
for ($i = 0; $i <= 7; $i++) {
$stamp = $i * 86400;
$save_callback(date("D", $stamp), POTX_CONTEXT_NONE, $file);
$save_callback(date("l", $stamp), POTX_CONTEXT_NONE, $file);
}
$save_callback('am', POTX_CONTEXT_NONE, $file);
$save_callback('pm', POTX_CONTEXT_NONE, $file);
$save_callback('AM', POTX_CONTEXT_NONE, $file);
$save_callback('PM', POTX_CONTEXT_NONE, $file);
}