distroquery: human file size printing and translations

This commit is contained in:
Silvan Calarco 2024-07-07 16:05:16 +02:00
parent dd3d8f4e6d
commit e593a25368
4 changed files with 147 additions and 100 deletions

View File

@ -17,6 +17,13 @@ if ( !defined( 'ABSPATH' ) ) {
exit; exit;
} }
function human_filesize($bytes, $dec = 2): string {
$size = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$factor = floor((strlen($bytes) - 1) / 3);
if ($factor == 0) $dec = 0;
return sprintf("%.{$dec}f %s", $bytes / (1024 ** $factor), $size[$factor]);
}
$url_prefix = home_url() . "/rpms/"; $url_prefix = home_url() . "/rpms/";
?> ?>
@ -173,7 +180,7 @@ $url_prefix = home_url() . "/rpms/";
<tr><td width="15%"><?php echo _r("Group") ?>:</td><td><?php echo $j["group"] ?></td></tr> <tr><td width="15%"><?php echo _r("Group") ?>:</td><td><?php echo $j["group"] ?></td></tr>
<tr><td width="15%"><?php echo _r("Maintainer") ?>:</td><td><?php echo $j["maintainer"] ?></td></tr> <tr><td width="15%"><?php echo _r("Maintainer") ?>:</td><td><?php echo $j["maintainer"] ?></td></tr>
<tr><td width="15%"><?php echo _r("License") ?>:</td><td><?php echo $j["license"] ?></td></tr> <tr><td width="15%"><?php echo _r("License") ?>:</td><td><?php echo $j["license"] ?></td></tr>
<tr><td width="15%"><?php echo _r("Size") ?>:</td><td><?php echo $j["size"] ?></td></tr> <tr><td width="15%"><?php echo _r("Size") ?>:</td><td><?php echo human_filesize($j["size"]) ?></td></tr>
<tr><td width="15%"><?php echo _r("Upstream URL") ?>:</td><td><a href="<?php echo $j["url"] ?>" target=_blank><?php echo $j["url"] ?></a></td></tr> <tr><td width="15%"><?php echo _r("Upstream URL") ?>:</td><td><a href="<?php echo $j["url"] ?>" target=_blank><?php echo $j["url"] ?></a></td></tr>
<tr><td width="15%"><?php echo _r("Build time") ?>:</td><td><?php echo iso8601_to_datetime($j["buildtime"]) ?></td></tr> <tr><td width="15%"><?php echo _r("Build time") ?>:</td><td><?php echo iso8601_to_datetime($j["buildtime"]) ?></td></tr>
</table> </table>
@ -266,7 +273,7 @@ $url_prefix = home_url() . "/rpms/";
echo $j["source"]["version"]."-".$j["source"]["release"] ?></td></tr> echo $j["source"]["version"]."-".$j["source"]["release"] ?></td></tr>
<tr><td width="15%"><?php echo _r("Architecture") ?>:</td><td><?php echo $j["arch"] ?></td></tr> <tr><td width="15%"><?php echo _r("Architecture") ?>:</td><td><?php echo $j["arch"] ?></td></tr>
<tr><td width="15%"><?php echo _r("Group") ?>:</td><td><?php echo $j["group"] ?></td></tr> <tr><td width="15%"><?php echo _r("Group") ?>:</td><td><?php echo $j["group"] ?></td></tr>
<tr><td width="15%"><?php echo _r("Size") ?>:</td><td><?php echo $j["size"] ?></td></tr> <tr><td width="15%"><?php echo _r("Size") ?>:</td><td><?php echo human_filesize($j["size"]) ?></td></tr>
<tr><td width="15%"><?php echo _r("Upstream URL") ?>:</td><td><a href="<?php echo $j["source"]["url"] ?>" target=_blank><?php echo $j["source"]["url"] ?></a></td></tr> <tr><td width="15%"><?php echo _r("Upstream URL") ?>:</td><td><a href="<?php echo $j["source"]["url"] ?>" target=_blank><?php echo $j["source"]["url"] ?></a></td></tr>
<tr><td width="15%"><?php echo _r("Source RPM") ?>:</td><td><?php <tr><td width="15%"><?php echo _r("Source RPM") ?>:</td><td><?php
$sourcerpm_url = $url_prefix . $repo . "/" . $j["source"]["name"]; $sourcerpm_url = $url_prefix . $repo . "/" . $j["source"]["name"];
@ -287,19 +294,19 @@ $url_prefix = home_url() . "/rpms/";
echo "</td><td>"; echo "</td><td>";
foreach ($j["provides"] as $provide) { foreach ($j["provides"] as $provide) {
echo $provide["name"]; echo $provide["name"];
if ($provide["flags"] != "") echo " " . $provide["flags"] . $provide["version"]; if ($provide["flags"] != "") echo " " . $provide["flags"] . " " . $provide["version"];
echo "<br/>"; echo "<br/>";
} }
echo "</td><td>"; echo "</td><td>";
foreach ($j["obsoletes"] as $obsolete) { foreach ($j["obsoletes"] as $obsolete) {
echo $obsolete["name"]; echo $obsolete["name"];
if ($obsolete["flags"] != "") echo " " . $obsolete["flags"] . $obsolete["version"]; if ($obsolete["flags"] != "") echo " " . $obsolete["flags"] . " " . $obsolete["version"];
echo "<br/>"; echo "<br/>";
} }
echo "</td><td>"; echo "</td><td>";
foreach ($j["requires"] as $require) { foreach ($j["requires"] as $require) {
echo $require["name"]; echo $require["name"];
if ($require["flags"] != "") echo " " . $require["flags"] . $require["version"]; if ($require["flags"] != "") echo " " . $require["flags"] . " " . $require["version"];
$cnt = 0; $cnt = 0;
foreach ($require["providers"] as $provider) { foreach ($require["providers"] as $provider) {
@ -307,7 +314,7 @@ $url_prefix = home_url() . "/rpms/";
$provider_url = $url_prefix . $provider["repository"] . "/" . $provider["name"] . "/" . $arch; $provider_url = $url_prefix . $provider["repository"] . "/" . $provider["name"] . "/" . $arch;
echo " <a href=\"" . $provider_url . "\">[" . $cnt . "]</a>"; echo " <a href=\"" . $provider_url . "\">[" . $cnt . "]</a>";
} }
if ($cnt == 0) echo " (" . _r("unresolved") . ")"; if ($cnt == 0) echo " <font color=red>(" . _r("unresolved") . ")</font>";
echo "<br/>"; echo "<br/>";
} }

