From 127b7f0a3aad7012055c058e8aba0d27192a8cbc Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 8 Jan 2022 08:00:26 -0500 Subject: 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. --- cli/check.translation.php | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'cli/check.translation.php') 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 = <<