diff --git a/adminer/include/lang.inc.php b/adminer/include/lang.inc.php index 8f047cd1..72a0c0f0 100644 --- a/adminer/include/lang.inc.php +++ b/adminer/include/lang.inc.php @@ -45,7 +45,7 @@ function get_lang() { */ function lang($idf, $number = null) { global $LANG, $translations; - $translation = $translations[$idf]; + $translation = (isset($translations[$idf]) ? $translations[$idf] : $idf); if (is_array($translation)) { $pos = ($number == 1 ? 0 : ($LANG == 'cs' || $LANG == 'sk' ? ($number && $number < 5 ? 1 : 2) // different forms for 1, 2-4, other @@ -60,7 +60,11 @@ function lang($idf, $number = null) { } $args = func_get_args(); array_shift($args); - return vsprintf(($translation !== null ? $translation : $idf), $args); + $format = str_replace("%d", "%s", $translation); + if ($format != $translation) { + $args[0] = number_format($number, 0, ".", lang(',')); + } + return vsprintf($format, $args); } function switch_lang() { diff --git a/changes.txt b/changes.txt index 9dd4d3c8..90b21d71 100644 --- a/changes.txt +++ b/changes.txt @@ -5,6 +5,7 @@ Link to descending order Warn about selecting data without index Allow specifying database in login form Link to original table in EXPLAIN of SELECT * FROM table t +Format numbers in translations MySQL: inform about disabled event_scheduler SQLite: support binary data PostgreSQL: approximate row count in table overview diff --git a/compile.php b/compile.php index 8c7e3643..3f736e0f 100755 --- a/compile.php +++ b/compile.php @@ -51,7 +51,9 @@ function put_file($match) { function lang(\$translation, \$number) { \$pos = $match2[2]\t\t: " . (preg_match("~\\\$LANG == '$_SESSION[lang]'.* \\? (.+)\n~U", $match2[1], $match3) ? $match3[1] : "1") . ' ); - return sprintf($translation[$pos], $number); + $translation = str_replace("%d", "%s", $translation[$pos]); + $number = number_format($number, 0, ".", lang(\',\')); + return sprintf($translation, $number); } '; } else {