Binary file not shown.

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Responsive Theme\n" "Project-Id-Version: Responsive Theme\n"
"Report-Msgid-Bugs-To: bugs@openmamba.org\n" "Report-Msgid-Bugs-To: bugs@openmamba.org\n"
"POT-Creation-Date: 2024-07-06 19:15+0200\n" "POT-Creation-Date: 2024-07-07 14:59+0200\n"
"PO-Revision-Date: 2014-12-08 16:25+0100\n" "PO-Revision-Date: 2014-12-08 16:25+0100\n"
"Last-Translator: Silvan Calarco <silvan.calarco@mambasoft.it>\n" "Last-Translator: Silvan Calarco <silvan.calarco@mambasoft.it>\n"
"Language-Team: Italian, Italy\n" "Language-Team: Italian, Italy\n"
@ -26,147 +26,171 @@ msgstr "Leggi di più &#8250;"
msgid "Pages:" msgid "Pages:"
msgstr "Pagine:" msgstr "Pagine:"
#: ../distroquery.php:40 ../distroquery.php:135 ../distroquery.php:193 #: ../distroquery.php:47 ../distroquery.php:149 ../distroquery.php:244
msgid "Repositories" msgid "Repositories"
msgstr "Repository" msgstr "Repository"
#: ../distroquery.php:42 #: ../distroquery.php:49
msgid "Available repositories" msgid "Available repositories"
msgstr "Repository disponibili" msgstr "Repository disponibili"
#: ../distroquery.php:71 #: ../distroquery.php:78
msgid "List of packages" msgid "List of packages"
msgstr "Elenco dei pacchetti" msgstr "Elenco dei pacchetti"
#: ../distroquery.php:74 #: ../distroquery.php:81
msgid "Search packages" msgid "Search packages"
msgstr "Cerca pacchetti" msgstr "Cerca pacchetti"
#: ../distroquery.php:75 #: ../distroquery.php:82
msgid "Search here" msgid "Search here"
msgstr "Cerca qui" msgstr "Cerca qui"
#: ../distroquery.php:76 #: ../distroquery.php:83
msgid "Results for:" msgid "Results for:"
msgstr "Risultati per:" msgstr "Risultati per:"
#: ../distroquery.php:92 ../distroquery.php:114 #: ../distroquery.php:99 ../distroquery.php:121
msgid "result(s) found" msgid "result(s) found"
msgstr "risultati trovati" msgstr "risultati trovati"
#: ../distroquery.php:93 #: ../distroquery.php:100
msgid "Showing page" msgid "Showing page"
msgstr "Mostro la pagina" msgstr "Mostro la pagina"
#: ../distroquery.php:93 #: ../distroquery.php:100
msgid "of" msgid "of"
msgstr "di" msgstr "di"
#: ../distroquery.php:117 ../distroquery.php:160 ../distroquery.php:217 #: ../distroquery.php:125
msgid "Arch"
msgstr "Architettura"
#: ../distroquery.php:126 ../distroquery.php:176 ../distroquery.php:270
msgid "Name" msgid "Name"
msgstr "Nome" msgstr "Nome"
#: ../distroquery.php:117 #: ../distroquery.php:127
msgid "Version" msgid "Version"
msgstr "Versione" msgstr "Versione"
#: ../distroquery.php:118 #: ../distroquery.php:128
msgid "Last update"
msgstr "Ultimo aggiornamento"
#: ../distroquery.php:118
msgid "Summary" msgid "Summary"
msgstr "Descrizione" msgstr "Descrizione"
#: ../distroquery.php:141 ../distroquery.php:198 #: ../distroquery.php:129
msgid "Last update"
msgstr "Ultimo aggiornamento"
#: ../distroquery.php:155 ../distroquery.php:249
msgid "ERROR" msgid "ERROR"
msgstr "ERRORE" msgstr "ERRORE"
#: ../distroquery.php:148 ../distroquery.php:205 #: ../distroquery.php:162 ../distroquery.php:256
msgid "Resources" msgid "Resources"
msgstr "Risorse" msgstr "Risorse"
#: ../distroquery.php:149 ../distroquery.php:206 #: ../distroquery.php:163 ../distroquery.php:257
msgid "Source files" msgid "Source files"
msgstr "File sorgenti" msgstr "File sorgenti"
#: ../distroquery.php:150 ../distroquery.php:207 #: ../distroquery.php:164 ../distroquery.php:258
msgid "Changes" msgid "Changes"
msgstr "Modifiche" msgstr "Modifiche"
#: ../distroquery.php:151 ../distroquery.php:208 #: ../distroquery.php:165 ../distroquery.php:259
msgid "Issues" msgid "Issues"
msgstr "Problemi" msgstr "Problemi"
#: ../distroquery.php:152 ../distroquery.php:209 #: ../distroquery.php:166 ../distroquery.php:260
msgid "Add a new issue" msgid "Add a new issue"
msgstr "Segnala un problema" msgstr "Segnala un problema"
#: ../distroquery.php:153 ../distroquery.php:210 #: ../distroquery.php:167 ../distroquery.php:261
msgid "Download" msgid "Download"
msgstr "Scarica" msgstr "Scarica"
#: ../distroquery.php:161 ../distroquery.php:218 #: ../distroquery.php:177 ../distroquery.php:227 ../distroquery.php:271
msgid "Release" msgid "Release"
msgstr "Versione" msgstr "Versione"
#: ../distroquery.php:164 ../distroquery.php:222 #: ../distroquery.php:180 ../distroquery.php:275
msgid "Group" msgid "Group"
msgstr "Gruppo" msgstr "Gruppo"
#: ../distroquery.php:165 #: ../distroquery.php:181
msgid "Maintainer" msgid "Maintainer"
msgstr "Manutentore" msgstr "Manutentore"
#: ../distroquery.php:166 ../distroquery.php:223 #: ../distroquery.php:182
msgid "Description"
msgstr "Descrizione"
#: ../distroquery.php:167
msgid "License" msgid "License"
msgstr "Licenza" msgstr "Licenza"
#: ../distroquery.php:168 ../distroquery.php:224 #: ../distroquery.php:183 ../distroquery.php:276
msgid "Size" msgid "Size"
msgstr "Dimensione" msgstr "Dimensione"
#: ../distroquery.php:169 ../distroquery.php:225 #: ../distroquery.php:184 ../distroquery.php:277
msgid "Upstream URL" msgid "Upstream URL"
msgstr "URL di origine" msgstr "URL di origine"
#: ../distroquery.php:170 #: ../distroquery.php:185
msgid "Build time" msgid "Build time"
msgstr "Data di compilazione" msgstr "Data di compilazione"
#: ../distroquery.php:171 #: ../distroquery.php:190
msgid "Binary packages and requirements"
msgstr "Pacchetti binari e dipendenze"
#: ../distroquery.php:196
msgid "Built RPMS" msgid "Built RPMS"
msgstr "RPM creati" msgstr "RPM creati"
#: ../distroquery.php:177 #: ../distroquery.php:205
msgid "Build requirements" msgid "Build requirements"
msgstr "Dipendenze di compilazione" msgstr "Dipendenze di compilazione"
#: ../distroquery.php:221 #: ../distroquery.php:217 ../distroquery.php:317
msgid "unresolved"
msgstr "non risolto"
#: ../distroquery.php:225
msgid "History of changes"
msgstr "Cronologia delle modifiche"
#: ../distroquery.php:226 ../functions.php:129
msgid "Date"
msgstr "Data"
#: ../distroquery.php:227
msgid "Packager"
msgstr "Packager"
#: ../distroquery.php:228
msgid "Description"
msgstr "Descrizione"
#: ../distroquery.php:274
msgid "Architecture" msgid "Architecture"
msgstr "Architettura" msgstr "Architettura"
#: ../distroquery.php:226 #: ../distroquery.php:278
msgid "Source RPM" msgid "Source RPM"
msgstr "RPM sorgente" msgstr "RPM sorgente"
#: ../distroquery.php:229 #: ../distroquery.php:287
msgid "Brothers" msgid "Brothers"
msgstr "Collegati" msgstr "Collegati"
#: ../distroquery.php:235 #: ../distroquery.php:287
msgid "Provides" msgid "Provides"
msgstr "Fornisce" msgstr "Fornisce"
#: ../distroquery.php:242 #: ../distroquery.php:288
msgid "Obsoletes" msgid "Obsoletes"
msgstr "Rende obsoleti" msgstr "Rende obsoleti"
#: ../distroquery.php:249 #: ../distroquery.php:288
msgid "Requires" msgid "Requires"
msgstr "Richiede" msgstr "Richiede"
@ -182,10 +206,6 @@ msgstr "per"
msgid "File size:" msgid "File size:"
msgstr "Dimensione file:" msgstr "Dimensione file:"
#: ../functions.php:129
msgid "Date"
msgstr "Data"
#: ../functions.php:139 #: ../functions.php:139
msgid "" msgid ""
"Sorry, download is temporary unavailable. If the problem persists please " "Sorry, download is temporary unavailable. If the problem persists please "

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: openmamba 1.0\n" "Project-Id-Version: openmamba 1.0\n"
"Report-Msgid-Bugs-To: bugs@openmamba.org\n" "Report-Msgid-Bugs-To: bugs@openmamba.org\n"
"POT-Creation-Date: 2024-07-06 19:15+0200\n" "POT-Creation-Date: 2024-07-07 14:59+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -27,147 +27,171 @@ msgstr ""
msgid "Pages:" msgid "Pages:"
msgstr "" msgstr ""
#: ../distroquery.php:40 ../distroquery.php:135 ../distroquery.php:193 #: ../distroquery.php:47 ../distroquery.php:149 ../distroquery.php:244
msgid "Repositories" msgid "Repositories"
msgstr "" msgstr ""
#: ../distroquery.php:42 #: ../distroquery.php:49
msgid "Available repositories" msgid "Available repositories"
msgstr "" msgstr ""
#: ../distroquery.php:71 #: ../distroquery.php:78
msgid "List of packages" msgid "List of packages"
msgstr "" msgstr ""
#: ../distroquery.php:74 #: ../distroquery.php:81
msgid "Search packages" msgid "Search packages"
msgstr "" msgstr ""
#: ../distroquery.php:75 #: ../distroquery.php:82
msgid "Search here" msgid "Search here"
msgstr "" msgstr ""
#: ../distroquery.php:76 #: ../distroquery.php:83
msgid "Results for:" msgid "Results for:"
msgstr "" msgstr ""
#: ../distroquery.php:92 ../distroquery.php:114 #: ../distroquery.php:99 ../distroquery.php:121
msgid "result(s) found" msgid "result(s) found"
msgstr "" msgstr ""
#: ../distroquery.php:93 #: ../distroquery.php:100
msgid "Showing page" msgid "Showing page"
msgstr "" msgstr ""
#: ../distroquery.php:93 #: ../distroquery.php:100
msgid "of" msgid "of"
msgstr "" msgstr ""
#: ../distroquery.php:117 ../distroquery.php:160 ../distroquery.php:217 #: ../distroquery.php:125
msgid "Arch"
msgstr ""
#: ../distroquery.php:126 ../distroquery.php:176 ../distroquery.php:270
msgid "Name" msgid "Name"
msgstr "" msgstr ""
#: ../distroquery.php:117 #: ../distroquery.php:127
msgid "Version" msgid "Version"
msgstr "" msgstr ""
#: ../distroquery.php:118 #: ../distroquery.php:128
msgid "Last update"
msgstr ""
#: ../distroquery.php:118
msgid "Summary" msgid "Summary"
msgstr "" msgstr ""
#: ../distroquery.php:141 ../distroquery.php:198 #: ../distroquery.php:129
msgid "Last update"
msgstr ""
#: ../distroquery.php:155 ../distroquery.php:249
msgid "ERROR" msgid "ERROR"
msgstr "" msgstr ""
#: ../distroquery.php:148 ../distroquery.php:205 #: ../distroquery.php:162 ../distroquery.php:256
msgid "Resources" msgid "Resources"
msgstr "" msgstr ""
#: ../distroquery.php:149 ../distroquery.php:206 #: ../distroquery.php:163 ../distroquery.php:257
msgid "Source files" msgid "Source files"
msgstr "" msgstr ""
#: ../distroquery.php:150 ../distroquery.php:207 #: ../distroquery.php:164 ../distroquery.php:258
msgid "Changes" msgid "Changes"
msgstr "" msgstr ""
#: ../distroquery.php:151 ../distroquery.php:208 #: ../distroquery.php:165 ../distroquery.php:259
msgid "Issues" msgid "Issues"
msgstr "" msgstr ""
#: ../distroquery.php:152 ../distroquery.php:209 #: ../distroquery.php:166 ../distroquery.php:260
msgid "Add a new issue" msgid "Add a new issue"
msgstr "" msgstr ""
#: ../distroquery.php:153 ../distroquery.php:210 #: ../distroquery.php:167 ../distroquery.php:261
msgid "Download" msgid "Download"
msgstr "" msgstr ""
#: ../distroquery.php:161 ../distroquery.php:218 #: ../distroquery.php:177 ../distroquery.php:227 ../distroquery.php:271
msgid "Release" msgid "Release"
msgstr "" msgstr ""
#: ../distroquery.php:164 ../distroquery.php:222 #: ../distroquery.php:180 ../distroquery.php:275
msgid "Group" msgid "Group"
msgstr "" msgstr ""
#: ../distroquery.php:165 #: ../distroquery.php:181
msgid "Maintainer" msgid "Maintainer"
msgstr "" msgstr ""
#: ../distroquery.php:166 ../distroquery.php:223 #: ../distroquery.php:182
msgid "Description"
msgstr ""
#: ../distroquery.php:167
msgid "License" msgid "License"
msgstr "" msgstr ""
#: ../distroquery.php:168 ../distroquery.php:224 #: ../distroquery.php:183 ../distroquery.php:276
msgid "Size" msgid "Size"
msgstr "" msgstr ""
#: ../distroquery.php:169 ../distroquery.php:225 #: ../distroquery.php:184 ../distroquery.php:277
msgid "Upstream URL" msgid "Upstream URL"
msgstr "" msgstr ""
#: ../distroquery.php:170 #: ../distroquery.php:185
msgid "Build time" msgid "Build time"
msgstr "" msgstr ""
#: ../distroquery.php:171 #: ../distroquery.php:190
msgid "Binary packages and requirements"
msgstr ""
#: ../distroquery.php:196
msgid "Built RPMS" msgid "Built RPMS"
msgstr "" msgstr ""
#: ../distroquery.php:177 #: ../distroquery.php:205
msgid "Build requirements" msgid "Build requirements"
msgstr "" msgstr ""
#: ../distroquery.php:221 #: ../distroquery.php:217 ../distroquery.php:317
msgid "unresolved"
msgstr ""
#: ../distroquery.php:225
msgid "History of changes"
msgstr ""
#: ../distroquery.php:226 ../functions.php:129
msgid "Date"
msgstr ""
#: ../distroquery.php:227
msgid "Packager"
msgstr ""
#: ../distroquery.php:228
msgid "Description"
msgstr ""
#: ../distroquery.php:274
msgid "Architecture" msgid "Architecture"
msgstr "" msgstr ""
#: ../distroquery.php:226 #: ../distroquery.php:278
msgid "Source RPM" msgid "Source RPM"
msgstr "" msgstr ""
#: ../distroquery.php:229 #: ../distroquery.php:287
msgid "Brothers" msgid "Brothers"
msgstr "" msgstr ""
#: ../distroquery.php:235 #: ../distroquery.php:287
msgid "Provides" msgid "Provides"
msgstr "" msgstr ""
#: ../distroquery.php:242 #: ../distroquery.php:288
msgid "Obsoletes" msgid "Obsoletes"
msgstr "" msgstr ""
#: ../distroquery.php:249 #: ../distroquery.php:288
msgid "Requires" msgid "Requires"
msgstr "" msgstr ""
@ -183,10 +207,6 @@ msgstr ""
msgid "File size:" msgid "File size:"
msgstr "" msgstr ""
#: ../functions.php:129
msgid "Date"
msgstr ""
#: ../functions.php:139 #: ../functions.php:139
msgid "" msgid ""
"Sorry, download is temporary unavailable. If the problem persists please " "Sorry, download is temporary unavailable. If the problem persists please "