The open source AI video agent: turns any coding agent into a video agent, with an editor to change anything it makes.
Studio: on Windows, what is deleted goes to the Recycle Bin, and the words say so (#219)
WEBGRS3ec2351abed8
diff --git a/.changeset/recycle-bin-on-windows.md b/.changeset/recycle-bin-on-windows.mdnew file mode 100644index 0000000..3c2c3c2--- /dev/null+++ b/.changeset/recycle-bin-on-windows.md@@ -0,0 +1,6 @@+---+"openfilm": patch+"@openfilm/desktop": patch+---++On Windows, deleting a project, a file or a skill says it goes to the Recycle Bin (回收站, ごみ箱, Papelera de reciclaje), where it does go, instead of the Mac's Trash.diff --git a/apps/desktop/chat/src/i18n/locales/en-US.ts b/apps/desktop/chat/src/i18n/locales/en-US.tsindex 4d4d0e9..0f8ec87 100644--- a/apps/desktop/chat/src/i18n/locales/en-US.ts+++ b/apps/desktop/chat/src/i18n/locales/en-US.ts@@ -1,4 +1,9 @@/** The chat's words (English): the paths its components look up with useT(). */++/* the system's trash, by its name there */+const TRASH = typeof navigator !== 'undefined' && /^win/i.test(navigator.platform) ? 'the Recycle Bin'+ : typeof navigator !== 'undefined' && /^mac/i.test(navigator.platform) ? 'the Trash' : 'the trash';+export const enUS = {/* a turn of the app's own agent stopped: the service its model runs on has no balance left (BalanceNotice) */balance: {@@ -288,7 +293,7 @@ export const enUS = {cardDoes: 'What it does',next: 'Next',cancel: 'Cancel',- replaceNote: 'You have {names} already: adding it moves the old one to the trash.',+ replaceNote: `You have {names} already: adding it moves the old one to ${TRASH}.`,replaceAndAdd: 'Replace and add',scriptsCount: '{n} scripts',fromLink: 'From a link',diff --git a/apps/desktop/chat/src/i18n/locales/es.ts b/apps/desktop/chat/src/i18n/locales/es.tsindex 28f101f..e6ba3b5 100644--- a/apps/desktop/chat/src/i18n/locales/es.ts+++ b/apps/desktop/chat/src/i18n/locales/es.ts@@ -1,5 +1,9 @@import type { Words } from './words';+/* the system's trash, by its name there */+const TRASH = typeof navigator !== 'undefined' && /^win/i.test(navigator.platform) ? 'la Papelera de reciclaje'+ : typeof navigator !== 'undefined' && /^mac/i.test(navigator.platform) ? 'la Papelera' : 'la papelera';+export const es: Words = {/* a turn of the app's own agent stopped: the service its model runs on has no balance left (BalanceNotice) */balance: {@@ -288,7 +292,7 @@ export const es: Words = {cardDoes: 'Para qué sirve',next: 'Siguiente',cancel: 'Cancelar',- replaceNote: 'Ya tienes {names}: al añadirla, la anterior va a la papelera.',+ replaceNote: `Ya tienes {names}: al añadirla, la anterior va a ${TRASH}.`,replaceAndAdd: 'Reemplazar y añadir',scriptsCount: '{n} scripts',fromLink: 'Desde un enlace',diff --git a/apps/desktop/chat/src/i18n/locales/ja.ts b/apps/desktop/chat/src/i18n/locales/ja.tsindex 29a4b9b..1f270dd 100644--- a/apps/desktop/chat/src/i18n/locales/ja.ts+++ b/apps/desktop/chat/src/i18n/locales/ja.ts@@ -1,5 +1,9 @@import type { Words } from './words';+/* the system's trash, by its name there */+const TRASH = typeof navigator !== 'undefined' && /^win/i.test(navigator.platform) ? 'ごみ箱'+ : typeof navigator !== 'undefined' && /^mac/i.test(navigator.platform) ? 'ゴミ箱' : 'ゴミ箱';+export const ja: Words = {/* a turn of the app's own agent stopped: the service its model runs on has no balance left (BalanceNotice) */balance: {@@ -288,7 +292,7 @@ export const ja: Words = {cardDoes: '用途',next: '次へ',cancel: 'キャンセル',- replaceNote: '{names} はすでにあります。追加すると古いものはゴミ箱に移動します。',+ replaceNote: `{names} はすでにあります。追加すると古いものは${TRASH}に移動します。`,replaceAndAdd: '置き換えて追加',scriptsCount: 'スクリプト {n} 個',fromLink: 'リンクから',diff --git a/apps/desktop/chat/src/i18n/locales/zh-CN.ts b/apps/desktop/chat/src/i18n/locales/zh-CN.tsindex 68e698d..48589e0 100644--- a/apps/desktop/chat/src/i18n/locales/zh-CN.ts+++ b/apps/desktop/chat/src/i18n/locales/zh-CN.ts@@ -1,5 +1,9 @@import type { Words } from './words';+/* the system's trash, by its name there */+const TRASH = typeof navigator !== 'undefined' && /^win/i.test(navigator.platform) ? '回收站'+ : typeof navigator !== 'undefined' && /^mac/i.test(navigator.platform) ? '废纸篓' : '回收站';+export const zhCN: Words = {/* a turn of the app's own agent stopped: the service its model runs on has no balance left (BalanceNotice) */balance: {@@ -288,7 +292,7 @@ export const zhCN: Words = {cardDoes: '用途',next: '下一步',cancel: '取消',- replaceNote: '你已经有 {names},添加后旧的会移到废纸篓。',+ replaceNote: `你已经有 {names},添加后旧的会移到${TRASH}。`,replaceAndAdd: '替换并添加',scriptsCount: '{n} 个脚本',fromLink: '从链接',diff --git a/apps/desktop/src/trash-word.test.mjs b/apps/desktop/src/trash-word.test.mjsnew file mode 100644index 0000000..99c47a2--- /dev/null+++ b/apps/desktop/src/trash-word.test.mjs@@ -0,0 +1,20 @@+import { test } from 'node:test';+import assert from 'node:assert/strict';++/** The chat's words as a system shows them: the dictionary read afresh, with that system's `navigator.platform`. */+async function wordsOn(platform, file, name) {+ const before = Object.getOwnPropertyDescriptor(globalThis, 'navigator');+ Object.defineProperty(globalThis, 'navigator', { value: { platform }, configurable: true });+ try {+ return JSON.stringify((await import(`../chat/src/i18n/locales/${file}?${platform}`))[name]);+ } finally {+ if (before) Object.defineProperty(globalThis, 'navigator', before);+ }+}++test('the chat names the trash as the system does: the Recycle Bin on Windows, the Trash on a Mac', async () => {+ assert.ok((await wordsOn('Win32', 'zh-CN.ts', 'zhCN')).includes('移到回收站'));+ assert.ok((await wordsOn('MacIntel', 'zh-CN.ts', 'zhCN')).includes('移到废纸篓'));+ assert.ok((await wordsOn('Win32', 'en-US.ts', 'enUS')).includes('to the Recycle Bin'));+ assert.ok((await wordsOn('MacIntel', 'en-US.ts', 'enUS')).includes('to the Trash'));+});diff --git a/packages/openfilm/studio/ui/src/i18n/en.ts b/packages/openfilm/studio/ui/src/i18n/en.tsindex 78c5423..2f81bce 100644--- a/packages/openfilm/studio/ui/src/i18n/en.ts+++ b/packages/openfilm/studio/ui/src/i18n/en.ts@@ -4,6 +4,9 @@/** what the system's file manager is called here */const FILES = typeof navigator !== 'undefined' && /^win/i.test(navigator.platform) ? 'File Explorer': typeof navigator !== 'undefined' && /^mac/i.test(navigator.platform) ? 'Finder' : 'Files';+/* the system's trash, by its name there */+const TRASH = typeof navigator !== 'undefined' && /^win/i.test(navigator.platform) ? 'the Recycle Bin'+ : typeof navigator !== 'undefined' && /^mac/i.test(navigator.platform) ? 'the Trash' : 'the trash';export const en = {nav: {@@ -56,9 +59,9 @@ export const en = {noneInstalled: 'None installed yet. Find OpenFilm\'s in',fromAgent: 'From {name}',agentHint: 'Your agent\'s own. Off until you turn one on.',- removeTitle: 'Move “{name}” to the trash?',- removeHint: 'Agents stop using it. You can put it back from the trash.',- remove: 'Move to trash',+ removeTitle: `Move “{name}” to ${TRASH}?`,+ removeHint: `Agents stop using it. You can put it back from ${TRASH}.`,+ remove: `Move to ${TRASH}`,tryNow: 'Try now',tryOff: 'Turn it on to try it',details: 'Details',@@ -180,8 +183,8 @@ export const en = {folderNamePlaceholder: 'Folder name',renameFolder: 'Rename folder',deleteFolder: 'Delete folder',- deleteFolderHint: 'Deletes the folder and moves the {n} projects inside it to the Trash, where you can take them back.',- deleteFolderHintOne: 'Deletes the folder and moves the project inside it to the Trash, where you can take it back.',+ deleteFolderHint: `Deletes the folder and moves the {n} projects inside it to ${TRASH}, where you can take them back.`,+ deleteFolderHintOne: `Deletes the folder and moves the project inside it to ${TRASH}, where you can take it back.`,deleteFolderHintEmpty: 'Deletes the folder. There are no projects in it.',renameTaken: '“{name}” is taken: there is already a folder with that name. Choose another.',moveToTitle: 'Move “{name}”',@@ -683,12 +686,12 @@ export const en = {commit: 'Commit',discard: 'Discard changes',discardTitle: 'Discard all uncommitted changes?',- discardBody: 'The film goes back to its last commit. Files added since move to the Trash.',+ discardBody: `The film goes back to its last commit. Files added since move to ${TRASH}.`,historyOf: 'History · {branch}',restore: 'Restore this version',restoreTitle: 'Restore “{name}”?',restoreBody: 'The film becomes this version, as uncommitted changes: commit them to keep it, or discard them to come back.',- restoreDirtyBody: 'You have uncommitted changes. Restoring discards them first (files added since move to the Trash).',+ restoreDirtyBody: `You have uncommitted changes. Restoring discards them first (files added since move to ${TRASH}).`,restoreDiscard: 'Discard and restore',restoreConfirm: 'Restore',restoredMessage: 'Back to “{name}”',@@ -781,9 +784,9 @@ export const en = {renameKind: '“{from}” can’t be renamed “{to}”: the ending says what a file is, and this one would change it. Keep an ending of the same kind.',delete: 'Delete',deleteConfirmTitle: 'Delete this asset?',- deleteConfirm: 'It moves to the Trash, where you can take it back.',- deleteAlsoClip: 'It moves to the Trash, where you can take it back. The clip using it on the timeline is removed too.',- deleteAlsoClips: 'It moves to the Trash, where you can take it back. The {n} clips using it on the timeline are removed too.',+ deleteConfirm: `It moves to ${TRASH}, where you can take it back.`,+ deleteAlsoClip: `It moves to ${TRASH}, where you can take it back. The clip using it on the timeline is removed too.`,+ deleteAlsoClips: `It moves to ${TRASH}, where you can take it back. The {n} clips using it on the timeline are removed too.`,deleteFailed: 'Could not delete',extractAudio: 'Extract audio as a new file',extractAudioFailed: 'Couldn’t take the sound out of that video',@@ -860,9 +863,9 @@ export const en = {moveHere: "It’s already here",deleteMany: "Delete {n} items",deleteManyTitle: "Delete {n} items?",- deleteManyConfirm: "They move to the Trash, where you can take them back.",- deleteManyAlsoClip: "They move to the Trash, where you can take them back. The clip using one of them on the timeline is removed too.",- deleteManyAlsoClips: "They move to the Trash, where you can take them back. The {n} clips using them on the timeline are removed too.",+ deleteManyConfirm: `They move to ${TRASH}, where you can take them back.`,+ deleteManyAlsoClip: `They move to ${TRASH}, where you can take them back. The clip using one of them on the timeline is removed too.`,+ deleteManyAlsoClips: `They move to ${TRASH}, where you can take them back. The {n} clips using them on the timeline are removed too.`,importFiles: "Import files…",importFilesNote: "A copy goes into the project",linkFiles: "Link files…",@@ -1479,9 +1482,9 @@ export const en = {confirm: {ok: 'Confirm',deleteTitle: 'Delete this project?',- deleteDesc: 'Its folder, with the film and everything in it, moves to the Trash.',+ deleteDesc: `Its folder, with the film and everything in it, moves to ${TRASH}.`,deleteManyTitle: 'Delete these {n} projects?',- deleteManyDesc: 'Their folders, with the films and everything in them, move to the Trash.',+ deleteManyDesc: `Their folders, with the films and everything in them, move to ${TRASH}.`,delete: 'Delete',cancel: 'Cancel',},diff --git a/packages/openfilm/studio/ui/src/i18n/es.ts b/packages/openfilm/studio/ui/src/i18n/es.tsindex ab49494..5dc6712 100644--- a/packages/openfilm/studio/ui/src/i18n/es.ts+++ b/packages/openfilm/studio/ui/src/i18n/es.ts@@ -3,6 +3,9 @@ import type { Words } from './words.ts';/** what the system's file manager is called here */const FILES = typeof navigator !== 'undefined' && /^win/i.test(navigator.platform) ? 'el Explorador de archivos': typeof navigator !== 'undefined' && /^mac/i.test(navigator.platform) ? 'el Finder' : 'el gestor de archivos';+/* the system's trash, by its name there */+const TRASH = typeof navigator !== 'undefined' && /^win/i.test(navigator.platform) ? 'la Papelera de reciclaje'+ : typeof navigator !== 'undefined' && /^mac/i.test(navigator.platform) ? 'la Papelera' : 'la papelera';export const es: Words = {nav: {@@ -55,9 +58,9 @@ export const es: Words = {noneInstalled: 'Aún no hay ninguna. Encuentra las de OpenFilm en',fromAgent: 'De {name}',agentHint: 'Las de tu agente. Desactivadas hasta que actives una.',- removeTitle: '¿Mover «{name}» a la papelera?',- removeHint: 'Los agentes dejarán de usarla. Puedes recuperarla de la papelera.',- remove: 'Mover a la papelera',+ removeTitle: `¿Mover «{name}» a ${TRASH}?`,+ removeHint: `Los agentes dejarán de usarla. Puedes recuperarla de ${TRASH}.`,+ remove: `Mover a ${TRASH}`,tryNow: 'Probar',tryOff: 'Actívala para probarla',details: 'Detalles',@@ -179,8 +182,8 @@ export const es: Words = {folderNamePlaceholder: 'Nombre de la carpeta',renameFolder: 'Cambiar nombre de la carpeta',deleteFolder: 'Eliminar carpeta',- deleteFolderHint: 'Elimina la carpeta y mueve los {n} proyectos que contiene a la Papelera, desde donde puedes recuperarlos.',- deleteFolderHintOne: 'Elimina la carpeta y mueve el proyecto que contiene a la Papelera, desde donde puedes recuperarlo.',+ deleteFolderHint: `Elimina la carpeta y mueve los {n} proyectos que contiene a ${TRASH}, desde donde puedes recuperarlos.`,+ deleteFolderHintOne: `Elimina la carpeta y mueve el proyecto que contiene a ${TRASH}, desde donde puedes recuperarlo.`,deleteFolderHintEmpty: 'Elimina la carpeta. No contiene ningún proyecto.',renameTaken: '“{name}” ya está en uso: ya hay una carpeta con ese nombre. Elige otro.',moveToTitle: 'Mover «{name}»',@@ -682,12 +685,12 @@ export const es: Words = {commit: 'Confirmar',discard: 'Descartar cambios',discardTitle: '¿Descartar todos los cambios sin confirmar?',- discardBody: 'La película vuelve a su última confirmación. Los archivos añadidos desde entonces van a la Papelera.',+ discardBody: `La película vuelve a su última confirmación. Los archivos añadidos desde entonces van a ${TRASH}.`,historyOf: 'Historial · {branch}',restore: 'Restaurar esta versión',restoreTitle: '¿Restaurar “{name}”?',restoreBody: 'La película pasa a ser esta versión, como cambios sin confirmar: confírmalos para quedártela o descártalos para volver.',- restoreDirtyBody: 'Tienes cambios sin confirmar. Restaurar los descarta primero (los archivos añadidos van a la Papelera).',+ restoreDirtyBody: `Tienes cambios sin confirmar. Restaurar los descarta primero (los archivos añadidos van a ${TRASH}).`,restoreDiscard: 'Descartar y restaurar',restoreConfirm: 'Restaurar',restoredMessage: 'Vuelta a “{name}”',@@ -780,9 +783,9 @@ export const es: Words = {renameKind: '“{from}” no se puede renombrar como “{to}”: la extensión indica qué es un archivo, y esta la cambiaría. Mantén una extensión del mismo tipo.',delete: 'Eliminar',deleteConfirmTitle: '¿Eliminar este recurso?',- deleteConfirm: 'Se mueve a la Papelera, desde donde puedes recuperarlo.',- deleteAlsoClip: 'Se mueve a la Papelera, desde donde puedes recuperarlo. También se quita el clip que lo usa en la línea de tiempo.',- deleteAlsoClips: 'Se mueve a la Papelera, desde donde puedes recuperarlo. También se quitan los {n} clips que lo usan en la línea de tiempo.',+ deleteConfirm: `Se mueve a ${TRASH}, desde donde puedes recuperarlo.`,+ deleteAlsoClip: `Se mueve a ${TRASH}, desde donde puedes recuperarlo. También se quita el clip que lo usa en la línea de tiempo.`,+ deleteAlsoClips: `Se mueve a ${TRASH}, desde donde puedes recuperarlo. También se quitan los {n} clips que lo usan en la línea de tiempo.`,deleteFailed: 'No se pudo eliminar',extractAudio: 'Extraer el audio como archivo nuevo',extractAudioFailed: 'No se pudo extraer el sonido de ese video',@@ -859,9 +862,9 @@ export const es: Words = {moveHere: "Ya está aquí",deleteMany: "Eliminar {n} elementos",deleteManyTitle: "¿Eliminar {n} elementos?",- deleteManyConfirm: "Se mueven a la Papelera, desde donde puedes recuperarlos.",- deleteManyAlsoClip: "Se mueven a la Papelera, desde donde puedes recuperarlos. También se quita el clip que usa uno de ellos en la línea de tiempo.",- deleteManyAlsoClips: "Se mueven a la Papelera, desde donde puedes recuperarlos. También se quitan los {n} clips que los usan en la línea de tiempo.",+ deleteManyConfirm: `Se mueven a ${TRASH}, desde donde puedes recuperarlos.`,+ deleteManyAlsoClip: `Se mueven a ${TRASH}, desde donde puedes recuperarlos. También se quita el clip que usa uno de ellos en la línea de tiempo.`,+ deleteManyAlsoClips: `Se mueven a ${TRASH}, desde donde puedes recuperarlos. También se quitan los {n} clips que los usan en la línea de tiempo.`,importFiles: "Importar archivos…",importFilesNote: "Se copia en el proyecto",linkFiles: "Vincular archivos…",@@ -1478,9 +1481,9 @@ export const es: Words = {confirm: {ok: 'Confirmar',deleteTitle: '¿Eliminar este proyecto?',- deleteDesc: 'Su carpeta, con la película y todo lo que contiene, se mueve a la Papelera.',+ deleteDesc: `Su carpeta, con la película y todo lo que contiene, se mueve a ${TRASH}.`,deleteManyTitle: '¿Eliminar estos {n} proyectos?',- deleteManyDesc: 'Sus carpetas, con las películas y todo lo que contienen, se mueven a la Papelera.',+ deleteManyDesc: `Sus carpetas, con las películas y todo lo que contienen, se mueven a ${TRASH}.`,delete: 'Eliminar',cancel: 'Cancelar',},diff --git a/packages/openfilm/studio/ui/src/i18n/ja.ts b/packages/openfilm/studio/ui/src/i18n/ja.tsindex 11cccec..6c1225d 100644--- a/packages/openfilm/studio/ui/src/i18n/ja.ts+++ b/packages/openfilm/studio/ui/src/i18n/ja.ts@@ -3,6 +3,9 @@ import type { Words } from './words.ts';/** what the system's file manager is called here */const FILES = typeof navigator !== 'undefined' && /^win/i.test(navigator.platform) ? 'エクスプローラー': typeof navigator !== 'undefined' && /^mac/i.test(navigator.platform) ? 'Finder' : 'ファイル';+/* the system's trash, by its name there */+const TRASH = typeof navigator !== 'undefined' && /^win/i.test(navigator.platform) ? 'ごみ箱'+ : typeof navigator !== 'undefined' && /^mac/i.test(navigator.platform) ? 'ゴミ箱' : 'ゴミ箱';export const ja: Words = {nav: {@@ -55,9 +58,9 @@ export const ja: Words = {noneInstalled: 'まだありません。OpenFilm のスキルはこちら:',fromAgent: '{name} から',agentHint: 'エージェント自身のもの。オンにしたものだけ使います。',- removeTitle: '「{name}」をゴミ箱に移動しますか?',- removeHint: 'エージェントは使わなくなります。ゴミ箱から戻せます。',- remove: 'ゴミ箱に移動',+ removeTitle: `「{name}」を${TRASH}に移動しますか?`,+ removeHint: `エージェントは使わなくなります。${TRASH}から戻せます。`,+ remove: `${TRASH}に移動`,tryNow: '試す',tryOff: 'オンにすると試せます',details: '詳細',@@ -179,8 +182,8 @@ export const ja: Words = {folderNamePlaceholder: 'フォルダー名',renameFolder: 'フォルダー名を変更',deleteFolder: 'フォルダーを削除',- deleteFolderHint: 'フォルダーを削除し、中の {n} 件のプロジェクトをゴミ箱に移動します。ゴミ箱から元に戻せます。',- deleteFolderHintOne: 'フォルダーを削除し、中のプロジェクトをゴミ箱に移動します。ゴミ箱から元に戻せます。',+ deleteFolderHint: `フォルダーを削除し、中の {n} 件のプロジェクトを${TRASH}に移動します。${TRASH}から元に戻せます。`,+ deleteFolderHintOne: `フォルダーを削除し、中のプロジェクトを${TRASH}に移動します。${TRASH}から元に戻せます。`,deleteFolderHintEmpty: 'フォルダーを削除します。中にプロジェクトはありません。',renameTaken: '「{name}」は使用されています。同じ名前のフォルダーがすでにあります。別の名前を選んでください。',moveToTitle: '「{name}」を移動',@@ -682,12 +685,12 @@ export const ja: Words = {commit: 'コミット',discard: '変更を破棄',discardTitle: 'コミットしていない変更をすべて破棄しますか?',- discardBody: '映像は最後のコミットに戻ります。その後に追加したファイルはゴミ箱に移ります。',+ discardBody: `映像は最後のコミットに戻ります。その後に追加したファイルは${TRASH}に移ります。`,historyOf: '履歴 · {branch}',restore: 'このバージョンに戻す',restoreTitle: '「{name}」に戻しますか?',restoreBody: '映像がこのバージョンになり、コミットしていない変更として表示されます。コミットすれば残り、破棄すれば今に戻ります。',- restoreDirtyBody: 'コミットしていない変更があります。戻す前にそれらを破棄します(追加したファイルはゴミ箱に移ります)。',+ restoreDirtyBody: `コミットしていない変更があります。戻す前にそれらを破棄します(追加したファイルは${TRASH}に移ります)。`,restoreDiscard: '破棄して戻す',restoreConfirm: '戻す',restoredMessage: '「{name}」に戻した',@@ -780,9 +783,9 @@ export const ja: Words = {renameKind: '「{from}」の名前を「{to}」に変更できません。拡張子はファイルの種類を表しており、この変更では種類が変わってしまいます。同じ種類の拡張子のままにしてください。',delete: '削除',deleteConfirmTitle: 'この素材を削除しますか?',- deleteConfirm: 'ゴミ箱に移動します。ゴミ箱から元に戻せます。',- deleteAlsoClip: 'ゴミ箱に移動します。ゴミ箱から元に戻せます。タイムライン上でこれを使っているクリップも削除されます。',- deleteAlsoClips: 'ゴミ箱に移動します。ゴミ箱から元に戻せます。タイムライン上でこれを使っている {n} 個のクリップも削除されます。',+ deleteConfirm: `${TRASH}に移動します。${TRASH}から元に戻せます。`,+ deleteAlsoClip: `${TRASH}に移動します。${TRASH}から元に戻せます。タイムライン上でこれを使っているクリップも削除されます。`,+ deleteAlsoClips: `${TRASH}に移動します。${TRASH}から元に戻せます。タイムライン上でこれを使っている {n} 個のクリップも削除されます。`,deleteFailed: '削除できませんでした',extractAudio: 'オーディオを新しいファイルとして抽出',extractAudioFailed: 'そのビデオからサウンドを取り出せませんでした',@@ -859,9 +862,9 @@ export const ja: Words = {moveHere: "すでにここにあります",deleteMany: "{n} 個の項目を削除",deleteManyTitle: "{n} 個の項目を削除しますか?",- deleteManyConfirm: "ゴミ箱に移動します。ゴミ箱から元に戻せます。",- deleteManyAlsoClip: "ゴミ箱に移動します。ゴミ箱から元に戻せます。タイムライン上でこれらを使っているクリップも削除されます。",- deleteManyAlsoClips: "ゴミ箱に移動します。ゴミ箱から元に戻せます。タイムライン上でこれらを使っている {n} 個のクリップも削除されます。",+ deleteManyConfirm: `${TRASH}に移動します。${TRASH}から元に戻せます。`,+ deleteManyAlsoClip: `${TRASH}に移動します。${TRASH}から元に戻せます。タイムライン上でこれらを使っているクリップも削除されます。`,+ deleteManyAlsoClips: `${TRASH}に移動します。${TRASH}から元に戻せます。タイムライン上でこれらを使っている {n} 個のクリップも削除されます。`,importFiles: "ファイルを読み込む…",importFilesNote: "プロジェクトにコピーします",linkFiles: "ファイルをリンク…",@@ -1478,9 +1481,9 @@ export const ja: Words = {confirm: {ok: '確認',deleteTitle: 'このプロジェクトを削除しますか?',- deleteDesc: '映像とその中身すべてを含むフォルダーがゴミ箱に移動します。',+ deleteDesc: `映像とその中身すべてを含むフォルダーが${TRASH}に移動します。`,deleteManyTitle: 'これら {n} 件のプロジェクトを削除しますか?',- deleteManyDesc: '映像とその中身すべてを含むフォルダーがゴミ箱に移動します。',+ deleteManyDesc: `映像とその中身すべてを含むフォルダーが${TRASH}に移動します。`,delete: '削除',cancel: 'キャンセル',},diff --git a/packages/openfilm/studio/ui/src/i18n/zh-CN.ts b/packages/openfilm/studio/ui/src/i18n/zh-CN.tsindex 7a1435c..84bb9ea 100644--- a/packages/openfilm/studio/ui/src/i18n/zh-CN.ts+++ b/packages/openfilm/studio/ui/src/i18n/zh-CN.ts@@ -4,6 +4,9 @@ import type { Words } from './words.ts';/** what the system's file manager is called here */const FILES = typeof navigator !== 'undefined' && /^win/i.test(navigator.platform) ? '文件资源管理器': typeof navigator !== 'undefined' && /^mac/i.test(navigator.platform) ? '访达' : '文件管理器';+/* the system's trash, by its name there */+const TRASH = typeof navigator !== 'undefined' && /^win/i.test(navigator.platform) ? '回收站'+ : typeof navigator !== 'undefined' && /^mac/i.test(navigator.platform) ? '废纸篓' : '回收站';export const zhCN: Words = {nav: {@@ -56,9 +59,9 @@ export const zhCN: Words = {noneInstalled: '还没有安装。去这里找 OpenFilm 的:',fromAgent: '来自 {name}',agentHint: '智能体自己的,开启后才会用。',- removeTitle: '把「{name}」移到废纸篓?',- removeHint: '智能体不会再用它。需要时可以从废纸篓放回来。',- remove: '移到废纸篓',+ removeTitle: `把「{name}」移到${TRASH}?`,+ removeHint: `智能体不会再用它。需要时可以从${TRASH}放回来。`,+ remove: `移到${TRASH}`,tryNow: '试一试',tryOff: '开启后才能试',details: '详情',@@ -180,8 +183,8 @@ export const zhCN: Words = {folderNamePlaceholder: '文件夹名称',renameFolder: '重命名文件夹',deleteFolder: '删除文件夹',- deleteFolderHint: '删除此文件夹,并将其中的 {n} 个项目移到废纸篓,你可以从那里找回。',- deleteFolderHintOne: '删除此文件夹,并将其中的项目移到废纸篓,你可以从那里找回。',+ deleteFolderHint: `删除此文件夹,并将其中的 {n} 个项目移到${TRASH},你可以从那里找回。`,+ deleteFolderHintOne: `删除此文件夹,并将其中的项目移到${TRASH},你可以从那里找回。`,deleteFolderHintEmpty: '删除此文件夹。其中没有项目。',renameTaken: '“{name}”已被占用:已有同名文件夹。请换一个名称。',moveToTitle: '移动「{name}」',@@ -683,12 +686,12 @@ export const zhCN: Words = {commit: '提交',discard: '放弃改动',discardTitle: '放弃所有未提交的改动?',- discardBody: '影片会回到最近一次提交。之后新加的文件会移到废纸篓。',+ discardBody: `影片会回到最近一次提交。之后新加的文件会移到${TRASH}。`,historyOf: '提交记录 · {branch}',restore: '恢复到这个版本',restoreTitle: '恢复到「{name}」?',restoreBody: '影片会变回这个版本,作为未提交的改动出现:提交就保留下来,放弃就回到现在。',- restoreDirtyBody: '你还有未提交的改动。恢复会先放弃它们(之后新加的文件会移到废纸篓)。',+ restoreDirtyBody: `你还有未提交的改动。恢复会先放弃它们(之后新加的文件会移到${TRASH})。`,restoreDiscard: '放弃并恢复',restoreConfirm: '恢复',restoredMessage: '回到「{name}」',@@ -781,9 +784,9 @@ export const zhCN: Words = {renameKind: '“{from}”不能重命名为“{to}”:扩展名表明了文件的类型,这样改会改变它。请保留同类的扩展名。',delete: '删除',deleteConfirmTitle: '删除此素材?',- deleteConfirm: '它会被移到废纸篓,你可以从那里找回。',- deleteAlsoClip: '它会被移到废纸篓,你可以从那里找回。时间轴上使用它的片段也会被移除。',- deleteAlsoClips: '它会被移到废纸篓,你可以从那里找回。时间轴上使用它的 {n} 个片段也会被移除。',+ deleteConfirm: `它会被移到${TRASH},你可以从那里找回。`,+ deleteAlsoClip: `它会被移到${TRASH},你可以从那里找回。时间轴上使用它的片段也会被移除。`,+ deleteAlsoClips: `它会被移到${TRASH},你可以从那里找回。时间轴上使用它的 {n} 个片段也会被移除。`,deleteFailed: '无法删除',extractAudio: '提取音频为新文件',extractAudioFailed: '无法从该视频中提取声音',@@ -860,9 +863,9 @@ export const zhCN: Words = {moveHere: "已经在这里",deleteMany: "删除 {n} 项",deleteManyTitle: "删除这 {n} 项?",- deleteManyConfirm: "它们会被移到废纸篓,你可以从那里找回。",- deleteManyAlsoClip: "它们会被移到废纸篓,你可以从那里找回。时间轴上使用其中一项的片段也会被移除。",- deleteManyAlsoClips: "它们会被移到废纸篓,你可以从那里找回。时间轴上使用它们的 {n} 个片段也会被移除。",+ deleteManyConfirm: `它们会被移到${TRASH},你可以从那里找回。`,+ deleteManyAlsoClip: `它们会被移到${TRASH},你可以从那里找回。时间轴上使用其中一项的片段也会被移除。`,+ deleteManyAlsoClips: `它们会被移到${TRASH},你可以从那里找回。时间轴上使用它们的 {n} 个片段也会被移除。`,importFiles: "导入文件…",importFilesNote: "复制一份到项目里",linkFiles: "链接文件…",@@ -1479,9 +1482,9 @@ export const zhCN: Words = {confirm: {ok: '确认',deleteTitle: '删除此项目?',- deleteDesc: '它的文件夹,连同影片和其中的所有内容,都会被移到废纸篓。',+ deleteDesc: `它的文件夹,连同影片和其中的所有内容,都会被移到${TRASH}。`,deleteManyTitle: '删除这 {n} 个项目?',- deleteManyDesc: '它们的文件夹,连同影片和其中的所有内容,都会被移到废纸篓。',+ deleteManyDesc: `它们的文件夹,连同影片和其中的所有内容,都会被移到${TRASH}。`,delete: '删除',cancel: '取消',},diff --git a/packages/openfilm/studio/ui/src/lib/trash-word.test.ts b/packages/openfilm/studio/ui/src/lib/trash-word.test.tsnew file mode 100644index 0000000..b8c3672--- /dev/null+++ b/packages/openfilm/studio/ui/src/lib/trash-word.test.ts@@ -0,0 +1,26 @@+import { test } from 'node:test';+import assert from 'node:assert/strict';++/** A dictionary's words as a system shows them: its module read afresh, with that system's `navigator.platform`. */+async function wordsOn(platform: string, file: string, name: string): Promise<string> {+ const before = Object.getOwnPropertyDescriptor(globalThis, 'navigator');+ Object.defineProperty(globalThis, 'navigator', { value: { platform }, configurable: true });+ try {+ const module = await import(`../i18n/${file}?${platform}`);+ return JSON.stringify(module[name]);+ } finally {+ if (before) Object.defineProperty(globalThis, 'navigator', before);+ }+}++test('the trash is named as the system names it: the Recycle Bin on Windows, the Trash on a Mac', async () => {+ const zhWin = await wordsOn('Win32', 'zh-CN.ts', 'zhCN');+ assert.ok(zhWin.includes('移到回收站') && !zhWin.includes('废纸篓'));+ const zhMac = await wordsOn('MacIntel', 'zh-CN.ts', 'zhCN');+ assert.ok(zhMac.includes('移到废纸篓') && !zhMac.includes('回收站'));+ const enWin = await wordsOn('Win32', 'en.ts', 'en');+ assert.ok(enWin.includes('moves to the Recycle Bin') && !/trash/i.test(enWin));+ assert.ok((await wordsOn('MacIntel', 'en.ts', 'en')).includes('moves to the Trash'));+ assert.ok((await wordsOn('Win32', 'ja.ts', 'ja')).includes('ごみ箱'));+ assert.ok((await wordsOn('Win32', 'es.ts', 'es')).includes('la Papelera de reciclaje'));+});