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;
}
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/";
?>
@ -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("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("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("Build time") ?>:</td><td><?php echo iso8601_to_datetime($j["buildtime"]) ?></td></tr>
</table>
@ -266,7 +273,7 @@ $url_prefix = home_url() . "/rpms/";
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("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("Source RPM") ?>:</td><td><?php
$sourcerpm_url = $url_prefix . $repo . "/" . $j["source"]["name"];
@ -287,19 +294,19 @@ $url_prefix = home_url() . "/rpms/";
echo "</td><td>";
foreach ($j["provides"] as $provide) {
echo $provide["name"];
if ($provide["flags"] != "") echo " " . $provide["flags"] . $provide["version"];
if ($provide["flags"] != "") echo " " . $provide["flags"] . " " . $provide["version"];
echo "<br/>";
}
echo "</td><td>";
foreach ($j["obsoletes"] as $obsolete) {
echo $obsolete["name"];
if ($obsolete["flags"] != "") echo " " . $obsolete["flags"] . $obsolete["version"];
if ($obsolete["flags"] != "") echo " " . $obsolete["flags"] . " " . $obsolete["version"];
echo "<br/>";
}
echo "</td><td>";
foreach ($j["requires"] as $require) {
echo $require["name"];
if ($require["flags"] != "") echo " " . $require["flags"] . $require["version"];
if ($require["flags"] != "") echo " " . $require["flags"] . " " . $require["version"];
$cnt = 0;
foreach ($require["providers"] as $provider) {
@ -307,7 +314,7 @@ $url_prefix = home_url() . "/rpms/";
$provider_url = $url_prefix . $provider["repository"] . "/" . $provider["name"] . "/" . $arch;
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/>";
}

Binary file not shown.

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Responsive Theme\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"
"Last-Translator: Silvan Calarco <silvan.calarco@mambasoft.it>\n"
"Language-Team: Italian, Italy\n"
@ -26,147 +26,171 @@ msgstr "Leggi di più &#8250;"
msgid "Pages:"
msgstr "Pagine:"
#: ../distroquery.php:40 ../distroquery.php:135 ../distroquery.php:193
#: ../distroquery.php:47 ../distroquery.php:149 ../distroquery.php:244
msgid "Repositories"
msgstr "Repository"
#: ../distroquery.php:42
#: ../distroquery.php:49
msgid "Available repositories"
msgstr "Repository disponibili"
#: ../distroquery.php:71
#: ../distroquery.php:78
msgid "List of packages"
msgstr "Elenco dei pacchetti"
#: ../distroquery.php:74
#: ../distroquery.php:81
msgid "Search packages"
msgstr "Cerca pacchetti"
#: ../distroquery.php:75
#: ../distroquery.php:82
msgid "Search here"
msgstr "Cerca qui"
#: ../distroquery.php:76
#: ../distroquery.php:83
msgid "Results for:"
msgstr "Risultati per:"
#: ../distroquery.php:92 ../distroquery.php:114
#: ../distroquery.php:99 ../distroquery.php:121
msgid "result(s) found"
msgstr "risultati trovati"
#: ../distroquery.php:93
#: ../distroquery.php:100
msgid "Showing page"
msgstr "Mostro la pagina"
#: ../distroquery.php:93
#: ../distroquery.php:100
msgid "of"
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"
msgstr "Nome"
#: ../distroquery.php:117
#: ../distroquery.php:127
msgid "Version"
msgstr "Versione"
#: ../distroquery.php:118
msgid "Last update"
msgstr "Ultimo aggiornamento"
#: ../distroquery.php:118
#: ../distroquery.php:128
msgid "Summary"
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"
msgstr "ERRORE"
#: ../distroquery.php:148 ../distroquery.php:205
#: ../distroquery.php:162 ../distroquery.php:256
msgid "Resources"
msgstr "Risorse"
#: ../distroquery.php:149 ../distroquery.php:206
#: ../distroquery.php:163 ../distroquery.php:257
msgid "Source files"
msgstr "File sorgenti"
#: ../distroquery.php:150 ../distroquery.php:207
#: ../distroquery.php:164 ../distroquery.php:258
msgid "Changes"
msgstr "Modifiche"
#: ../distroquery.php:151 ../distroquery.php:208
#: ../distroquery.php:165 ../distroquery.php:259
msgid "Issues"
msgstr "Problemi"
#: ../distroquery.php:152 ../distroquery.php:209
#: ../distroquery.php:166 ../distroquery.php:260
msgid "Add a new issue"
msgstr "Segnala un problema"
#: ../distroquery.php:153 ../distroquery.php:210
#: ../distroquery.php:167 ../distroquery.php:261
msgid "Download"
msgstr "Scarica"
#: ../distroquery.php:161 ../distroquery.php:218
#: ../distroquery.php:177 ../distroquery.php:227 ../distroquery.php:271
msgid "Release"
msgstr "Versione"
#: ../distroquery.php:164 ../distroquery.php:222
#: ../distroquery.php:180 ../distroquery.php:275
msgid "Group"
msgstr "Gruppo"
#: ../distroquery.php:165
#: ../distroquery.php:181
msgid "Maintainer"
msgstr "Manutentore"
#: ../distroquery.php:166 ../distroquery.php:223
msgid "Description"
msgstr "Descrizione"
#: ../distroquery.php:167
#: ../distroquery.php:182
msgid "License"
msgstr "Licenza"
#: ../distroquery.php:168 ../distroquery.php:224
#: ../distroquery.php:183 ../distroquery.php:276
msgid "Size"
msgstr "Dimensione"
#: ../distroquery.php:169 ../distroquery.php:225
#: ../distroquery.php:184 ../distroquery.php:277
msgid "Upstream URL"
msgstr "URL di origine"
#: ../distroquery.php:170
#: ../distroquery.php:185
msgid "Build time"
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"
msgstr "RPM creati"
#: ../distroquery.php:177
#: ../distroquery.php:205
msgid "Build requirements"
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"
msgstr "Architettura"
#: ../distroquery.php:226
#: ../distroquery.php:278
msgid "Source RPM"
msgstr "RPM sorgente"
#: ../distroquery.php:229
#: ../distroquery.php:287
msgid "Brothers"
msgstr "Collegati"
#: ../distroquery.php:235
#: ../distroquery.php:287
msgid "Provides"
msgstr "Fornisce"
#: ../distroquery.php:242
#: ../distroquery.php:288
msgid "Obsoletes"
msgstr "Rende obsoleti"
#: ../distroquery.php:249
#: ../distroquery.php:288
msgid "Requires"
msgstr "Richiede"
@ -182,10 +206,6 @@ msgstr "per"
msgid "File size:"
msgstr "Dimensione file:"
#: ../functions.php:129
msgid "Date"
msgstr "Data"
#: ../functions.php:139
msgid ""
"Sorry, download is temporary unavailable. If the problem persists please "

View File

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