Browse Source

Merge pull request #48839 from nextcloud/build/translation-checker-print-rtl-limited-characters

build: Print RTL limited characters in translation-checker
refactor/apps/declare-strict-types
Ferdinand Thiessen 12 months ago
committed by GitHub
parent
commit
2055516cd8
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      build/translation-checker.php

4
build/translation-checker.php

@ -76,8 +76,8 @@ foreach ($directories as $dir) {
$content = file_get_contents($file->getPathname());
$language = pathinfo($file->getFilename(), PATHINFO_FILENAME);
if (!in_array($language, $rtlLanguages, true) && preg_match('/[' . implode('', $rtlCharacters) . ']/u', $content)) {
$errors[] = $file->getPathname() . "\n" . ' ' . 'Contains a RTL limited character in the translations.' . "\n";
if (!in_array($language, $rtlLanguages, true) && preg_match_all('/^(.+[' . implode('', $rtlCharacters) . '].+)$/mu', $content, $matches)) {
$errors[] = $file->getPathname() . "\n" . ' ' . 'Contains a RTL limited characters in the translations. Offending strings:' . "\n" . implode("\n", $matches[0]) . "\n";
}
$json = json_decode($content, true);

Loading…
Cancel
Save