aboutsummaryrefslogtreecommitdiff
path: root/cli/i18n/I18nUsageValidator.php
diff options
context:
space:
mode:
Diffstat (limited to 'cli/i18n/I18nUsageValidator.php')
-rw-r--r--cli/i18n/I18nUsageValidator.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/cli/i18n/I18nUsageValidator.php b/cli/i18n/I18nUsageValidator.php
index 89c88d222..5551d2df7 100644
--- a/cli/i18n/I18nUsageValidator.php
+++ b/cli/i18n/I18nUsageValidator.php
@@ -20,13 +20,16 @@ class I18nUsageValidator implements I18nValidatorInterface {
}
#[\Override]
- public function displayReport(): string {
+ public function displayReport(bool $percentage_only = false): string {
if ($this->failedEntries > $this->totalEntries) {
throw new \RuntimeException('The number of unused strings cannot be higher than the number of strings');
}
if ($this->totalEntries === 0) {
return 'There is no data.' . PHP_EOL;
}
+ if ($percentage_only) {
+ return '100%';
+ }
return sprintf('%5.1f%% of translation keys are unused.', $this->failedEntries / $this->totalEntries * 100) . PHP_EOL;
}