Skip to content

Commit 47d017e

Browse files
nickvergessenbackportbot[bot]
authored andcommitted
ci: Restrict RTL characters to RTL languages
Signed-off-by: Joas Schilling <coding@schilljs.com> [skip ci]
1 parent 44b5480 commit 47d017e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

build/translation-checker.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
}
4949

5050
$content = file_get_contents($file->getPathname());
51+
52+
$language = pathinfo($file->getFilename(), PATHINFO_FILENAME);
53+
if (!in_array($language, $rtlLanguages, true) && preg_match('/[' . implode('', $rtlCharacters) . ']/u', $content)) {
54+
$errors[] = $file->getPathname() . "\n" . ' ' . 'Contains a RTL limited character in the translations.' . "\n";
55+
}
56+
5157
$json = json_decode($content, true);
5258

5359
$translations = json_encode($json['translations']);

0 commit comments

Comments
 (0)