v161 · concept 2 · inspection tool

Download on a constrained device

On desktop, a language-pack download is usually invisible. On a phone it might use metered data, run into Save-Data, or compete for storage. The spec leaves Chrome free to refuse a download under storage pressure (§7.1). This page reads the signals a page actually has, makes a decision, and downloads only when you tap the button that says so.

1 · device signals (read live)

status
reading…

These are hints, not measurements of free disk. storage.estimate() is this origin's quota, not the model store, and deviceMemory is rounded and capped. Chrome doesn't tell a page the pack size.

2 · decide for a language pair

No decision yet. Press “Check & decide”.

3 · download only on an explicit tap

Tapping Download language pack calls Translator.create() inside your tap. If the pack isn't on the device, this will download it. It stays installed for the whole browser profile.

0%
Run “Check & decide” first.

the code

const c = navigator.connection;
const metered = c?.saveData || ["slow-2g", "2g", "3g"].includes(c?.effectiveType) || c?.type === "cellular";
const state = await Translator.availability({ sourceLanguage, targetLanguage });
if (state === "downloadable" && metered) showAskFirst();   // never auto-download on cellular

downloadButton.onclick = async () => {           // transient user activation
  const ac = new AbortController(); cancelButton.onclick = () => ac.abort();
  translator = await Translator.create({ sourceLanguage, targetLanguage, signal: ac.signal,
    monitor: (m) => m.addEventListener("downloadprogress", (e) => progress.value = e.loaded) });
};

see also