Entre las funciones Drush que procesan texto , no existe tal función, pero puede implementar una usando el código de format_plural () , reemplazando cualquier llamada a t()
por llamadas a dt()
.
function drush_plural($count, $singular, $plural, array $args = array(), array $options = array()) {
$args['@count'] = $count;
if ($count == 1) {
return dt($singular, $args, $options);
}
// Get the plural index through the gettext formula.
$index = (function_exists('locale_get_plural')) ? locale_get_plural($count, isset($options['langcode']) ? $options['langcode'] : NULL) : -1;
// If the index cannot be computed, use the plural as a fallback (which
// allows for most flexiblity with the replaceable @count value).
if ($index < 0) {
return dt($plural, $args, $options);
}
else {
switch ($index) {
case "0":
return dt($singular, $args, $options);
case "1":
return dt($plural, $args, $options);
default:
unset($args['@count']);
$args['@count[' . $index . ']'] = $count;
return dt(strtr($plural, array('@count' => '@count[' . $index . ']')), $args, $options);
}
}
}