mirror of
https://github.com/unraid/webgui.git
synced 2026-04-22 10:08:25 -05:00
Multi-language support
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?PHP
|
||||
/* Copyright 2005-2019, Lime Technology
|
||||
* Copyright 2012-2019, 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'] = 'shares';
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
|
||||
$shares = parse_ini_file('state/shares.ini',true);
|
||||
@@ -32,8 +36,7 @@ $display['number'] = $_GET['number'];
|
||||
function disk_share_settings($protocol,$share) {
|
||||
if (empty($share)) return;
|
||||
if ($protocol!='yes' || $share['export']=='-') return "-";
|
||||
if ($share['export']=='e') return ucfirst($share['security']);
|
||||
return '<em>'.ucfirst($share['security']).'</em>';
|
||||
return ($share['export']=='e') ? _(ucfirst($share['security'])) : '<em>'._(ucfirst($share['security'])).'</em>';
|
||||
}
|
||||
|
||||
function globalInclude($name) {
|
||||
@@ -75,14 +78,14 @@ foreach ($disks as $name => $disk) {
|
||||
$color = $disk['fsColor'];
|
||||
$row++;
|
||||
switch ($color) {
|
||||
case 'green-on' : $orb = 'circle'; $color = 'green'; $help = 'All files protected'; break;
|
||||
case 'yellow-on': $orb = 'warning'; $color = 'yellow'; $help = 'All files unprotected'; break;
|
||||
case 'green-on' : $orb = 'circle'; $color = 'green'; $help = _('All files protected'); break;
|
||||
case 'yellow-on': $orb = 'warning'; $color = 'yellow'; $help = _('All files unprotected'); break;
|
||||
}
|
||||
if ($crypto) switch ($disk['luksState']) {
|
||||
case 0: $luks = "<i class='nolock fa fa-lock'></i>"; break;
|
||||
case 1: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt green-text'></i><span>All files encrypted</span></a>"; break;
|
||||
case 2: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt orange-text'></i><span>Some or all files unencrypted</span></a>"; break;
|
||||
default: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-lock red-text'></i><span>Unknown encryption state'</span></a>"; break;
|
||||
case 1: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt green-text'></i><span>"._('All files encrypted')."</span></a>"; break;
|
||||
case 2: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-unlock-alt orange-text'></i><span>"._('Some or all files unencrypted')."</span></a>"; break;
|
||||
default: $luks = "<a class='info' onclick='return false'><i class='padlock fa fa-lock red-text'></i><span>"._('Unknown encryption state')."</span></a>"; break;
|
||||
} else $luks = "";
|
||||
echo "<tr>";
|
||||
echo "<td><a class='info nohand' onclick='return false'><i class='fa fa-$orb orb $color-orb'></i><span style='left:18px'>$help</span></a>$luks<a href='$path/Disk?name=$name' onclick=\"$.cookie('one','tab1',{path:'/'})\">$name</a></td>";
|
||||
@@ -91,12 +94,12 @@ foreach ($disks as $name => $disk) {
|
||||
echo "<td>".disk_share_settings($var['shareNFSEnabled'], $sec_nfs[$name])."</td>";
|
||||
echo "<td>".disk_share_settings($var['shareAFPEnabled'], $sec_afp[$name])."</td>";
|
||||
$cmd="/webGui/scripts/disk_size"."&arg1=".urlencode($name)."&arg2=ssz2";
|
||||
$type = $disk['rotational'] ? 'HDD' : 'SSD';
|
||||
$type = $disk['rotational'] ? _('HDD') : _('SSD');
|
||||
if (array_key_exists($name, $ssz2)) {
|
||||
echo "<td>$type</td>";
|
||||
echo "<td>".my_scale(($disk['fsSize'])*1024, $unit)." $unit</td>";
|
||||
echo "<td>".my_scale($disk['fsFree']*1024, $unit)." $unit</td>";
|
||||
echo "<td><a href='$path/Browse?dir=/mnt/$name'><img src='/webGui/images/explore.png' title='Browse /mnt/$name'></a></td>";
|
||||
echo "<td><a href='$path/Browse?dir=/mnt/$name'><img src='/webGui/images/explore.png' title='"._('Browse')." /mnt/$name'></a></td>";
|
||||
echo "</tr>";
|
||||
foreach ($ssz2[$name] as $sharename => $sharesize) {
|
||||
if ($sharename=='share.total') continue;
|
||||
@@ -104,25 +107,25 @@ foreach ($disks as $name => $disk) {
|
||||
$inside = in_array($disk['name'], array_filter(array_diff($myDisks, explode(',',$shares[$sharename]['exclude'])), 'shareInclude'));
|
||||
echo "<tr class='share_status_size".($inside ? "'>" : " warning'>");
|
||||
echo "<td>$sharename:</td>";
|
||||
echo "<td>".($inside ? "" : "<em>Share is outside the list of designated disks</em>")."</td>";
|
||||
echo "<td>".($inside ? "" : "<em>"._('Share is outside the list of designated disks')."</em>")."</td>";
|
||||
echo "<td></td>";
|
||||
echo "<td></td>";
|
||||
echo "<td></td>";
|
||||
echo "<td></td>";
|
||||
echo "<td class='disk-$row-1'>".my_scale($sharesize*1024, $unit)." $unit</td>";
|
||||
echo "<td class='disk-$row-2'>".my_scale($disk['fsFree']*1024, $unit)." $unit</td>";
|
||||
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' title='Recompute...' onclick='$.cookie(\"ssz\",\"ssz\",{path:\"/\"});$(\".disk-$row-1\").html(\"Please wait...\");$(\".disk-$row-2\").html(\"\");'><i class='fa fa-refresh icon'></i></a></td>";
|
||||
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' title='"._('Recompute')."...' onclick='$.cookie(\"ssz\",\"ssz\",{path:\"/\"});$(\".disk-$row-1\").html(\""._('Please wait')."...\");$(\".disk-$row-2\").html(\"\");'><i class='fa fa-refresh icon'></i></a></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
} else {
|
||||
echo "<td>$type</td>";
|
||||
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' onclick=\"$.cookie('ssz','ssz',{path:'/'});$(this).text('Please wait...')\">Compute...</a></td>";
|
||||
echo "<td><a href='/update.htm?cmd=$cmd&csrf_token={$var['csrf_token']}' target='progressFrame' onclick=\"$.cookie('ssz','ssz',{path:'/'});$(this).text('"._('Please wait')."...')\">"._('Compute')."...</a></td>";
|
||||
echo "<td>".my_scale($disk['fsFree']*1024, $unit)." $unit</td>";
|
||||
echo "<td><a href='$path/Browse?dir=/mnt/$name'><img src='/webGui/images/explore.png' title='Browse /mnt/$name'></a></td>";
|
||||
echo "<td><a href='$path/Browse?dir=/mnt/$name'><img src='/webGui/images/explore.png' title='"._('Browse')." /mnt/$name'></a></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
if ($row==0) {
|
||||
echo "<tr><td colspan='9' style='text-align:center;padding-top:12px'><i class='fa fa-folder-open-o icon'></i>There are no exportable disk shares</td></tr>";
|
||||
echo "<tr><td colspan='9' style='text-align:center;padding-top:12px'><i class='fa fa-folder-open-o icon'></i>"._('There are no exportable disk shares')."</td></tr>";
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user