Skip to content

Commit

Permalink
ci: Restrict RTL characters to RTL languages
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>

[skip ci]
  • Loading branch information
nickvergessen authored and backportbot[bot] committed Sep 24, 2024
1 parent a84255e commit 726b170
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build/translation-checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
}

$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";
}

$json = json_decode($content, true);

$translations = json_encode($json['translations']);
Expand Down

0 comments on commit 726b170

Please sign in to comment.