function _potx_add_format_interval_strings in Translation template extractor 8
Same name and namespace in other branches
- 5.2 potx.inc \_potx_add_format_interval_strings()
- 5 potx.inc \_potx_add_format_interval_strings()
- 6.3 potx.inc \_potx_add_format_interval_strings()
- 6 potx.inc \_potx_add_format_interval_strings()
- 6.2 potx.inc \_potx_add_format_interval_strings()
- 7.3 potx.inc \_potx_add_format_interval_strings()
- 7 potx.inc \_potx_add_format_interval_strings()
- 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
string $file: Name of the file parsed.
string $save_callback: Callback function used to save strings.
int $api_version: Drupal API version to work with.
1 call to _potx_add_format_interval_strings()
- _potx_parse_php_file in ./
potx.inc - Parse a PHP file for translatables.
File
- ./
potx.inc, line 1750 - 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 = [
'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);
}
}