selfstore 1.6.9 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/widgets.d.ts CHANGED
@@ -32,7 +32,17 @@ declare abstract class FlowWidget extends HTMLElement {
32
32
  * document's, which wins over the browser's, so a host that already sets
33
33
  * `<html lang>` gets translated copy without writing a single label. */
34
34
  private localized;
35
- protected t(key: string): string;
35
+ /**
36
+ * The copy for a key, with `{placeholders}` filled in.
37
+ *
38
+ * A status that cannot name WHERE it saved has to be read twice: once for the
39
+ * state, once for the destination on another line. Interpolation lets a pack
40
+ * write one sentence instead - and lets each language put the place where its
41
+ * own grammar wants it, which a fixed "state, then label" layout cannot.
42
+ * A placeholder with no value is left as written rather than blanked, so a
43
+ * missing variable shows up instead of producing a sentence with a hole.
44
+ */
45
+ protected t(key: string, vars?: Record<string, string | null | undefined>): string;
36
46
  /** A heading an empty-string label removes: labels = { 'share.title': '' }
37
47
  * hides that heading (the host page already says it) without a fork.
38
48
  * Append through put(), which skips the null. */
package/dist/widgets.js CHANGED
@@ -373,8 +373,20 @@ var FlowWidget = class extends HTMLElement {
373
373
  const tag = this.closest("[lang]")?.getAttribute("lang") || document.documentElement.lang || navigator.language || "";
374
374
  return this.packs()[tag.slice(0, 2).toLowerCase()] ?? {};
375
375
  }
376
- t(key) {
377
- return this.overrides[key] ?? this.localized()[key] ?? this.defaults()[key] ?? key;
376
+ /**
377
+ * The copy for a key, with `{placeholders}` filled in.
378
+ *
379
+ * A status that cannot name WHERE it saved has to be read twice: once for the
380
+ * state, once for the destination on another line. Interpolation lets a pack
381
+ * write one sentence instead - and lets each language put the place where its
382
+ * own grammar wants it, which a fixed "state, then label" layout cannot.
383
+ * A placeholder with no value is left as written rather than blanked, so a
384
+ * missing variable shows up instead of producing a sentence with a hole.
385
+ */
386
+ t(key, vars) {
387
+ const copy = this.overrides[key] ?? this.localized()[key] ?? this.defaults()[key] ?? key;
388
+ if (!vars) return copy;
389
+ return copy.replace(/\{(\w+)\}/g, (whole, name) => vars[name] ?? whole);
378
390
  }
379
391
  /** A heading an empty-string label removes: labels = { 'share.title': '' }
380
392
  * hides that heading (the host page already says it) without a fork.
@@ -1824,12 +1836,13 @@ var SelfstoreJoinElement = class extends FlowWidget {
1824
1836
  // src/widgets/status.ts
1825
1837
  var EN4 = {
1826
1838
  "status.ephemeral": "Nothing is saved",
1827
- "status.cacheOnly": "Only on this device",
1839
+ "status.cacheOnly": "Never saved anywhere yet",
1828
1840
  "status.saving": "Saving...",
1829
- "status.saved": "Saved",
1841
+ "status.saved": "Saved to {label}, at every change",
1830
1842
  "status.needsAttention": "Reconnect to continue",
1831
1843
  "status.locked": "Locked",
1832
1844
  "status.pendingDownload": "Changes to download",
1845
+ "status.saved.placeless": "Saved",
1833
1846
  "status.action.choose-destination": "Choose a destination",
1834
1847
  "status.action.download": "Download",
1835
1848
  "status.action.reconnect": "Reconnect",
@@ -1837,12 +1850,13 @@ var EN4 = {
1837
1850
  };
1838
1851
  var FR4 = {
1839
1852
  "status.ephemeral": "Rien n'est enregistr\xE9",
1840
- "status.cacheOnly": "Sur cet appareil seulement",
1853
+ "status.cacheOnly": "Vos donn\xE9es n'ont jamais \xE9t\xE9 enregistr\xE9es ailleurs",
1841
1854
  "status.saving": "Enregistrement...",
1842
- "status.saved": "Sauvegarde \xE0 jour",
1855
+ "status.saved": "Enregistr\xE9 dans {label}, \xE0 chaque changement",
1843
1856
  "status.needsAttention": "Acc\xE8s \xE0 retrouver",
1844
1857
  "status.locked": "Sauvegarde verrouill\xE9e",
1845
1858
  "status.pendingDownload": "Modifications \xE0 exporter",
1859
+ "status.saved.placeless": "Sauvegarde \xE0 jour",
1846
1860
  "status.action.choose-destination": "Choisir une sauvegarde",
1847
1861
  "status.action.download": "Exporter",
1848
1862
  "status.action.reconnect": "Retrouver l'acc\xE8s",
@@ -1912,7 +1926,12 @@ var SelfstoreStatusElement = class extends FlowWidget {
1912
1926
  const host = this.host();
1913
1927
  if (!host) return;
1914
1928
  const { status, targetKind, label } = host.engine.state;
1915
- const text = this.t(status.labelKey);
1929
+ const sansLieu = (cle) => {
1930
+ const jumelle = `${cle}.placeless`;
1931
+ const copie = this.t(jumelle);
1932
+ return copie === jumelle ? this.t(cle) : copie;
1933
+ };
1934
+ const text = label ? this.t(status.labelKey, { label }) : sansLieu(status.labelKey);
1916
1935
  const dot = h("span", {
1917
1936
  part: `status-dot sev-${status.severity}`,
1918
1937
  "aria-hidden": "true"