diff options
author | Joas Schilling <coding@schilljs.com> | 2022-06-07 17:09:46 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-06-07 17:09:46 +0200 |
commit | a33310f1b13b64fa5c88b4d5f2ecbf3d9d3bb569 (patch) | |
tree | e8583d8054066e3b665c60e096d9fce87fc2d11f /build | |
parent | 21734fdda49e3f9d6a36b187efc5149643d80442 (diff) | |
download | nextcloud-server-a33310f1b13b64fa5c88b4d5f2ecbf3d9d3bb569.tar.gz nextcloud-server-a33310f1b13b64fa5c88b4d5f2ecbf3d9d3bb569.zip |
Add debug flag to the translation checker
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'build')
-rw-r--r-- | build/translation-checker.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/build/translation-checker.php b/build/translation-checker.php index 53c139a1d63..7bc80d53cdb 100644 --- a/build/translation-checker.php +++ b/build/translation-checker.php @@ -23,6 +23,8 @@ $directories = [ __DIR__ . '/../core/l10n', ]; +$isDebug = in_array('--debug', $argv, true) || in_array('-d', $argv, true); + $apps = new \DirectoryIterator(__DIR__ . '/../apps'); foreach ($apps as $app) { if (!file_exists($app->getPathname() . '/l10n')) { @@ -50,7 +52,7 @@ foreach ($directories as $dir) { $translations = json_encode($json['translations']); if (strpos($translations, '|') !== false) { - $errors[] = $file->getPathname() . "\n" . ' ' . 'Contains a | in the translations' . "\n"; + $errors[] = $file->getPathname() . "\n" . ' ' . 'Contains a | in the translations.' . "\n"; } if (json_last_error() !== JSON_ERROR_NONE) { @@ -58,6 +60,16 @@ foreach ($directories as $dir) { } else { $valid++; } + + if ($isDebug && $file->getFilename() === 'en_GB.json') { + $sourceStrings = json_encode(array_keys($json['translations'])); + + if (strpos($sourceStrings, '\u2019') !== false) { + $errors[] = $file->getPathname() . "\n" + . ' ' . 'Contains a unicode single quote "’" in the english source string, please replace with normal single quotes.' . "\n" + . ' ' . 'Please note that this only updates after a sync to transifex.' . "\n"; + } + } } } |