1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-10 08:34:20 +02:00

Translations: Add missing placeholders

This commit is contained in:
Jakub Vrana
2025-03-08 10:03:06 +01:00
parent cfe39e48ca
commit 608eec89dd
9 changed files with 15 additions and 11 deletions

View File

@@ -32,12 +32,12 @@ foreach (glob(__DIR__ . "/adminer/lang/" . ($_SESSION["lang"] ?: "*") . ".inc.ph
$messages = $messages_all;
$file = file_get_contents($filename);
$file = str_replace("\r", "", $file);
preg_match_all("~^(\\s*(?:// [^'].*\\s+)?)(?:// )?(('(?:[^\\\\']+|\\\\.)*') => .*[^,\n]),?~m", $file, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
preg_match_all("~^(\\s*(?:// [^'].*\\s+)?)(?:// )?(('(?:[^\\\\']+|\\\\.)*') => (.*[^,\n])),?~m", $file, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
$s = "";
$lang = basename($filename, ".inc.php");
$fullstop = ($lang == "bn" ? '।' : (substr($lang, 0, 2) == 'zh' ? '。' : ($lang == 'he' || $lang == 'ja' ? '' : '\.')));
foreach ($matches as $match) {
list(, list($indent), list($line, $offset), list($en)) = $match;
list(, list($indent), list($line, $offset), list($en), list($translation)) = $match;
if (isset($messages[$en])) {
// keep current messages
$s .= "$indent$line,\n";
@@ -45,6 +45,9 @@ foreach (glob(__DIR__ . "/adminer/lang/" . ($_SESSION["lang"] ?: "*") . ".inc.ph
if ($en != "','" && $fullstop && (substr($en, -2, 1) == "." xor preg_match("~$fullstop'\)?\$~", $line))) {
echo "$filename:" . (substr_count($file, "\n", 0, $offset) + 1) . ":Not matching fullstop: $line\n";
}
if (preg_match('~%~', $en) xor preg_match('~%~', $translation)) {
echo "$filename:" . (substr_count($file, "\n", 0, $offset) + 1) . ":Not matching placeholder.\n";
}
} else {
// comment deprecated messages
$s .= "$indent// $line,\n";