Merge pull request #48858 from nextcloud/backport/48839/stable28

[stable28] build: Print RTL limited characters in translation-checker
This commit is contained in:
Joas Schilling 2024-10-24 21:26:16 +02:00 committed by GitHub
commit dffc1122dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -77,8 +77,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);