Skip to content
Browse files

Fix single language generation

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@639 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
1 parent ab38ea5 commit bc984b99726acfe600978f72e7428dcff495e8b6 jakubvrana committed Jun 1, 2009
Showing with 10 additions and 4 deletions.
  1. +7 −3 _compile.php
  2. +1 −0 changes.txt
  3. +2 −1 include/lang.inc.php
View
10 _compile.php
@@ -52,8 +52,12 @@ function put_file($match) {
return "switch (\$LANG) {\n$return}\n";
}
$return = file_get_contents(dirname(__FILE__) . "/$match[3]");
- if ($match[3] == "./include/lang.inc.php" && $_COOKIE["lang"] && (preg_match("~case '$_COOKIE[lang]': (.*) break;~", $return, $match2) || preg_match("~default: (.*)~", $return, $match2))) {
- return "$match[1]\nfunction lang(\$ar, \$number) {\n\t$match2[1]\n\treturn sprintf(\$ar[\$pos], \$number);\n}\n$match[4]";
+ if ($match[3] == "./include/lang.inc.php" && $_COOKIE["lang"]) {
+ if (preg_match('~\\s*(\\$pos = .*)~', $return, $match2)) {
+ return "$match[1]\nfunction lang(\$translation, \$number) {\n\t" . str_replace('$LANG', "'$_COOKIE[lang]'", $match2[1]) . "\n\treturn sprintf(\$translation[\$pos], \$number);\n}\n$match[4]";
+ } else {
+ echo "lang() not found\n";
+ }
}
$return = preg_replace("~\\?>\n?\$~", '', $return);
if (substr_count($return, "<?php") <= substr_count($return, "?>") && !$match[4]) {
@@ -191,7 +195,7 @@ function php_shrink($input) {
case "arrow.gif": echo base64_decode("' . base64_encode(file_get_contents(dirname(__FILE__) . "/arrow.gif")) . '"); break;
case "up.gif": echo base64_decode("' . base64_encode(file_get_contents(dirname(__FILE__) . "/up.gif")) . '"); break;
case "down.gif": echo base64_decode("' . base64_encode(file_get_contents(dirname(__FILE__) . "/down.gif")) . '"); break;
- case "plus.gif": echo base64_decode("' . base64_encode(file_get_contents(dirname(__FILE__) . "/add.gif")) . '"); break;
+ case "plus.gif": echo base64_decode("' . base64_encode(file_get_contents(dirname(__FILE__) . "/plus.gif")) . '"); break;
case "cross.gif": echo base64_decode("' . base64_encode(file_get_contents(dirname(__FILE__) . "/cross.gif")) . '"); break;
}
}
View
1 changes.txt
@@ -6,6 +6,7 @@ Relative date and time functions
Version checker
Separate JavaScript functions
Always use the default style before the external one
+Always try to use the syntax highlighter
phpMinAdmin 1.10.1:
Highlight odd and hover rows
View
3 include/lang.inc.php
@@ -17,7 +17,8 @@ function lang($idf, $number = null) {
global $LANG, $translations;
$translation = $translations[$idf];
if (is_array($translation) && $translation) {
- $translation = $translation[($number == 1 ? 0 : ((!$number || $number >= 5) && ereg('cs|sk|ru', $LANG) ? 2 : 1))];
+ $pos = ($number == 1 ? 0 : ((!$number || $number >= 5) && ereg('cs|sk|ru', $LANG) ? 2 : 1));
+ $translation = $translation[$pos];
}
$args = func_get_args();
array_shift($args);

0 comments on commit bc984b9

Please sign in to comment.
Something went wrong with that request. Please try again.