Internationalization
This commit is contained in:
@@ -7,7 +7,7 @@ globalThis.Wegwichtel ??= {};
|
||||
let refreshTask = null;
|
||||
|
||||
function format(bytes) {
|
||||
return `${(bytes / 1024 / 1024).toLocaleString('de-DE', { maximumFractionDigits: 1 })} MiB`;
|
||||
return `${(bytes / 1000000).toLocaleString(ns.I18n.language, { maximumFractionDigits: 1 })} MB`;
|
||||
}
|
||||
|
||||
function localBytes() {
|
||||
@@ -34,15 +34,15 @@ globalThis.Wegwichtel ??= {};
|
||||
}
|
||||
|
||||
function siteDescription(usage, quota, known) {
|
||||
if (!known) return 'Der Browser meldet keine Speicherkapazität.';
|
||||
const warning = usage / quota >= .9 ? ' Speicher fast voll.' : '';
|
||||
return `Website-Speicher: ${format(usage)} von ${format(quota)} belegt (${Math.round(usage / quota * 100)} %). Etwa ${format(Math.max(0, quota - usage))} verfügbar.${warning}`;
|
||||
if (!known) return ns.I18n.t("storage-usage.der.freie.platz.konnte.nicht.gemessen.werden");
|
||||
const warning = usage / quota >= .9 ? ns.I18n.t("storage-usage.fast.voll.entferne.inhalte.die.du.nicht") : '';
|
||||
return ns.I18n.t("storage-usage.app.bilder.und.ton.des.verfugbaren.platzes", { value1: Math.round(usage / quota * 100), value2: format(Math.max(0, quota - usage)), value3: warning });
|
||||
}
|
||||
|
||||
function localDescription(local) {
|
||||
if (local == null) return 'Local Storage ist nicht verfügbar.';
|
||||
const warning = local >= LOCAL_REFERENCE * .9 ? ' Richtwert fast erreicht: Große Bilder können das Speichern verhindern.' : '';
|
||||
return `Local Storage: ungefähr ${format(local)} belegt. Balken bezogen auf einen Richtwert von 5 MiB; die tatsächliche Grenze hängt vom Browser ab.${warning}`;
|
||||
if (local == null) return ns.I18n.t("storage-usage.texte.und.einstellungen.konnen.hier.gerade.nicht");
|
||||
const warning = local >= LOCAL_REFERENCE * .9 ? ns.I18n.t("storage-usage.der.balken.ist.fast.voll.grosse.bilder") : '';
|
||||
return ns.I18n.t("storage-usage.texte.und.einstellungen.ungefahr.belegt.der.balken", { value1: format(local), value2: warning });
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
@@ -69,7 +69,7 @@ globalThis.Wegwichtel ??= {};
|
||||
let current = error;
|
||||
while (current) {
|
||||
if (current.name === 'QuotaExceededError') {
|
||||
lastError = 'Speicher voll: Entferne nicht mehr benötigte Offline-Strecken oder lokale Entwürfe. Eine Browser-Quote oder die separate Local-Storage-Grenze kann erreicht sein.';
|
||||
lastError = ns.I18n.t("storage-usage.der.platz.ist.voll.entferne.gespeicherte.strecken");
|
||||
break;
|
||||
}
|
||||
current = current.cause;
|
||||
|
||||
Reference in New Issue
Block a user