mirror of
https://github.com/unraid/webgui.git
synced 2026-04-28 13:59:21 -05:00
Multi-language support
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2018, Lime Technology
|
||||
* Copyright 2012-2018, Bergware International.
|
||||
/* Copyright 2005-2020, Lime Technology
|
||||
* Copyright 2012-2020, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -12,6 +12,10 @@
|
||||
?>
|
||||
<?
|
||||
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
// add translations
|
||||
$_SERVER['REQUEST_URI'] = 'main';
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
|
||||
$month = [' Jan '=>'-01-',' Feb '=>'-02-',' Mar '=>'-03-',' Apr '=>'-04-',' May '=>'-05-',' Jun '=>'-06-',' Jul '=>'-07-',' Aug '=>'-08-',' Sep '=>'-09-',' Oct '=>'-10-',' Nov '=>'-11-',' Dec '=>'-12-'];
|
||||
@@ -26,7 +30,7 @@ function his_duration($time) {
|
||||
$hour = floor($hmss/3600);
|
||||
$mins = $hmss/60%60;
|
||||
$secs = $hmss%60;
|
||||
return his_plus($days,'day',($hour|$mins|$secs)==0).his_plus($hour,'hr',($mins|$secs)==0).his_plus($mins,'min',$secs==0).his_plus($secs,'sec',true);
|
||||
return his_plus($days,_('day'),($hour|$mins|$secs)==0).his_plus($hour,_('hr'),($mins|$secs)==0).his_plus($mins,_('min'),$secs==0).his_plus($secs,_('sec'),true);
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
@@ -39,25 +43,25 @@ function his_duration($time) {
|
||||
<link type="text/css" rel="stylesheet" href="<?autov("/webGui/styles/default-popup.css")?>">
|
||||
</head>
|
||||
<body>
|
||||
<table class='share_status'><thead><tr><td>Date</td><td>Duration</td><td>Speed</td><td>Status</td><td>Errors</td></tr></thead><tbody>
|
||||
<table class='share_status'><thead><tr><td><?=_('Date')?></td><td><?=_('Duration')?></td><td><?=_('Speed')?></td><td><?=_('Status')?></td><td><?=_('Errors')?></td></tr></thead><tbody>
|
||||
<?
|
||||
$log = '/boot/config/parity-checks.log'; $list = [];
|
||||
if (file_exists($log)) {
|
||||
$handle = fopen($log, 'r');
|
||||
while (($line = fgets($handle)) !== false) {
|
||||
list($date,$duration,$speed,$status,$error) = explode('|',$line);
|
||||
if ($speed==0) $speed = 'Unavailable';
|
||||
[$date,$duration,$speed,$status,$error] = explode('|',$line);
|
||||
if ($speed==0) $speed = _('Unavailable');
|
||||
$date = str_replace(' ',', ',strtr(str_replace(' ',' 0',$date),$month));
|
||||
if ($duration>0||$status<>0) $list[] = "<tr><td>$date</td><td>".his_duration($duration)."</td><td>$speed</td><td>".($status==0?'OK':($status==-4?'Canceled':$status))."</td><td>$error</td></tr>";
|
||||
if ($duration>0||$status<>0) $list[] = "<tr><td>$date</td><td>".his_duration($duration)."</td><td>$speed</td><td>".($status==0?_('OK'):($status==-4?_('Canceled'):$status))."</td><td>$error</td></tr>";
|
||||
}
|
||||
fclose($handle);
|
||||
}
|
||||
if ($list)
|
||||
for ($i=count($list); $i>=0; --$i) echo $list[$i];
|
||||
else
|
||||
echo "<tr><td colspan='5' style='text-align:center;padding-top:12px'>No parity check history present!</td></tr>";
|
||||
echo "<tr><td colspan='5' style='text-align:center;padding-top:12px'>"._('No parity check history present')."!</td></tr>";
|
||||
?>
|
||||
</tbody></table>
|
||||
<div style="text-align:center;margin-top:12px"><input type="button" value="Done" onclick="top.Shadowbox.close()"></div>
|
||||
<div style="text-align:center;margin-top:12px"><input type="button" value="<?=_('Done')?>" onclick="top.Shadowbox.close()"></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user