Skip to content

Commit

Permalink
Fail the translation test when there are multiple single placeholders
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Jul 12, 2018
1 parent e3126fa commit a6f932b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion build/translation-checker.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,16 @@
echo ' ' . json_last_error_msg() . "\n";
$errors[] = $file->getPathname() . "\n" . ' ' . json_last_error_msg() . "\n";
} else {
echo '[OK] ' . $file->getPathname() . "\n";

$matches = [];
if (preg_match('/(?:^ )(\"[^\"]*%s[^\"]*%s[^\"]*\")(?: :)/m', $content, $matches)) {
echo '[Error] ' . $file->getPathname() . " contains untranslatable string:\n";
echo ' ' . $matches[1] . "\n";
$errors[] = $file->getPathname() . ' contains untranslatable string:' . "\n " . $matches[1] . "\n";
} else {
echo '[OK] ' . $file->getPathname() . "\n";
}

}
}
}
Expand Down

0 comments on commit a6f932b

Please sign in to comment.