mirror of
https://github.com/vrana/adminer.git
synced 2025-08-07 23:27:17 +02:00
Join translations
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@875 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
31
lang.php
31
lang.php
@@ -1,37 +1,28 @@
|
||||
<?php
|
||||
error_reporting(4343); // errors and warnings
|
||||
$project = "adminer";
|
||||
if (file_exists($_SERVER["argv"][1] . "/index.php")) {
|
||||
$project = $_SERVER["argv"][1];
|
||||
array_shift($_SERVER["argv"]);
|
||||
}
|
||||
if (isset($_SERVER["argv"][1])) {
|
||||
$_COOKIE["adminer_lang"] = $_SERVER["argv"][1]; // Adminer functions read language from cookie
|
||||
include dirname(__FILE__) . "/adminer/include/lang.inc.php";
|
||||
if (isset($_SERVER["argv"][2]) || !isset($langs[$_COOKIE["adminer_lang"]])) {
|
||||
echo "Usage: php lang.php [adminer] [lang]\nPurpose: Update adminer/lang/*.inc.php from source code messages.\n";
|
||||
echo "Usage: php lang.php [lang]\nPurpose: Update adminer/lang/*.inc.php from source code messages.\n";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
preg_match_all('~\\b(include|require) "([^"]*)";~', file_get_contents(dirname(__FILE__) . "/$project/index.php") . file_get_contents(dirname(__FILE__) . "/adminer/include/bootstrap.inc.php"), $matches);
|
||||
$filenames = $matches[2];
|
||||
$filenames[] = "index.php";
|
||||
|
||||
$messages_all = array();
|
||||
foreach ($filenames as $filename) {
|
||||
$filename = dirname(__FILE__) . "/$project/$filename";
|
||||
if (basename($filename) != '$LANG.inc.php') {
|
||||
$file = file_get_contents($filename);
|
||||
if (preg_match_all("~lang\\(('(?:[^\\\\']+|\\\\.)*')([),])~", $file, $matches)) { // lang() always uses apostrophes
|
||||
$messages_all += array_combine($matches[1], $matches[2]);
|
||||
}
|
||||
foreach (array_merge(
|
||||
glob(dirname(__FILE__) . "/adminer/*.php"),
|
||||
glob(dirname(__FILE__) . "/adminer/include/*.php"),
|
||||
glob(dirname(__FILE__) . "/editor/*.php"),
|
||||
glob(dirname(__FILE__) . "/editor/include/*.php"),
|
||||
array()) as $filename) {
|
||||
$file = file_get_contents($filename);
|
||||
if (preg_match_all("~lang\\(('(?:[^\\\\']+|\\\\.)*')([),])~", $file, $matches)) { // lang() always uses apostrophes
|
||||
$messages_all += array_combine($matches[1], $matches[2]);
|
||||
}
|
||||
}
|
||||
|
||||
//! get translations of new Editor messages from Adminer
|
||||
|
||||
foreach (glob(dirname(__FILE__) . "/$project/lang/" . ($_COOKIE["adminer_lang"] ? $_COOKIE["adminer_lang"] : "*") . ".inc.php") as $filename) {
|
||||
foreach (glob(dirname(__FILE__) . "/adminer/lang/" . ($_COOKIE["adminer_lang"] ? $_COOKIE["adminer_lang"] : "*") . ".inc.php") as $filename) {
|
||||
$messages = $messages_all;
|
||||
$file = file_get_contents($filename);
|
||||
preg_match_all("~^(\\s*)(?:// )?(('(?:[^\\\\']+|\\\\.)*') => .*[^,\n]),?~m", $file, $matches, PREG_SET_ORDER);
|
||||
|
Reference in New Issue
Block a user