aboutsummaryrefslogtreecommitdiff
path: root/cli/i18n/I18nUsageValidator.php
diff options
context:
space:
mode:
authorGravatar Inverle <inverle@proton.me> 2025-07-16 16:11:51 +0200
committerGravatar GitHub <noreply@github.com> 2025-07-16 16:11:51 +0200
commitf9a42adadec9acd259c205727c95bd6f376dfbc5 (patch)
treeb576ba4ac948466389de30487c506ae04dd71d24 /cli/i18n/I18nUsageValidator.php
parent5f61e426dc90b7b697a46da009af2fc88eed3ad0 (diff)
Show translation status in README.md (#7715)
* Show translation status in README.md * Fix colon * markdownlint: Allow tag `<translations>` * Use mostly Unicode flags instead * Only `oc.svg` remains in an image format * `check.translation.php` still supports `.png` even though there aren't any PNGs as of right now * Fix CodeSniffer * Attempt approach with generating local SVGs * Fixes for local SVG approach * Cleanup old code * PHPStan fix * Remove decimal precision from percentages * Suggestions + better error messages * codesniffer fix v2 * Revert `ghSearchUrl` change * Generate readme * Fix syntax highlight, maybe * Regenerate * Update help message * Use existing translation files instead of .txt * Add test against wrong Unicode flag --------- Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
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;
}