aboutsummaryrefslogtreecommitdiff
path: root/cli/i18n/I18nCompletionValidator.php
diff options
context:
space:
mode:
Diffstat (limited to 'cli/i18n/I18nCompletionValidator.php')
-rw-r--r--cli/i18n/I18nCompletionValidator.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/cli/i18n/I18nCompletionValidator.php b/cli/i18n/I18nCompletionValidator.php
index 28f8abed8..5cdd1ba80 100644
--- a/cli/i18n/I18nCompletionValidator.php
+++ b/cli/i18n/I18nCompletionValidator.php
@@ -20,14 +20,18 @@ class I18nCompletionValidator implements I18nValidatorInterface {
}
#[\Override]
- public function displayReport(): string {
+ public function displayReport(bool $percentage_only = false): string {
if ($this->passEntries > $this->totalEntries) {
throw new \RuntimeException('The number of translated strings cannot be higher than the number of strings');
}
if ($this->totalEntries === 0) {
return 'There is no data.' . PHP_EOL;
}
- return sprintf('Translation is %5.1f%% complete.', $this->passEntries / $this->totalEntries * 100) . PHP_EOL;
+ $percentage = sprintf('%5.1f%%', $this->passEntries / $this->totalEntries * 100);
+ if ($percentage_only) {
+ return trim($percentage);
+ }
+ return 'Translation is ' . $percentage . ' complete.' . PHP_EOL;
}
#[\Override]