mirror of
https://github.com/unraid/webgui.git
synced 2026-05-06 20:30:50 -05:00
Multi-language support
This commit is contained in:
@@ -101,7 +101,12 @@ function language($method, $xml_file, &$error) {
|
||||
exec("mkdir -p $path");
|
||||
@unlink("$docroot/webGui/javascript/translate.$name.js");
|
||||
foreach (glob("$path/*.dot",GLOB_NOSORT) as $dot) unlink($dot);
|
||||
exec("unzip -qqLjo -d $path $local");
|
||||
exec("unzip -qqLjo -d $path $local", $dummy, $err);
|
||||
if ($err > 1) {
|
||||
exec("rm -rf $path");
|
||||
$error = "unzip failed. Error code $err";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case 'remove':
|
||||
$url = $xml->LanguageURL;
|
||||
|
||||
@@ -50,11 +50,15 @@ case 'delete':
|
||||
case 'add':
|
||||
$path = "$docroot/languages/$file";
|
||||
exec("mkdir -p ".escapeshellarg($path));
|
||||
$result = file_put_contents("/$boot/$file.lang.zip",base64_decode(preg_replace('/^data:.*;base64,/','',$_POST['filedata'])));
|
||||
$result = file_put_contents("$boot/$file.lang.zip",base64_decode(preg_replace('/^data:.*;base64,/','',$_POST['filedata'])));
|
||||
if ($result) {
|
||||
foreach (glob("$path/*.dot",GLOB_NOSORT) as $dot) unlink($dot);
|
||||
@unlink("$docroot/webGui/javascript/translate.$file.js");
|
||||
exec("unzip -qqjLo -d ".escapeshellarg($path)." ".escapeshellarg("$boot/$file.lang.zip"));
|
||||
exec("unzip -qqjLo -d ".escapeshellarg($path)." ".escapeshellarg("$boot/$file.lang.zip"), $dummy, $err);
|
||||
if ($err > 1) {
|
||||
unlink("$boot/$file.lang.zip");
|
||||
exec("rm -rf ".escapeshellarg($path));
|
||||
}
|
||||
}
|
||||
$installed = [];
|
||||
foreach (glob("$docroot/languages/*",GLOB_ONLYDIR) as $dir) $installed[] = basename($dir);
|
||||
|
||||
Reference in New Issue
Block a user