Signed-off-by: Christian Wolf <github@christianwolf.email>
This commit is contained in:
Christian Wolf 2022-07-25 16:47:45 +02:00
Родитель d933ff1100
Коммит 6f1eafa2ce
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9FC3120E932F73F1
2 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -65,7 +65,7 @@ class FixRecipeYieldFilter extends AbstractJSONFilter {
// Heuristics: Array with multiple entries.
// XXX How to parse an array correctly?
$this->logger->debug($this->l->t('Using heuristics to parse the recipeYield field of recipe {name}.', ['name' => $json['name']]));
$this->logger->debug($this->l->t('Using heuristics to parse the `recipeYield` field representing the number of servings of recipe {name}.', ['name' => $json['name']]));
$json[self::YIELD] = join(' ', $json[self::YIELD]);
}
@ -77,14 +77,18 @@ class FixRecipeYieldFilter extends AbstractJSONFilter {
sort($matches);
$last = end($matches);
$this->logger->debug($this->l->t('Using the highest number found in recipeYield string. Totally found: {num}', ['num' => $count]));
$this->logger->debug($this->l->n(
'Only a single number was found in the `recipeYield` field. Using it as number of servings.',
'There are %n numbers found in the `recipeYield` field. Using the highest number found as number of servings.',
$count
));
$json[self::YIELD] = (int) $last;
return true;
}
// We did not find anything useful.
$this->logger->info($this->l->t('Could not parse recipeYield field. Falling back to 1.'));
$this->logger->info($this->l->t('Could not parse `recipeYield` field. Falling back to 1 serving.'));
$json[self::YIELD] = 1;
return true;
}

Просмотреть файл

@ -64,7 +64,8 @@
<action-button
class="btn-enable-recipe-yield"
:aria-label="
t('cookbook', 'Toggle if recipe yield field is present')
// prettier-ignore
t('cookbook', 'Toggle if the number of servings are present')
"
@click="toggleShowRecipeYield"
>