diff --git a/changes.txt b/changes.txt index c24b7e58..2f3890b9 100644 --- a/changes.txt +++ b/changes.txt @@ -2,6 +2,7 @@ Adminer 3.7.0-dev: Allow more SQL files to be uploaded at the same time Print run time next to executed queries Disable SQL export when applying functions in select +Allow using lang() in plugins (customization) MySQL: Optimize create table page and Editor navigation MySQL: Display bit type as binary number MySQL: Improve export of binary data types diff --git a/compile.php b/compile.php index 39a2c59c..71d2792f 100755 --- a/compile.php +++ b/compile.php @@ -42,6 +42,19 @@ function put_file($match) { } $return = file_get_contents(dirname(__FILE__) . "/$project/$match[2]"); if (basename($match[2]) != "lang.inc.php" || !$_SESSION["lang"]) { + if (basename($match[2]) == "lang.inc.php") { + $return = str_replace('function lang($idf, $number = null) {', 'function lang($idf, $number = null) { + if (is_string($idf)) { // compiled version uses numbers, string comes from a plugin + // English translation is closest to the original identifiers //! pluralized translations are not found + $pos = array_search($idf, get_translations("en")); //! this should be cached + if ($pos !== false) { + $idf = $pos; + } + }', $return, $count); + if (!$count) { + echo "lang() not found\n"; + } + } $tokens = token_get_all($return); // to find out the last token return "?>\n$return" . (in_array($tokens[count($tokens) - 1][0], array(T_CLOSE_TAG, T_INLINE_HTML), true) ? "