Permalink
Browse files

Function get_lang useful for customization

  • Loading branch information...
1 parent fce2312 commit e37c427e87873c89e7ed6476df1483fac43253ba @vrana committed Dec 30, 2010
Showing with 22 additions and 1 deletion.
  1. +13 −0 adminer/include/lang.inc.php
  2. +9 −1 compile.php
@@ -22,6 +22,19 @@
'ar' => 'العربية', // Y.M Amine - Algeria - nbr7@live.fr
);
+/** Get current language
+* @return string
+*/
+function get_lang() {
+ global $LANG;
+ return $LANG;
+}
+
+/** Translate string
+* @param string
+* @param int
+* @return string
+*/
function lang($idf, $number = null) {
global $LANG, $translations;
$translation = $translations[$idf];
View
@@ -53,7 +53,15 @@ function put_file($match) {
return "?>\n$return" . (in_array($tokens[count($tokens) - 1][0], array(T_CLOSE_TAG, T_INLINE_HTML), true) ? "<?php" : "");
} elseif (preg_match('~\\s*(\\$pos = .*)~', $return, $match2)) {
// single language lang() is used for plural
- return "function lang(\$translation, \$number) {\n\t" . str_replace('$LANG', "'$_SESSION[lang]'", $match2[1]) . "\n\treturn sprintf(\$translation[\$pos], \$number);\n}\n";
+ return "function get_lang() {
+ return '$_SESSION[lang]';
+}
+
+function lang(\$translation, \$number) {
+ " . str_replace('$LANG', "'$_SESSION[lang]'", $match2[1]) . '
+ return sprintf($translation[$pos], $number);
+}
+';
} else {
echo "lang() not found\n";
}

0 comments on commit e37c427

Please sign in to comment.