diff options
| author | 2022-01-08 08:00:26 -0500 | |
|---|---|---|
| committer | 2022-01-08 14:00:26 +0100 | |
| commit | 127b7f0a3aad7012055c058e8aba0d27192a8cbc (patch) | |
| tree | 8ec9a5948672e702c944c202f78294b81104582f /cli/i18n/I18nCompletionValidator.php | |
| parent | ed19445f74c30854c60873cd1df1c38e15fc316b (diff) | |
Change i18n process (#4131)
Before, the ignore info were stored in a different file which was a bit cumbersome
for new comers. Now, this info is stored directly in the translation file as a
comment.
Before, there was no way of telling translators that a previously translated string
was in need of a new translation. Now, the dirty information is there to convey that
info.
Diffstat (limited to 'cli/i18n/I18nCompletionValidator.php')
| -rw-r--r-- | cli/i18n/I18nCompletionValidator.php | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/cli/i18n/I18nCompletionValidator.php b/cli/i18n/I18nCompletionValidator.php index 3287a2500..ee4ab9f78 100644 --- a/cli/i18n/I18nCompletionValidator.php +++ b/cli/i18n/I18nCompletionValidator.php @@ -23,23 +23,22 @@ class I18nCompletionValidator implements I18nValidatorInterface { return $this->result; } - /** - * @param array<string>|null $ignore - */ - public function validate($ignore) { + public function validate() { foreach ($this->reference as $file => $data) { - foreach ($data as $key => $value) { + foreach ($data as $refKey => $refValue) { $this->totalEntries++; - if (is_array($ignore) && in_array($key, $ignore)) { - $this->passEntries++; + if (!array_key_exists($refKey, $this->language[$file])) { + $this->result .= "Missing key $refKey" . PHP_EOL; continue; } - if (!array_key_exists($key, $this->language[$file])) { - $this->result .= sprintf('Missing key %s', $key) . PHP_EOL; + + $value = $this->language[$file][$refKey]; + if ($value->isIgnore()) { + $this->passEntries++; continue; } - if ($value === $this->language[$file][$key]) { - $this->result .= sprintf('Untranslated key %s - %s', $key, $value) . PHP_EOL; + if ($refValue->equal($value)) { + $this->result .= "Untranslated key $refKey - $refValue" . PHP_EOL; continue; } $this->passEntries++; |
