Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
Language packs live in the FILE only — drop "on this computer"
nyblnet59a6505043ae
diff --git a/slides/src/editor/editor.ts b/slides/src/editor/editor.tsindex f527610c..aa312d53 100644--- a/slides/src/editor/editor.ts+++ b/slides/src/editor/editor.ts@@ -24,7 +24,7 @@ import { openSpeakerWindow, speakerIdleBody } from '../screens'import { borderPoint, boxCenter, lineEndpoints, setLineEndpoints, sideMidpoint } from './lineedit'import { ICONS } from '../icons'import { t, setLocale, locale, localeChoices, LOCALE_CHOICES } from '../i18n'-import { availablePacks, fetchPack, installPack, installedPacks, packsInFile, stageForFile, uninstallPack, unstageFromFile } from '../packs'+import { availablePacks, fetchPack, packsInFile, stageForFile, unstageFromFile } from '../packs'import { appConfig } from '../../../kernel/src/app.ts'import { disconnectOnline, joinFromDoc, mintCollab, mintInvite, onlineTransport, rotateKeys, sharingOn, startSharing, stopSharing } from '../sync/online'@@ -1012,7 +1012,6 @@ export class Editor {const paint = async () => {listHost.textContent = ''- const installed = installedPacks()const bundled = LOCALE_CHOICES.filter((c) => c.code !== 'en')const section = (label: string, blurb: string) => {@@ -1060,32 +1059,8 @@ export class Editor {)}- section(- t('On this computer'),- t('This browser only, for every deck you open here. Files you send stay unchanged.'),- )- if (!installed.length) {- const none = div('ed-hint')- none.textContent = t('None yet — add one below.')- listHost.appendChild(none)- }- for (const p of installed) {- const rm = document.createElement('button')- rm.className = 'ed-btn'- rm.textContent = t('Remove')- rm.title = t('Remove from this computer')- rm.addEventListener('click', () => {- uninstallPack(p.lang)- // the active locale may have just vanished — rebuild everything- this.build()- this.rebuildSidebar()- void paint()- })- row(p.label || p.lang, p.version ? t('Language pack · built for v{v}', { v: p.version }) : t('Language pack'), [rm])- }-const all = await availablePacks()- section(t('Available to add'), t('Choose where it goes: just for you, or into the deck so it travels.'))+ section(t('Available to add'), t('Goes into the deck itself, so it travels with the file. Written when you next save.'))if (!all.length) {const none = div('ed-hint')none.textContent = t('Nothing new right now.')@@ -1124,55 +1099,30 @@ export class Editor {for (const p of hits) addRow(p, scroller)}- // Two destinations, labelled with the SAME words as the sections above,- // so the button says where the language will end up. Nobody should have- // to install a language locally just to put it in a file they are- // sending to someone else.+ // One destination. A pack lives in the FILE — see packs.ts for why the+ // "on this computer" option was removed rather than kept alongside.const addRow = (p: import('../packs').PackListing, host: HTMLElement) => {- const mk = (label: string, title: string, run: () => Promise<string | null>) => {- const b = document.createElement('button')- b.className = 'ed-btn'- b.textContent = label- b.title = title- b.addEventListener('click', async () => {- const siblings = [...(b.parentElement?.children ?? [])] as HTMLButtonElement[]- siblings.forEach((s) => (s.disabled = true))- b.textContent = t('Adding…')- const err = await run()- if (err) {- this.toast(languageInstallError(err as 'offline'))- siblings.forEach((s) => (s.disabled = false))- b.textContent = label- return- }- this.build()- this.rebuildSidebar()- void paint()- })- return b- }-- const toComputer = mk(- t('This computer'),- t('Download and use here. The deck itself is not changed.'),- async () => {- const err = await installPack(p)- if (!err) this.toast(t('{lang} is ready to use', { lang: p.label }))- return err- },- )- const toFile = mk(- t('This file'),- t('Put it in the deck so it travels — written when you next save.'),- async () => {- const err = await fetchPack(p)- if (typeof err === 'string') return err- stageForFile(err)- this.toast(t('{lang} will be saved with this deck', { lang: p.label }))- return null- },- )- row(p.label, p.lang, [toComputer, toFile], host)+ const add = document.createElement('button')+ add.className = 'ed-btn'+ add.textContent = t('Add')+ add.title = t('Put it in the deck — written when you next save.')+ add.addEventListener('click', async () => {+ add.disabled = true+ add.textContent = t('Adding…')+ const got = await fetchPack(p)+ if (typeof got === 'string') {+ this.toast(languageInstallError(got))+ add.disabled = false+ add.textContent = t('Add')+ return+ }+ stageForFile(got)+ this.toast(t('{lang} will be saved with this deck', { lang: p.label }))+ this.build()+ this.rebuildSidebar()+ void paint()+ })+ row(p.label, p.lang, [add], host)}renderAvail()@@ -2516,7 +2466,7 @@ export class Editor {* Turn a pack-install failure into a sentence. Built at display time because* t() must never be frozen into a module-level const.*/-function languageInstallError(code: 'offline' | 'bad-pack' | 'wrong-app' | 'no-space'): string {+function languageInstallError(code: 'offline' | 'bad-pack' | 'wrong-app'): string {switch (code) {case 'offline':return t('Couldn’t download that language — check your connection and try again.')@@ -2524,8 +2474,6 @@ function languageInstallError(code: 'offline' | 'bad-pack' | 'wrong-app' | 'no-sreturn t('That language pack couldn’t be read.')case 'wrong-app':return t('That language pack was built for a different Bento app.')- case 'no-space':- return t('It works now, but there’s no room to save it here — it will be gone after a reload.')}}diff --git a/slides/src/i18n.ts b/slides/src/i18n.tsindex 90d2de79..d0704d95 100644--- a/slides/src/i18n.ts+++ b/slides/src/i18n.ts@@ -18,7 +18,7 @@// node scripts/build-i18n.mjs//import { PACKED, PACKED_LOCALES } from './i18n/packed'-import { readPacksFromShell, restoreInstalledPacks, shellBlocksForPacks } from './packs'+import { readPacksFromShell, shellBlocksForPacks } from './packs'import { registerShellBlocks } from '../../kernel/src/save.ts'import { registerI18n } from '../../kernel/src/i18n.ts'import type { LocaleChoice } from '../../kernel/src/i18n.ts'@@ -57,14 +57,10 @@ registerI18n({choices: CHOICES,})-// Packs, re-registered before the first t() — same module-evaluation-order-// guarantee that makes the facade own registration.-//-// FILE FIRST, then browser. A pack embedded in the deck is what its author-// chose to send; a locally installed one is the reader's own preference, and-// the reader should win when both carry the same language.+// Packs embedded in this file, registered before the first t() — the same+// module-evaluation-order guarantee that makes the facade own registration.+// A pack lives in the FILE and nowhere else (see ./packs.ts for why).readPacksFromShell()-restoreInstalledPacks()// Every save re-declares the file's packs, so staging one is enough to make// it travel and dropping it is enough to remove it.diff --git a/slides/src/i18n/de.ts b/slides/src/i18n/de.tsindex 863601ac..3b21716a 100644--- a/slides/src/i18n/de.ts+++ b/slides/src/i18n/de.ts@@ -680,27 +680,15 @@ export const de: Catalog = {"In this file": "In dieser Datei","Travels with the deck — anyone you send it to gets these too.": "Reist mit der Präsentation — wer sie von dir bekommt, hat sie auch.","Included in every Bento": "In jedem Bento enthalten",- "On this computer": "Auf diesem Computer",- "This browser only, for every deck you open here. Files you send stay unchanged.": "Nur in diesem Browser, für jede Präsentation, die du hier öffnest. Verschickte Dateien bleiben unverändert.",- "None yet — add one below.": "Noch keine — füge unten eine hinzu.",- "Remove from this computer": "Von diesem Computer entfernen",- "Language pack · built for v{v}": "Sprachpaket · für v{v}",- "Language pack": "Sprachpaket",- "Adding one puts it on this computer. New languages arrive with each release.": "Hinzufügen installiert die Sprache auf diesem Computer. Mit jeder Version kommen neue dazu.","Nothing new right now.": "Derzeit nichts Neues.","Download and use on this computer — the deck itself is not changed": "Herunterladen und auf diesem Computer verwenden — die Präsentation wird nicht verändert",- "{lang} is ready to use": "{lang} steht jetzt bereit","Couldn’t download that language — check your connection and try again.": "Diese Sprache konnte nicht geladen werden — prüfe deine Verbindung und versuche es erneut.",- "It works now, but there’s no room to save it here — it will be gone after a reload.": "Es funktioniert jetzt, aber hier ist kein Platz zum Speichern — nach dem Neuladen ist es weg.","Search languages": "Sprachen suchen","No language matches “{q}”.": "Keine Sprache passt zu „{q}“.",- "This computer": "Dieser Computer",- "This file": "Diese Datei",- "Download and use here. The deck itself is not changed.": "Herunterladen und hier verwenden. Die Präsentation wird nicht verändert.",- "Put it in the deck so it travels — written when you next save.": "In die Präsentation legen, damit sie mitreist — wird beim nächsten Speichern geschrieben.","{lang} will be saved with this deck": "{lang} wird mit dieser Präsentation gespeichert","Added when you next save": "Wird beim nächsten Speichern hinzugefügt","Saved in this file": "In dieser Datei gespeichert","Take out of the file — applies when you next save": "Aus der Datei entfernen — gilt ab dem nächsten Speichern",- "Choose where it goes: just for you, or into the deck so it travels.": "Wähle das Ziel: nur für dich, oder in der Präsentation, damit sie mitreist.",+ "Goes into the deck itself, so it travels with the file. Written when you next save.": "Kommt in die Präsentation selbst und reist mit der Datei mit. Wird beim nächsten Speichern geschrieben.",+ "Put it in the deck — written when you next save.": "In die Präsentation legen — wird beim nächsten Speichern geschrieben.",}diff --git a/slides/src/i18n/es.ts b/slides/src/i18n/es.tsindex e4a7a6a6..866f0a20 100644--- a/slides/src/i18n/es.ts+++ b/slides/src/i18n/es.ts@@ -680,27 +680,15 @@ export const es: Catalog = {"In this file": "En este archivo","Travels with the deck — anyone you send it to gets these too.": "Viaja con la presentación: quien la reciba también los tendrá.","Included in every Bento": "Incluidos en todos los Bento",- "On this computer": "En este equipo",- "This browser only, for every deck you open here. Files you send stay unchanged.": "Solo en este navegador, para todas las presentaciones que abras aquí. Los archivos que envías no cambian.",- "None yet — add one below.": "Ninguno todavía: añade uno abajo.",- "Remove from this computer": "Quitar de este equipo",- "Language pack · built for v{v}": "Paquete de idioma · para la v{v}",- "Language pack": "Paquete de idioma",- "Adding one puts it on this computer. New languages arrive with each release.": "Al añadir uno se instala en este equipo. Con cada versión llegan nuevos idiomas.","Nothing new right now.": "Nada nuevo por ahora.","Download and use on this computer — the deck itself is not changed": "Descargar y usar en este equipo: la presentación no se modifica",- "{lang} is ready to use": "{lang} ya está disponible","Couldn’t download that language — check your connection and try again.": "No se pudo descargar ese idioma: comprueba tu conexión e inténtalo de nuevo.",- "It works now, but there’s no room to save it here — it will be gone after a reload.": "Funciona ahora, pero no hay espacio para guardarlo aquí: desaparecerá al recargar.","Search languages": "Buscar idiomas","No language matches “{q}”.": "Ningún idioma coincide con «{q}».",- "This computer": "Este equipo",- "This file": "Este archivo",- "Download and use here. The deck itself is not changed.": "Descargar y usar aquí. La presentación no se modifica.",- "Put it in the deck so it travels — written when you next save.": "Ponerlo en la presentación para que viaje: se escribe al guardar.","{lang} will be saved with this deck": "{lang} se guardará con esta presentación","Added when you next save": "Se añadirá al guardar","Saved in this file": "Guardado en este archivo","Take out of the file — applies when you next save": "Quitar del archivo: se aplica al guardar",- "Choose where it goes: just for you, or into the deck so it travels.": "Elige dónde va: solo para ti, o dentro de la presentación para que viaje.",+ "Goes into the deck itself, so it travels with the file. Written when you next save.": "Va dentro de la presentación, así viaja con el archivo. Se escribe al guardar.",+ "Put it in the deck — written when you next save.": "Ponerlo en la presentación: se escribe al guardar.",}diff --git a/slides/src/i18n/fr.ts b/slides/src/i18n/fr.tsindex 31c6a76c..2372d38a 100644--- a/slides/src/i18n/fr.ts+++ b/slides/src/i18n/fr.ts@@ -680,27 +680,15 @@ export const fr: Catalog = {"In this file": "Dans ce fichier","Travels with the deck — anyone you send it to gets these too.": "Voyage avec la présentation — les personnes à qui vous l’envoyez les ont aussi.","Included in every Bento": "Incluses dans chaque Bento",- "On this computer": "Sur cet ordinateur",- "This browser only, for every deck you open here. Files you send stay unchanged.": "Ce navigateur uniquement, pour toutes les présentations ouvertes ici. Les fichiers envoyés restent inchangés.",- "None yet — add one below.": "Aucune pour l’instant — ajoutez-en une ci-dessous.",- "Remove from this computer": "Retirer de cet ordinateur",- "Language pack · built for v{v}": "Pack de langue · pour la v{v}",- "Language pack": "Pack de langue",- "Adding one puts it on this computer. New languages arrive with each release.": "En ajouter une l’installe sur cet ordinateur. De nouvelles langues arrivent à chaque version.","Nothing new right now.": "Rien de nouveau pour l’instant.","Download and use on this computer — the deck itself is not changed": "Télécharger et utiliser sur cet ordinateur — la présentation n’est pas modifiée",- "{lang} is ready to use": "{lang} est prêt à l’emploi","Couldn’t download that language — check your connection and try again.": "Impossible de télécharger cette langue — vérifiez votre connexion et réessayez.",- "It works now, but there’s no room to save it here — it will be gone after a reload.": "Cela fonctionne pour l’instant, mais il n’y a pas de place pour l’enregistrer ici — ce sera perdu au rechargement.","Search languages": "Rechercher des langues","No language matches “{q}”.": "Aucune langue ne correspond à « {q} ».",- "This computer": "Cet ordinateur",- "This file": "Ce fichier",- "Download and use here. The deck itself is not changed.": "Télécharger et utiliser ici. La présentation n’est pas modifiée.",- "Put it in the deck so it travels — written when you next save.": "La placer dans la présentation pour qu’elle voyage — écrite au prochain enregistrement.","{lang} will be saved with this deck": "{lang} sera enregistré avec cette présentation","Added when you next save": "Ajouté au prochain enregistrement","Saved in this file": "Enregistré dans ce fichier","Take out of the file — applies when you next save": "Retirer du fichier — appliqué au prochain enregistrement",- "Choose where it goes: just for you, or into the deck so it travels.": "Choisissez la destination : pour vous seul, ou dans la présentation pour qu’elle voyage.",+ "Goes into the deck itself, so it travels with the file. Written when you next save.": "Va dans la présentation elle-même, pour voyager avec le fichier. Écrite au prochain enregistrement.",+ "Put it in the deck — written when you next save.": "La placer dans la présentation — écrite au prochain enregistrement.",}diff --git a/slides/src/i18n/it.ts b/slides/src/i18n/it.tsindex 7af787e5..c4e9354a 100644--- a/slides/src/i18n/it.ts+++ b/slides/src/i18n/it.ts@@ -680,27 +680,15 @@ export const it: Catalog = {"In this file": "In questo file","Travels with the deck — anyone you send it to gets these too.": "Viaggia con la presentazione — chi la riceve le ha anche lui.","Included in every Bento": "Incluse in ogni Bento",- "On this computer": "Su questo computer",- "This browser only, for every deck you open here. Files you send stay unchanged.": "Solo in questo browser, per ogni presentazione che apri qui. I file che invii restano invariati.",- "None yet — add one below.": "Ancora nessuna — aggiungine una qui sotto.",- "Remove from this computer": "Rimuovi da questo computer",- "Language pack · built for v{v}": "Pacchetto lingua · per la v{v}",- "Language pack": "Pacchetto lingua",- "Adding one puts it on this computer. New languages arrive with each release.": "Aggiungerne una la installa su questo computer. Nuove lingue arrivano a ogni versione.","Nothing new right now.": "Nulla di nuovo per ora.","Download and use on this computer — the deck itself is not changed": "Scarica e usa su questo computer — la presentazione non viene modificata",- "{lang} is ready to use": "{lang} è pronta all’uso","Couldn’t download that language — check your connection and try again.": "Non è stato possibile scaricare quella lingua — controlla la connessione e riprova.",- "It works now, but there’s no room to save it here — it will be gone after a reload.": "Funziona adesso, ma non c’è spazio per salvarla qui — sparirà al ricaricamento.","Search languages": "Cerca lingue","No language matches “{q}”.": "Nessuna lingua corrisponde a «{q}».",- "This computer": "Questo computer",- "This file": "Questo file",- "Download and use here. The deck itself is not changed.": "Scarica e usa qui. La presentazione non viene modificata.",- "Put it in the deck so it travels — written when you next save.": "Mettila nella presentazione perché viaggi — scritta al prossimo salvataggio.","{lang} will be saved with this deck": "{lang} sarà salvata con questa presentazione","Added when you next save": "Aggiunta al prossimo salvataggio","Saved in this file": "Salvata in questo file","Take out of the file — applies when you next save": "Togli dal file — vale dal prossimo salvataggio",- "Choose where it goes: just for you, or into the deck so it travels.": "Scegli dove va: solo per te, o dentro la presentazione perché viaggi.",+ "Goes into the deck itself, so it travels with the file. Written when you next save.": "Va nella presentazione stessa, così viaggia con il file. Scritta al prossimo salvataggio.",+ "Put it in the deck — written when you next save.": "Mettila nella presentazione — scritta al prossimo salvataggio.",}diff --git a/slides/src/i18n/ja.ts b/slides/src/i18n/ja.tsindex 5de2766d..6780a96f 100644--- a/slides/src/i18n/ja.ts+++ b/slides/src/i18n/ja.ts@@ -680,27 +680,15 @@ export const ja: Catalog = {"In this file": "このファイル内","Travels with the deck — anyone you send it to gets these too.": "デッキと一緒に移動します — 送った相手にも表示されます。","Included in every Bento": "すべての Bento に同梱",- "On this computer": "このコンピューター",- "This browser only, for every deck you open here. Files you send stay unchanged.": "このブラウザーのみ。ここで開くすべてのデッキで使えます。送るファイルは変わりません。",- "None yet — add one below.": "まだありません — 下から追加できます。",- "Remove from this computer": "このコンピューターから削除",- "Language pack · built for v{v}": "言語パック · v{v} 用",- "Language pack": "言語パック",- "Adding one puts it on this computer. New languages arrive with each release.": "追加するとこのコンピューターに入ります。新しい言語はリリースごとに増えます。","Nothing new right now.": "今は新しいものはありません。","Download and use on this computer — the deck itself is not changed": "ダウンロードしてこのコンピューターで使用 — デッキ自体は変更されません",- "{lang} is ready to use": "{lang} を使えるようになりました","Couldn’t download that language — check your connection and try again.": "その言語をダウンロードできませんでした — 接続を確認してもう一度お試しください。",- "It works now, but there’s no room to save it here — it will be gone after a reload.": "今は使えますが、ここに保存する空き容量がありません — 再読み込みすると消えます。","Search languages": "言語を検索","No language matches “{q}”.": "「{q}」に一致する言語はありません。",- "This computer": "このコンピューター",- "This file": "このファイル",- "Download and use here. The deck itself is not changed.": "ダウンロードしてここで使用します。デッキ自体は変更されません。",- "Put it in the deck so it travels — written when you next save.": "デッキに入れて一緒に配布します — 次回の保存時に書き込まれます。","{lang} will be saved with this deck": "{lang} はこのデッキと一緒に保存されます","Added when you next save": "次回の保存時に追加","Saved in this file": "このファイルに保存済み","Take out of the file — applies when you next save": "ファイルから削除 — 次回の保存時に反映",- "Choose where it goes: just for you, or into the deck so it travels.": "保存先を選んでください: 自分用か、デッキに入れて一緒に配布するか。",+ "Goes into the deck itself, so it travels with the file. Written when you next save.": "デッキ自体に入り、ファイルと一緒に配布されます。次回の保存時に書き込まれます。",+ "Put it in the deck — written when you next save.": "デッキに入れます — 次回の保存時に書き込まれます。",}diff --git a/slides/src/i18n/packed.ts b/slides/src/i18n/packed.tsindex 6899b2a1..b54f3436 100644--- a/slides/src/i18n/packed.ts+++ b/slides/src/i18n/packed.ts@@ -686,27 +686,15 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"In this file": ["このファイル内","此文件内","此檔案內","En este archivo","Dans ce fichier","In dieser Datei","In questo file","Neste arquivo"],"Travels with the deck — anyone you send it to gets these too.": ["デッキと一緒に移動します — 送った相手にも表示されます。","随演示文稿一起传递 — 你发送给谁,谁就能看到。","隨簡報一起傳遞 — 你傳給誰,誰就能看到。","Viaja con la presentación: quien la reciba también los tendrá.","Voyage avec la présentation — les personnes à qui vous l’envoyez les ont aussi.","Reist mit der Präsentation — wer sie von dir bekommt, hat sie auch.","Viaggia con la presentazione — chi la riceve le ha anche lui.","Viaja com a apresentação — quem receber também terá esses idiomas."],"Included in every Bento": ["すべての Bento に同梱","每个 Bento 都内置","每個 Bento 都內建","Incluidos en todos los Bento","Incluses dans chaque Bento","In jedem Bento enthalten","Incluse in ogni Bento","Incluídos em todo Bento"],- "On this computer": ["このコンピューター","此计算机","此電腦","En este equipo","Sur cet ordinateur","Auf diesem Computer","Su questo computer","Neste computador"],- "This browser only, for every deck you open here. Files you send stay unchanged.": ["このブラウザーのみ。ここで開くすべてのデッキで使えます。送るファイルは変わりません。","仅限此浏览器,适用于你在这里打开的所有演示文稿。你发送的文件不会改变。","僅限此瀏覽器,適用於你在這裡開啟的所有簡報。你傳送的檔案不會改變。","Solo en este navegador, para todas las presentaciones que abras aquí. Los archivos que envías no cambian.","Ce navigateur uniquement, pour toutes les présentations ouvertes ici. Les fichiers envoyés restent inchangés.","Nur in diesem Browser, für jede Präsentation, die du hier öffnest. Verschickte Dateien bleiben unverändert.","Solo in questo browser, per ogni presentazione che apri qui. I file che invii restano invariati.","Apenas neste navegador, para toda apresentação que você abrir aqui. Os arquivos que você envia não mudam."],- "None yet — add one below.": ["まだありません — 下から追加できます。","还没有 — 可在下方添加。","尚未有任何語言 — 可在下方新增。","Ninguno todavía: añade uno abajo.","Aucune pour l’instant — ajoutez-en une ci-dessous.","Noch keine — füge unten eine hinzu.","Ancora nessuna — aggiungine una qui sotto.","Nenhum ainda — adicione um abaixo."],- "Remove from this computer": ["このコンピューターから削除","从此计算机移除","從此電腦移除","Quitar de este equipo","Retirer de cet ordinateur","Von diesem Computer entfernen","Rimuovi da questo computer","Remover deste computador"],- "Language pack · built for v{v}": ["言語パック · v{v} 用","语言包 · 适用于 v{v}","語言包 · 適用於 v{v}","Paquete de idioma · para la v{v}","Pack de langue · pour la v{v}","Sprachpaket · für v{v}","Pacchetto lingua · per la v{v}","Pacote de idioma · para a v{v}"],- "Language pack": ["言語パック","语言包","語言包","Paquete de idioma","Pack de langue","Sprachpaket","Pacchetto lingua","Pacote de idioma"],- "Adding one puts it on this computer. New languages arrive with each release.": ["追加するとこのコンピューターに入ります。新しい言語はリリースごとに増えます。","添加后会安装到此计算机。每次发布都会带来新语言。","新增後會安裝到此電腦。每次發布都會帶來新語言。","Al añadir uno se instala en este equipo. Con cada versión llegan nuevos idiomas.","En ajouter une l’installe sur cet ordinateur. De nouvelles langues arrivent à chaque version.","Hinzufügen installiert die Sprache auf diesem Computer. Mit jeder Version kommen neue dazu.","Aggiungerne una la installa su questo computer. Nuove lingue arrivano a ogni versione.","Adicionar um instala neste computador. Novos idiomas chegam a cada versão."],"Nothing new right now.": ["今は新しいものはありません。","目前没有新内容。","目前沒有新內容。","Nada nuevo por ahora.","Rien de nouveau pour l’instant.","Derzeit nichts Neues.","Nulla di nuovo per ora.","Nada novo por enquanto."],"Download and use on this computer — the deck itself is not changed": ["ダウンロードしてこのコンピューターで使用 — デッキ自体は変更されません","下载并在此计算机上使用 — 不会改动演示文稿本身","下載並在此電腦上使用 — 不會變更簡報本身","Descargar y usar en este equipo: la presentación no se modifica","Télécharger et utiliser sur cet ordinateur — la présentation n’est pas modifiée","Herunterladen und auf diesem Computer verwenden — die Präsentation wird nicht verändert","Scarica e usa su questo computer — la presentazione non viene modificata","Baixar e usar neste computador — a apresentação em si não é alterada"],- "{lang} is ready to use": ["{lang} を使えるようになりました","{lang} 已可使用","{lang} 已可使用","{lang} ya está disponible","{lang} est prêt à l’emploi","{lang} steht jetzt bereit","{lang} è pronta all’uso","{lang} está pronto para uso"],"Couldn’t download that language — check your connection and try again.": ["その言語をダウンロードできませんでした — 接続を確認してもう一度お試しください。","无法下载该语言 — 请检查网络后重试。","無法下載該語言 — 請檢查網路後再試一次。","No se pudo descargar ese idioma: comprueba tu conexión e inténtalo de nuevo.","Impossible de télécharger cette langue — vérifiez votre connexion et réessayez.","Diese Sprache konnte nicht geladen werden — prüfe deine Verbindung und versuche es erneut.","Non è stato possibile scaricare quella lingua — controlla la connessione e riprova.","Não foi possível baixar esse idioma — verifique sua conexão e tente de novo."],- "It works now, but there’s no room to save it here — it will be gone after a reload.": ["今は使えますが、ここに保存する空き容量がありません — 再読み込みすると消えます。","现在可以使用,但这里没有空间保存 — 重新加载后将会消失。","現在可以使用,但這裡沒有空間保存 — 重新載入後將會消失。","Funciona ahora, pero no hay espacio para guardarlo aquí: desaparecerá al recargar.","Cela fonctionne pour l’instant, mais il n’y a pas de place pour l’enregistrer ici — ce sera perdu au rechargement.","Es funktioniert jetzt, aber hier ist kein Platz zum Speichern — nach dem Neuladen ist es weg.","Funziona adesso, ma non c’è spazio per salvarla qui — sparirà al ricaricamento.","Funciona agora, mas não há espaço para salvar aqui — sumirá após recarregar."],"Search languages": ["言語を検索","搜索语言","搜尋語言","Buscar idiomas","Rechercher des langues","Sprachen suchen","Cerca lingue","Pesquisar idiomas"],"No language matches “{q}”.": ["「{q}」に一致する言語はありません。","没有与“{q}”匹配的语言。","沒有與「{q}」相符的語言。","Ningún idioma coincide con «{q}».","Aucune langue ne correspond à « {q} ».","Keine Sprache passt zu „{q}“.","Nessuna lingua corrisponde a «{q}».","Nenhum idioma corresponde a “{q}”."],- "This computer": ["このコンピューター","此计算机","此電腦","Este equipo","Cet ordinateur","Dieser Computer","Questo computer","Este computador"],- "This file": ["このファイル","此文件","此檔案","Este archivo","Ce fichier","Diese Datei","Questo file","Este arquivo"],- "Download and use here. The deck itself is not changed.": ["ダウンロードしてここで使用します。デッキ自体は変更されません。","下载并在此使用。不会改动演示文稿本身。","下載並在此使用。不會變更簡報本身。","Descargar y usar aquí. La presentación no se modifica.","Télécharger et utiliser ici. La présentation n’est pas modifiée.","Herunterladen und hier verwenden. Die Präsentation wird nicht verändert.","Scarica e usa qui. La presentazione non viene modificata.","Baixar e usar aqui. A apresentação em si não é alterada."],- "Put it in the deck so it travels — written when you next save.": ["デッキに入れて一緒に配布します — 次回の保存時に書き込まれます。","放入演示文稿一起传递 — 下次保存时写入。","放入簡報一起傳遞 — 下次儲存時寫入。","Ponerlo en la presentación para que viaje: se escribe al guardar.","La placer dans la présentation pour qu’elle voyage — écrite au prochain enregistrement.","In die Präsentation legen, damit sie mitreist — wird beim nächsten Speichern geschrieben.","Mettila nella presentazione perché viaggi — scritta al prossimo salvataggio.","Colocar na apresentação para viajar junto — gravado no próximo salvamento."],"{lang} will be saved with this deck": ["{lang} はこのデッキと一緒に保存されます","{lang} 将随此演示文稿一起保存","{lang} 將隨此簡報一起儲存","{lang} se guardará con esta presentación","{lang} sera enregistré avec cette présentation","{lang} wird mit dieser Präsentation gespeichert","{lang} sarà salvata con questa presentazione","{lang} será salvo com esta apresentação"],"Added when you next save": ["次回の保存時に追加","下次保存时添加","下次儲存時新增","Se añadirá al guardar","Ajouté au prochain enregistrement","Wird beim nächsten Speichern hinzugefügt","Aggiunta al prossimo salvataggio","Adicionado no próximo salvamento"],"Saved in this file": ["このファイルに保存済み","已保存在此文件中","已儲存在此檔案中","Guardado en este archivo","Enregistré dans ce fichier","In dieser Datei gespeichert","Salvata in questo file","Salvo neste arquivo"],"Take out of the file — applies when you next save": ["ファイルから削除 — 次回の保存時に反映","从文件中移除 — 下次保存时生效","從檔案中移除 — 下次儲存時生效","Quitar del archivo: se aplica al guardar","Retirer du fichier — appliqué au prochain enregistrement","Aus der Datei entfernen — gilt ab dem nächsten Speichern","Togli dal file — vale dal prossimo salvataggio","Tirar do arquivo — vale a partir do próximo salvamento"],- "Choose where it goes: just for you, or into the deck so it travels.": ["保存先を選んでください: 自分用か、デッキに入れて一緒に配布するか。","选择位置:仅供你使用,或放入演示文稿一起传递。","選擇位置:僅供你使用,或放入簡報一起傳遞。","Elige dónde va: solo para ti, o dentro de la presentación para que viaje.","Choisissez la destination : pour vous seul, ou dans la présentation pour qu’elle voyage.","Wähle das Ziel: nur für dich, oder in der Präsentation, damit sie mitreist.","Scegli dove va: solo per te, o dentro la presentazione perché viaggi.","Escolha o destino: só para você, ou dentro da apresentação para viajar junto."],+ "Goes into the deck itself, so it travels with the file. Written when you next save.": ["デッキ自体に入り、ファイルと一緒に配布されます。次回の保存時に書き込まれます。","放入演示文稿本身,随文件一起传递。下次保存时写入。","放入簡報本身,隨檔案一起傳遞。下次儲存時寫入。","Va dentro de la presentación, así viaja con el archivo. Se escribe al guardar.","Va dans la présentation elle-même, pour voyager avec le fichier. Écrite au prochain enregistrement.","Kommt in die Präsentation selbst und reist mit der Datei mit. Wird beim nächsten Speichern geschrieben.","Va nella presentazione stessa, così viaggia con il file. Scritta al prossimo salvataggio.","Vai para dentro da apresentação, então viaja com o arquivo. Gravado no próximo salvamento."],+ "Put it in the deck — written when you next save.": ["デッキに入れます — 次回の保存時に書き込まれます。","放入演示文稿 — 下次保存时写入。","放入簡報 — 下次儲存時寫入。","Ponerlo en la presentación: se escribe al guardar.","La placer dans la présentation — écrite au prochain enregistrement.","In die Präsentation legen — wird beim nächsten Speichern geschrieben.","Mettila nella presentazione — scritta al prossimo salvataggio.","Colocar na apresentação — gravado no próximo salvamento."],}diff --git a/slides/src/i18n/pt.ts b/slides/src/i18n/pt.tsindex 659afb01..1e3cab67 100644--- a/slides/src/i18n/pt.ts+++ b/slides/src/i18n/pt.ts@@ -678,27 +678,15 @@ export const pt: Catalog = {"In this file": "Neste arquivo","Travels with the deck — anyone you send it to gets these too.": "Viaja com a apresentação — quem receber também terá esses idiomas.","Included in every Bento": "Incluídos em todo Bento",- "On this computer": "Neste computador",- "This browser only, for every deck you open here. Files you send stay unchanged.": "Apenas neste navegador, para toda apresentação que você abrir aqui. Os arquivos que você envia não mudam.",- "None yet — add one below.": "Nenhum ainda — adicione um abaixo.",- "Remove from this computer": "Remover deste computador",- "Language pack · built for v{v}": "Pacote de idioma · para a v{v}",- "Language pack": "Pacote de idioma",- "Adding one puts it on this computer. New languages arrive with each release.": "Adicionar um instala neste computador. Novos idiomas chegam a cada versão.","Nothing new right now.": "Nada novo por enquanto.","Download and use on this computer — the deck itself is not changed": "Baixar e usar neste computador — a apresentação em si não é alterada",- "{lang} is ready to use": "{lang} está pronto para uso","Couldn’t download that language — check your connection and try again.": "Não foi possível baixar esse idioma — verifique sua conexão e tente de novo.",- "It works now, but there’s no room to save it here — it will be gone after a reload.": "Funciona agora, mas não há espaço para salvar aqui — sumirá após recarregar.","Search languages": "Pesquisar idiomas","No language matches “{q}”.": "Nenhum idioma corresponde a “{q}”.",- "This computer": "Este computador",- "This file": "Este arquivo",- "Download and use here. The deck itself is not changed.": "Baixar e usar aqui. A apresentação em si não é alterada.",- "Put it in the deck so it travels — written when you next save.": "Colocar na apresentação para viajar junto — gravado no próximo salvamento.","{lang} will be saved with this deck": "{lang} será salvo com esta apresentação","Added when you next save": "Adicionado no próximo salvamento","Saved in this file": "Salvo neste arquivo","Take out of the file — applies when you next save": "Tirar do arquivo — vale a partir do próximo salvamento",- "Choose where it goes: just for you, or into the deck so it travels.": "Escolha o destino: só para você, ou dentro da apresentação para viajar junto.",+ "Goes into the deck itself, so it travels with the file. Written when you next save.": "Vai para dentro da apresentação, então viaja com o arquivo. Gravado no próximo salvamento.",+ "Put it in the deck — written when you next save.": "Colocar na apresentação — gravado no próximo salvamento.",}diff --git a/slides/src/i18n/zh-Hans.ts b/slides/src/i18n/zh-Hans.tsindex dffff934..6ce74aa2 100644--- a/slides/src/i18n/zh-Hans.ts+++ b/slides/src/i18n/zh-Hans.ts@@ -680,27 +680,15 @@ export const zhHans: Catalog = {"In this file": "此文件内","Travels with the deck — anyone you send it to gets these too.": "随演示文稿一起传递 — 你发送给谁,谁就能看到。","Included in every Bento": "每个 Bento 都内置",- "On this computer": "此计算机",- "This browser only, for every deck you open here. Files you send stay unchanged.": "仅限此浏览器,适用于你在这里打开的所有演示文稿。你发送的文件不会改变。",- "None yet — add one below.": "还没有 — 可在下方添加。",- "Remove from this computer": "从此计算机移除",- "Language pack · built for v{v}": "语言包 · 适用于 v{v}",- "Language pack": "语言包",- "Adding one puts it on this computer. New languages arrive with each release.": "添加后会安装到此计算机。每次发布都会带来新语言。","Nothing new right now.": "目前没有新内容。","Download and use on this computer — the deck itself is not changed": "下载并在此计算机上使用 — 不会改动演示文稿本身",- "{lang} is ready to use": "{lang} 已可使用","Couldn’t download that language — check your connection and try again.": "无法下载该语言 — 请检查网络后重试。",- "It works now, but there’s no room to save it here — it will be gone after a reload.": "现在可以使用,但这里没有空间保存 — 重新加载后将会消失。","Search languages": "搜索语言","No language matches “{q}”.": "没有与“{q}”匹配的语言。",- "This computer": "此计算机",- "This file": "此文件",- "Download and use here. The deck itself is not changed.": "下载并在此使用。不会改动演示文稿本身。",- "Put it in the deck so it travels — written when you next save.": "放入演示文稿一起传递 — 下次保存时写入。","{lang} will be saved with this deck": "{lang} 将随此演示文稿一起保存","Added when you next save": "下次保存时添加","Saved in this file": "已保存在此文件中","Take out of the file — applies when you next save": "从文件中移除 — 下次保存时生效",- "Choose where it goes: just for you, or into the deck so it travels.": "选择位置:仅供你使用,或放入演示文稿一起传递。",+ "Goes into the deck itself, so it travels with the file. Written when you next save.": "放入演示文稿本身,随文件一起传递。下次保存时写入。",+ "Put it in the deck — written when you next save.": "放入演示文稿 — 下次保存时写入。",}diff --git a/slides/src/i18n/zh-Hant.ts b/slides/src/i18n/zh-Hant.tsindex 1bf5a886..7fa57da8 100644--- a/slides/src/i18n/zh-Hant.ts+++ b/slides/src/i18n/zh-Hant.ts@@ -680,27 +680,15 @@ export const zhHant: Catalog = {"In this file": "此檔案內","Travels with the deck — anyone you send it to gets these too.": "隨簡報一起傳遞 — 你傳給誰,誰就能看到。","Included in every Bento": "每個 Bento 都內建",- "On this computer": "此電腦",- "This browser only, for every deck you open here. Files you send stay unchanged.": "僅限此瀏覽器,適用於你在這裡開啟的所有簡報。你傳送的檔案不會改變。",- "None yet — add one below.": "尚未有任何語言 — 可在下方新增。",- "Remove from this computer": "從此電腦移除",- "Language pack · built for v{v}": "語言包 · 適用於 v{v}",- "Language pack": "語言包",- "Adding one puts it on this computer. New languages arrive with each release.": "新增後會安裝到此電腦。每次發布都會帶來新語言。","Nothing new right now.": "目前沒有新內容。","Download and use on this computer — the deck itself is not changed": "下載並在此電腦上使用 — 不會變更簡報本身",- "{lang} is ready to use": "{lang} 已可使用","Couldn’t download that language — check your connection and try again.": "無法下載該語言 — 請檢查網路後再試一次。",- "It works now, but there’s no room to save it here — it will be gone after a reload.": "現在可以使用,但這裡沒有空間保存 — 重新載入後將會消失。","Search languages": "搜尋語言","No language matches “{q}”.": "沒有與「{q}」相符的語言。",- "This computer": "此電腦",- "This file": "此檔案",- "Download and use here. The deck itself is not changed.": "下載並在此使用。不會變更簡報本身。",- "Put it in the deck so it travels — written when you next save.": "放入簡報一起傳遞 — 下次儲存時寫入。","{lang} will be saved with this deck": "{lang} 將隨此簡報一起儲存","Added when you next save": "下次儲存時新增","Saved in this file": "已儲存在此檔案中","Take out of the file — applies when you next save": "從檔案中移除 — 下次儲存時生效",- "Choose where it goes: just for you, or into the deck so it travels.": "選擇位置:僅供你使用,或放入簡報一起傳遞。",+ "Goes into the deck itself, so it travels with the file. Written when you next save.": "放入簡報本身,隨檔案一起傳遞。下次儲存時寫入。",+ "Put it in the deck — written when you next save.": "放入簡報 — 下次儲存時寫入。",}diff --git a/slides/src/packs.ts b/slides/src/packs.tsindex e871cc0f..7d6ef07c 100644--- a/slides/src/packs.ts+++ b/slides/src/packs.ts@@ -1,31 +1,31 @@// SPDX-License-Identifier: MIT// Copyright (c) 2026 The Bento authors-// Installing and removing language packs at runtime (docs/i18n-packs.md).+// Language packs (docs/i18n-packs.md): fetching them, and carrying them in+// the file.//-// WHERE AN INSTALLED PACK LIVES. In localStorage, not in the document.-// PLATFORM.md §3 is explicit that language never enters the document format —-// a deck authored in Tokyo opens with French chrome in Paris — and the locale-// preference itself is already a per-browser setting. A pack is the same kind-// of thing: it belongs to the reader, not to the file.+// A PACK LIVES IN THE FILE. Nowhere else.//-// That also makes install cheap and reversible: no shell re-splice, no new-// file, no touching a document the user may not even own. Making a pack travel-// WITH a file is a separate, heavier operation (re-splice on save) and is not-// what "add a language" should mean.+// An earlier version of this also let a pack be installed into localStorage+// "on this computer". It was removed, because localStorage is scoped per+// ORIGIN and that is fatally misaligned with how Bento is actually used: the+// download comes from bento.page (an https origin), and the file is then+// opened from disk (a file:// origin). A language added on the website was+// therefore GONE the moment the user saved the deck and reopened it locally —+// the exact journey the product encourages. "I added Korean and it vanished"+// is not a bug a user can diagnose, and no amount of wording fixes it.//-// Packs are ~60KB of JSON each. localStorage gives a few MB, so a handful is-// fine; a quota failure is caught and surfaced rather than left to throw.+// Keeping one home also matches the rest of Bento: the file IS the software,+// so a language belongs to the deck. The trade is that adding a language+// requires saving the file — which the UI states plainly rather than hiding.import { addPack, removePack, type LanguagePack } from '../../kernel/src/i18n.ts'import { readShellBlocks, type ShellBlock } from '../../kernel/src/save.ts'-/** Installed packs, keyed by language. */-const KEY = 'bento-packs'/*** Where the release channel publishes the pack index and the packs.* Dev override: localStorage 'bento-packs-url' — the same convention the* updater uses for 'bento-update-url', so a local channel can be pointed at- * without a rebuild.+ * without a rebuild. (A URL, not pack data: nothing durable lives here.)*/const channel = (): string =>localStorage.getItem('bento-packs-url') ?? 'https://bento.page/releases/slides'@@ -39,99 +39,7 @@ export interface PackListing {version?: string}-type Store = Record<string, LanguagePack>--function read(): Store {- try {- const raw = localStorage.getItem(KEY)- return raw ? (JSON.parse(raw) as Store) : {}- } catch {- return {} // corrupt or unavailable — behave as if nothing is installed- }-}--function write(s: Store): string | null {- try {- localStorage.setItem(KEY, JSON.stringify(s))- return null- } catch {- // quota is the realistic failure: a pack is ~60KB and the budget is shared- return 'no-space'- }-}--/**- * Re-register everything previously installed. Called at boot from the i18n- * facade, BEFORE the first t() — same reason the facade owns registration.- */-export function restoreInstalledPacks(): number {- const s = read()- let n = 0- for (const pack of Object.values(s)) {- if (addPack(pack, 'slides')) n++- }- return n-}--/** Languages installed from a pack on this browser. */-export function installedPacks(): LanguagePack[] {- return Object.values(read())-}--/**- * Fetch and install a pack. Returns null on success, else a reason the caller- * can turn into a sentence (t() must run at display time, so no text crosses- * this boundary — same contract as SyncNotice).- */-export type PackError = 'offline' | 'bad-pack' | 'wrong-app' | 'no-space'--/**- * Download and validate a pack WITHOUT deciding where it goes. Both- * destinations — this computer, or into the file — start here, which is what- * lets a language be put in a file without first installing it locally.- */-export async function fetchPack(listing: PackListing): Promise<LanguagePack | PackError> {- const url = /^https?:/.test(listing.url) ? listing.url : `${channel()}/${listing.url}`- let pack: LanguagePack- try {- const res = await fetch(url, { cache: 'no-store' })- if (!res.ok) return 'offline'- pack = (await res.json()) as LanguagePack- } catch {- return 'offline' // no network, blocked, or not JSON- }- if (!pack?.lang || !pack.strings || typeof pack.strings !== 'object') return 'bad-pack'- if (pack.app && pack.app !== 'slides') return 'wrong-app'- return pack-}--export async function installPack(listing: PackListing): Promise<null | PackError> {- const got = await fetchPack(listing)- if (typeof got === 'string') return got- const pack = got- if (!addPack(pack, 'slides')) return 'wrong-app'-- const s = read()- s[pack.lang] = pack- const err = write(s)- if (err) {- // registered but not persisted: it works now and is gone after a reload.- // Better to say so than to pretend it stuck.- return 'no-space'- }- return null-}--// --- packs that live IN THE FILE ---------------------------------------------//-// The other half of the story. A pack installed above belongs to the reader;-// a pack in the file belongs to the DECK and travels to whoever opens it.-//-// Staging is deliberate rather than immediate: adding one marks it for the-// file and it is written on the next save, exactly like any other edit. The-// alternative — writing the user's file the instant they click Add — is worse-// on every browser without File System Access, where "write" means silently-// downloading a second copy of their deck.+export type PackError = 'offline' | 'bad-pack' | 'wrong-app'/** The block type carrying a pack inside a saved shell. */const BLOCK_TYPE = 'application/bento+lang'@@ -144,8 +52,8 @@ const pending = new Set<string>()/*** Read packs already embedded in this file and register them. Runs at boot- * from the i18n facade: a deck that arrives carrying Japanese must show- * Japanese immediately, offline, with nothing fetched.+ * from the i18n facade, before the first t(): a deck that arrives carrying+ * Japanese must show Japanese immediately, offline, with nothing fetched.*/export function readPacksFromShell(): number {let n = 0@@ -163,17 +71,34 @@ export function readPacksFromShell(): number {return n}-/** Packs that will be written into the file on the next save. */+/** Packs in the file, flagged if they are still waiting for a save. */export function packsInFile(): Array<LanguagePack & { pending: boolean }> {return [...inFile.values()].map((p) => ({ ...p, pending: pending.has(p.lang) }))}-/** Is this language waiting for a save to reach the file? */-export const isPendingInFile = (lang: string): boolean => pending.has(lang)+/** Download and validate a pack. Does not decide where it goes. */+export async function fetchPack(listing: PackListing): Promise<LanguagePack | PackError> {+ const url = /^https?:/.test(listing.url) ? listing.url : `${channel()}/${listing.url}`+ let pack: LanguagePack+ try {+ const res = await fetch(url, { cache: 'no-store' })+ if (!res.ok) return 'offline'+ pack = (await res.json()) as LanguagePack+ } catch {+ return 'offline' // no network, blocked, or not JSON+ }+ if (!pack?.lang || !pack.strings || typeof pack.strings !== 'object') return 'bad-pack'+ if (pack.app && pack.app !== 'slides') return 'wrong-app'+ return pack+}/**- * Mark a pack for inclusion in the file. Registers it immediately so the- * editor can use it right away; the FILE only gains it on the next save.+ * Put a pack in the file. Registers it immediately so the editor can use it+ * right away; the FILE gains it on the next save.+ *+ * Staged rather than written-on-click because on every browser without File+ * System Access "write" means silently downloading a second copy of the+ * user's deck — a surprising thing to do to someone who asked for a language.*/export function stageForFile(pack: LanguagePack): boolean {if (!pack?.lang || !pack.strings) return false@@ -183,16 +108,12 @@ export function stageForFile(pack: LanguagePack): boolean {return true}-/**- * Drop a pack from the file. Also a staged change: the file keeps it until- * the next save, which is why this marks pending too.- */+/** Take a pack out of the file — also applied on the next save. */export function unstageFromFile(lang: string): boolean {if (!inFile.has(lang)) return falseinFile.delete(lang)pending.add(lang)- // only unregister if no local install is also providing it- if (!read()[lang]) removePack(lang)+ removePack(lang)return true}@@ -211,18 +132,8 @@ export function shellBlocksForPacks(): ShellBlock[] {}))}-/** Remove an installed pack and forget it. */-export function uninstallPack(lang: string): boolean {- const s = read()- if (!s[lang]) return false- delete s[lang]- write(s)- removePack(lang)- return true-}-/**- * Packs on offer from the release channel, minus the ones already installed.+ * Packs on offer from the release channel, minus those the file already has.* Returns [] when the index isn't published yet or the network is unavailable* — "no packs to offer" is a normal state, not an error worth shouting about.*/@@ -232,10 +143,7 @@ export async function availablePacks(): Promise<PackListing[]> {if (!res.ok) return []const list = (await res.json()) as PackListing[]if (!Array.isArray(list)) return []- // A language already present by EITHER route is not on offer: showing it- // again invites adding the same pack twice to two different places.- const have = new Set([...Object.keys(read()), ...inFile.keys()])- return list.filter((p) => p?.lang && p?.url && !have.has(p.lang))+ return list.filter((p) => p?.lang && p?.url && !inFile.has(p.lang))} catch {return []}