diff options
| author | 2022-01-08 08:00:26 -0500 | |
|---|---|---|
| committer | 2022-01-08 14:00:26 +0100 | |
| commit | 127b7f0a3aad7012055c058e8aba0d27192a8cbc (patch) | |
| tree | 8ec9a5948672e702c944c202f78294b81104582f /cli/check.translation.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/check.translation.php')
| -rw-r--r-- | cli/check.translation.php | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/cli/check.translation.php b/cli/check.translation.php index 12655fc8e..38bb83af5 100644 --- a/cli/check.translation.php +++ b/cli/check.translation.php @@ -3,12 +3,10 @@ require_once __DIR__ . '/i18n/I18nCompletionValidator.php'; require_once __DIR__ . '/i18n/I18nData.php'; require_once __DIR__ . '/i18n/I18nFile.php'; -require_once __DIR__ . '/i18n/I18nIgnoreFile.php'; require_once __DIR__ . '/i18n/I18nUsageValidator.php'; $i18nFile = new I18nFile(); -$i18nIgnoreFile = new I18nIgnoreFile(); -$i18nData = new I18nData($i18nFile->load(), $i18nIgnoreFile->load()); +$i18nData = new I18nData($i18nFile->load()); $options = getopt("dhl:r"); @@ -30,14 +28,10 @@ $report = array(); foreach ($languages as $language) { if ($language === $i18nData::REFERENCE_LANGUAGE) { $i18nValidator = new I18nUsageValidator($i18nData->getReferenceLanguage(), findUsedTranslations()); - $isValidated = $i18nValidator->validate(include __DIR__ . '/i18n/ignore/' . $language . '.php') && $isValidated; + $isValidated = $i18nValidator->validate() && $isValidated; } else { $i18nValidator = new I18nCompletionValidator($i18nData->getReferenceLanguage(), $i18nData->getLanguage($language)); - if (file_exists(__DIR__ . '/i18n/ignore/' . $language . '.php')) { - $isValidated = $i18nValidator->validate(include __DIR__ . '/i18n/ignore/' . $language . '.php') && $isValidated; - } else { - $isValidated = $i18nValidator->validate(null) && $isValidated; - } + $isValidated = $i18nValidator->validate() && $isValidated; } $report[$language] = sprintf('%-5s - %s', $language, $i18nValidator->displayReport()); @@ -87,12 +81,14 @@ function findUsedTranslations() { * Output help message. */ function help() { - $help = <<<HELP + $file = str_replace(__DIR__ . '/', '', __FILE__); + + echo <<<HELP NAME - %s + $file SYNOPSIS - php %s [OPTION]... + php $file [OPTION]... DESCRIPTION Check if translation files have missing keys or missing translations. @@ -103,7 +99,5 @@ DESCRIPTION -r display completion report. HELP; - $file = str_replace(__DIR__ . '/', '', __FILE__); - echo sprintf($help, $file, $file); exit; } |
