@widgetic/file-browser 0.5.23 → 0.5.25

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.
Files changed (94) hide show
  1. package/README.md +249 -4
  2. package/dist/components/FolderTree.svelte +4 -1
  3. package/dist/components/core/FileBrowser.svelte +539 -163
  4. package/dist/components/core/FileBrowser.svelte.d.ts +25 -1
  5. package/dist/components/core/FileUploader.svelte +114 -45
  6. package/dist/components/core/Header.svelte +12 -1
  7. package/dist/components/core/Header.svelte.d.ts +1 -0
  8. package/dist/components/core/RecentFiles.svelte +34 -26
  9. package/dist/components/core/UploadStatus.svelte +8 -5
  10. package/dist/components/core/UploadStatusList.svelte +13 -21
  11. package/dist/components/items/FileItem.svelte +19 -10
  12. package/dist/components/items/FolderItem.svelte +6 -3
  13. package/dist/components/modals/MoveDialog.svelte +43 -32
  14. package/dist/components/modals/NewFolderButton.svelte +5 -2
  15. package/dist/components/modals/SearchModal.svelte +16 -21
  16. package/dist/components/modals/SelectedFilesModal.svelte +14 -9
  17. package/dist/components/modals/SelectedFilesModal.svelte.d.ts +1 -1
  18. package/dist/components/previews/AudioPlayer.svelte +5 -2
  19. package/dist/components/previews/ErrorPreview.svelte +7 -4
  20. package/dist/components/previews/ErrorPreview.svelte.d.ts +1 -1
  21. package/dist/components/previews/FilePreview.svelte +17 -7
  22. package/dist/components/previews/FontPreview.svelte +18 -9
  23. package/dist/components/previews/FontPreview.svelte.d.ts +1 -1
  24. package/dist/components/previews/TextPreview.svelte +12 -5
  25. package/dist/components/previews/VideoPlayer.svelte +8 -5
  26. package/dist/components/ui/ControlToolbar.svelte +45 -23
  27. package/dist/components/ui/ControlToolbar.svelte.d.ts +1 -1
  28. package/dist/components/ui/DragSelect.svelte +2 -2
  29. package/dist/components/ui/DropdownMenu.svelte +35 -14
  30. package/dist/components/ui/FileIcon.svelte +8 -5
  31. package/dist/components/ui/FileIcon.svelte.d.ts +1 -0
  32. package/dist/components/ui/FileMetadata.svelte +12 -15
  33. package/dist/components/ui/SearchResults.svelte +4 -1
  34. package/dist/i18n/context.d.ts +38 -0
  35. package/dist/i18n/context.js +70 -0
  36. package/dist/i18n/errors.d.ts +11 -0
  37. package/dist/i18n/errors.js +19 -0
  38. package/dist/i18n/index.d.ts +11 -0
  39. package/dist/i18n/index.js +18 -0
  40. package/dist/i18n/messages.d.ts +277 -0
  41. package/dist/i18n/messages.js +290 -0
  42. package/dist/i18n/text.d.ts +19 -0
  43. package/dist/i18n/text.js +35 -0
  44. package/dist/i18n/translator.d.ts +75 -0
  45. package/dist/i18n/translator.js +317 -0
  46. package/dist/index.d.ts +3 -0
  47. package/dist/index.js +4 -0
  48. package/dist/mediaLibrary/capabilities.d.ts +22 -0
  49. package/dist/mediaLibrary/capabilities.js +42 -0
  50. package/dist/mediaLibrary/context.d.ts +17 -0
  51. package/dist/mediaLibrary/context.js +16 -0
  52. package/dist/mediaLibrary/errors.d.ts +42 -0
  53. package/dist/mediaLibrary/errors.js +114 -0
  54. package/dist/mediaLibrary/index.d.ts +10 -0
  55. package/dist/mediaLibrary/index.js +9 -0
  56. package/dist/mediaLibrary/normalize.d.ts +39 -0
  57. package/dist/mediaLibrary/normalize.js +139 -0
  58. package/dist/mediaLibrary/paging.d.ts +37 -0
  59. package/dist/mediaLibrary/paging.js +62 -0
  60. package/dist/mediaLibrary/resolve.d.ts +39 -0
  61. package/dist/mediaLibrary/resolve.js +137 -0
  62. package/dist/mediaLibrary/treeOps.d.ts +24 -0
  63. package/dist/mediaLibrary/treeOps.js +67 -0
  64. package/dist/mediaLibrary/types.d.ts +126 -0
  65. package/dist/mediaLibrary/types.js +11 -0
  66. package/dist/mediaLibrary/urls.d.ts +30 -0
  67. package/dist/mediaLibrary/urls.js +59 -0
  68. package/dist/mediaLibrary/widgetic.d.ts +39 -0
  69. package/dist/mediaLibrary/widgetic.js +89 -0
  70. package/dist/stores/fileStore.d.ts +1 -1
  71. package/dist/stores/folderCountStore.js +2 -2
  72. package/dist/stores/persistentSelectStore.d.ts +10 -0
  73. package/dist/stores/persistentSelectStore.js +26 -0
  74. package/dist/utils/dateUtils.d.ts +11 -2
  75. package/dist/utils/dateUtils.js +20 -15
  76. package/dist/utils/fileKinds.d.ts +44 -0
  77. package/dist/utils/fileKinds.js +96 -0
  78. package/dist/utils/fileNames.d.ts +7 -0
  79. package/dist/utils/fileNames.js +19 -0
  80. package/dist/utils/fileOperations.js +2 -11
  81. package/dist/utils/fileTypes.d.ts +11 -2
  82. package/dist/utils/fileTypes.js +26 -14
  83. package/dist/utils/fileUtils.d.ts +8 -1
  84. package/dist/utils/fileUtils.js +22 -7
  85. package/dist/utils/folderUtils.js +3 -2
  86. package/dist/utils/safeText.d.ts +29 -0
  87. package/dist/utils/safeText.js +66 -0
  88. package/dist/utils/userUploadsStorage.d.ts +4 -1
  89. package/dist/utils/userUploadsStorage.js +5 -2
  90. package/dist/utils/widgeticTusUpload.d.ts +10 -0
  91. package/dist/utils/widgeticTusUpload.js +61 -3
  92. package/dist/utils/widgeticUpload.d.ts +3 -0
  93. package/dist/utils/widgeticUpload.js +7 -2
  94. package/package.json +7 -5
@@ -0,0 +1,19 @@
1
+ import { MediaLibraryError } from '../mediaLibrary/errors';
2
+ /**
3
+ * The sentence a visitor reads for a failure.
4
+ *
5
+ * - A media library's own words are shown as they are (the library knows its reasons: "File too large").
6
+ * - The File Browser's own sentence for a library failure is shown in the visitor's language (`messageKey`).
7
+ * - Any other error keeps its message, as it always has.
8
+ * - With nothing to say, `fallbackKey`.
9
+ */
10
+ export function messageForVisitor(error, t, fallbackKey = 'toast.unknownError') {
11
+ if (error instanceof MediaLibraryError) {
12
+ if (error.messageKey !== undefined)
13
+ return t(error.messageKey, error.messageValues);
14
+ return error.message || t(fallbackKey);
15
+ }
16
+ if (error instanceof Error && error.message)
17
+ return error.message;
18
+ return t(fallbackKey);
19
+ }
@@ -0,0 +1,11 @@
1
+ import { type MessageOverrides, type MessageProblem } from './translator';
2
+ export { FILE_BROWSER_MESSAGES, type FileBrowserMessageKey } from './messages';
3
+ export { createTranslator, describeMessageProblem, findMessageProblems, type MessageOverrides, type MessageProblem, type MessageValue, type MessageValues, type Translator, type TranslatorOptions } from './translator';
4
+ export { provideI18n, translateEnglish, useI18n, type I18nContext, type I18nHandle, type I18nSettings, type Translate } from './context';
5
+ export { messageForVisitor } from './errors';
6
+ /**
7
+ * Checks a page's `messages` against the File Browser's catalog without showing anything: a key that does not exist
8
+ * (with the nearest real one), a value that is not text, a template that does not parse, or one that asks for a value
9
+ * the message is never given. An empty list means every message will be used. For a test or a build step of the page.
10
+ */
11
+ export declare function checkFileBrowserMessages(messages: MessageOverrides): MessageProblem[];
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The words of the File Browser in the page's language: the English catalog, the translator that fills it in, and the
3
+ * Svelte context the screens use.
4
+ */
5
+ import { FILE_BROWSER_MESSAGES } from './messages';
6
+ import { findMessageProblems } from './translator';
7
+ export { FILE_BROWSER_MESSAGES } from './messages';
8
+ export { createTranslator, describeMessageProblem, findMessageProblems } from './translator';
9
+ export { provideI18n, translateEnglish, useI18n } from './context';
10
+ export { messageForVisitor } from './errors';
11
+ /**
12
+ * Checks a page's `messages` against the File Browser's catalog without showing anything: a key that does not exist
13
+ * (with the nearest real one), a value that is not text, a template that does not parse, or one that asks for a value
14
+ * the message is never given. An empty list means every message will be used. For a test or a build step of the page.
15
+ */
16
+ export function checkFileBrowserMessages(messages) {
17
+ return findMessageProblems(FILE_BROWSER_MESSAGES, messages);
18
+ }
@@ -0,0 +1,277 @@
1
+ /**
2
+ * Every word the File Browser shows, in English: the one place to read them, and the keys a page can replace with the
3
+ * `messages` option (or `setLanguage()` of the module).
4
+ *
5
+ * A message is plain text. `{name}` is a value the File Browser puts in; `{count, plural, one {# file} other {# files}}`
6
+ * picks the form that fits a number in the page's language. `\{`, `\}`, `\#` and `\\` write those characters
7
+ * themselves. See `translator.ts` for the whole format.
8
+ *
9
+ * Keys are grouped by where the words appear. A key that is left out of a page's `messages` keeps the English text
10
+ * below, so a language can be added a screen at a time.
11
+ */
12
+ export declare const FILE_BROWSER_MESSAGES: {
13
+ readonly 'action.cancel': "Cancel";
14
+ readonly 'action.confirm': "Confirm";
15
+ readonly 'action.create': "Create";
16
+ readonly 'action.delete': "Delete";
17
+ readonly 'action.done': "Done";
18
+ readonly 'action.download': "Download";
19
+ readonly 'action.move': "Move";
20
+ readonly 'action.rename': "Rename";
21
+ readonly 'action.tryAgain': "Try again";
22
+ readonly 'action.preview': "Preview";
23
+ readonly 'action.play': "Play";
24
+ readonly 'action.pause': "Pause";
25
+ readonly 'action.mute': "Mute";
26
+ readonly 'action.unmute': "Unmute";
27
+ readonly 'action.select': "Select";
28
+ readonly 'action.selected': "Selected";
29
+ readonly 'action.clearItems': "Clear items";
30
+ /** The button that hands the picked files to the page. The module shows "Select" here. */
31
+ readonly 'action.addToEditor': "Add to Editor";
32
+ /** Put between names in a list of names ("a.png, b.png"). */
33
+ readonly 'list.separator': ", ";
34
+ readonly 'toast.inBackground': "This will happen in the background";
35
+ readonly 'toast.unknownError': "Unknown error occurred";
36
+ readonly 'search.placeholder': "Search...";
37
+ readonly 'filter.by': "Filter by {type}";
38
+ readonly 'filterName.all': "All";
39
+ readonly 'filterName.image': "Image";
40
+ readonly 'filterName.audio': "Audio";
41
+ readonly 'filterName.video': "Video";
42
+ readonly 'filterName.document': "Document";
43
+ readonly 'filterName.font': "Font";
44
+ readonly 'filterName.svg': "SVG";
45
+ readonly 'filterOption.all': "All";
46
+ readonly 'filterOption.image': "Images";
47
+ readonly 'filterOption.video': "Videos";
48
+ readonly 'filterOption.document': "Documents";
49
+ readonly 'filterOption.audio': "Audio";
50
+ readonly 'filterOption.font': "Fonts";
51
+ readonly 'filterOption.svg': "SVG";
52
+ readonly 'sort.name': "Name";
53
+ readonly 'sort.date': "Date";
54
+ readonly 'sort.size': "Size";
55
+ readonly 'breadcrumbs.back': "Back";
56
+ readonly 'breadcrumbs.forward': "Forward";
57
+ /** The first step of the path above the files. */
58
+ readonly 'breadcrumbs.root': "File browser";
59
+ /** What a screen reader says for the path above the files. */
60
+ readonly 'breadcrumbs.label': "breadcrumb";
61
+ readonly 'empty.library': "No files yet!";
62
+ readonly 'empty.libraryFiltered': "No files of this type!";
63
+ readonly 'empty.folder': "No files in this folder!";
64
+ readonly 'library.partialNotice': "Some files could not be loaded.";
65
+ readonly 'library.truncatedNotice': "Only the newest files are shown.";
66
+ readonly 'library.notSetUp': "The media library is not set up correctly.";
67
+ /** The name of the folder that holds the files, when the page's library does not name itself. */
68
+ readonly 'library.defaultLabel': "My uploads";
69
+ /** Why a call to the library failed, when the library gave no reason of its own. */
70
+ readonly 'libraryError.loadFailed': "Could not load the files";
71
+ readonly 'libraryError.uploadFailed': "The upload failed";
72
+ readonly 'libraryError.renameFailed': "Could not rename the file";
73
+ readonly 'libraryError.deleteFailed': "Could not delete the file";
74
+ readonly 'libraryError.unreachable': "Could not reach the media library";
75
+ readonly 'libraryError.timeout': "The media library did not answer in time";
76
+ readonly 'libraryError.renameNotAllowed': "This media library does not allow renaming files";
77
+ readonly 'libraryError.deleteNotAllowed': "This media library does not allow deleting files";
78
+ readonly 'libraryError.fileGone': "The file is no longer in the list";
79
+ readonly 'libraryError.repeatedPage': "The media library keeps returning the same files, so the rest was not loaded";
80
+ readonly 'libraryError.accessToken': "Could not get an access token from the page";
81
+ readonly 'libraryError.accessTokenRenew': "Could not get a fresh access token from the page";
82
+ readonly 'libraryError.fileTooLarge': "Files over {limit} MB cannot be uploaded here yet";
83
+ readonly 'libraryError.uploadNotAllowed': "This media library does not accept uploads";
84
+ readonly 'size.bytes': "{size} Bytes";
85
+ readonly 'size.kb': "{size} KB";
86
+ readonly 'size.mb': "{size} MB";
87
+ readonly 'size.gb': "{size} GB";
88
+ readonly 'size.tb': "{size} TB";
89
+ readonly 'fileKind.any': "any";
90
+ readonly 'fileKind.image': "image";
91
+ readonly 'fileKind.video': "video";
92
+ readonly 'fileKind.audio': "audio";
93
+ readonly 'fileKind.document': "document";
94
+ readonly 'fileKind.font': "font";
95
+ readonly 'fileKind.svg': "SVG";
96
+ /** {types} is a list of extensions (".jpg, .png"). */
97
+ readonly 'fileTypes.allowed': "Allowed types: {types}";
98
+ readonly 'fileTypes.allowedSvg': "Allowed types: SVG files (.svg)";
99
+ readonly 'fileTypes.allowedDocument': "Allowed types: document files ({types})";
100
+ /** One sentence listing every kind with its extensions (each a list joined with "list.separator"). */
101
+ readonly 'fileTypes.addAll': "Add images ({images}), audio ({audio}), video ({video}), documents ({documents}), fonts ({fonts}) or vector graphics ({svg}).";
102
+ readonly 'fileTypes.fontNaming': "Font naming convention:\nFontFamily-Weight.extension\n\nExample:\nGeistMono-Black.ttf";
103
+ /** {types} is the kinds of file taken: the words of "fileKind.*" joined with "list.separator" ("image, video"). */
104
+ readonly 'upload.uploading': "Uploading...";
105
+ readonly 'upload.foldersNotAllowed': "Folders cannot be uploaded";
106
+ readonly 'upload.invalidType': "Invalid file type. Please use {types} files only.";
107
+ readonly 'upload.dropActive': "Drop to upload {types} files";
108
+ readonly 'upload.button': "Upload {types} files";
109
+ readonly 'upload.dragHint': "or drag and drop {types} files here";
110
+ /** On a small screen the sentence is one link. The words of "upload.chooseOrDropLink" inside it are underlined. */
111
+ readonly 'upload.chooseOrDrop': "Upload or drop {types} files here";
112
+ readonly 'upload.chooseOrDropLink': "Upload";
113
+ readonly 'upload.panelTitle': "File Upload Progress";
114
+ readonly 'upload.progress': "{total, plural, other {{done}/# files uploaded}}";
115
+ readonly 'upload.failedCount': "{count} failed";
116
+ readonly 'upload.expandPanel': "Expand panel";
117
+ readonly 'upload.collapsePanel': "Collapse panel";
118
+ readonly 'upload.expandUploader': "Expand uploader";
119
+ readonly 'upload.collapseUploader': "Collapse uploader";
120
+ readonly 'upload.closeUploader': "Close uploader";
121
+ readonly 'upload.cancel': "Cancel upload";
122
+ readonly 'upload.retry': "Retry upload";
123
+ readonly 'upload.retryFailed': "Retry failed uploads?";
124
+ readonly 'upload.clearCompleted': "Clear completed uploads";
125
+ readonly 'upload.completedAlt': "Completed";
126
+ readonly 'upload.networkError': "Network error";
127
+ readonly 'upload.unknownError': "Unknown error";
128
+ readonly 'upload.skippedOne': "Skipped duplicate file: {name}";
129
+ readonly 'upload.skippedMany': "{count, plural, one {Skipped # duplicate file} other {Skipped # duplicate files}}";
130
+ readonly 'upload.time.calculating': "calculating...";
131
+ readonly 'upload.time.lessThanSecond': "less than a second";
132
+ readonly 'upload.time.seconds': "{count, plural, one {# second} other {# seconds}}";
133
+ readonly 'upload.time.minutes': "{count, plural, one {# minute} other {# minutes}}";
134
+ /** {time} is a time from "upload.time.*" ("5 seconds"). */
135
+ readonly 'upload.timeLeft': "{time} left";
136
+ readonly 'upload.complete': "Upload complete.";
137
+ readonly 'upload.removeFile': "Remove file";
138
+ readonly 'upload.uploadingProgress': "{total, plural, other {Uploading {done}/# files}}";
139
+ readonly 'upload.filesTotal': "{count, plural, one {# file} other {# files}}";
140
+ readonly 'upload.completeCount': "{done}/{total} complete";
141
+ readonly 'dialog.delete.folderTitle': "Delete folder";
142
+ readonly 'dialog.delete.itemsTitle': "Delete items";
143
+ readonly 'dialog.delete.fileTitle': "Delete file";
144
+ readonly 'dialog.delete.folderMessage': "Delete '{name}' and all content inside?";
145
+ readonly 'dialog.delete.itemsMessage': "{count, plural, one {Are you sure you want to delete # item?} other {Are you sure you want to delete # items?}}";
146
+ readonly 'dialog.delete.fileMessage': "Delete '{name}'?";
147
+ readonly 'dialog.newFolder.placeholder': "folder name...";
148
+ readonly 'dialog.newFolder.invalidTitle': "Invalid folder name";
149
+ readonly 'dialog.newFolder.required': "Folder name is required";
150
+ readonly 'dialog.newFolder.invalidCharacters': "Folder name can only contain letters, numbers, and spaces";
151
+ /** {max} is put in by the dialog: it knows its own limit. */
152
+ readonly 'dialog.newFolder.tooLong': "Folder name cannot exceed {max} characters";
153
+ /** The hint in the empty name field of the rename window, for a file and for a folder. */
154
+ readonly 'dialog.rename.filePlaceholder': "file name...";
155
+ readonly 'dialog.rename.folderPlaceholder': "folder name...";
156
+ readonly 'dialog.rename.invalidTitle': "Invalid name";
157
+ readonly 'dialog.rename.enterName': "Please enter a name";
158
+ readonly 'dialog.rename.enterDifferentName': "Please enter a different name";
159
+ readonly 'dialog.rename.enterValidName': "Please enter a valid name";
160
+ readonly 'dialog.rename.tooShort': "Name must be at least 1 character long";
161
+ /** {max} is put in by the dialog: it knows its own limit. */
162
+ readonly 'dialog.rename.tooLong': "Name must be {max} characters or less";
163
+ /** What a screen reader says for the X that closes a window. */
164
+ readonly 'dialog.close': "Close modal";
165
+ readonly 'toast.rename.started': "Renaming \"{name}\"...";
166
+ readonly 'toast.rename.done': "Item renamed";
167
+ readonly 'toast.rename.doneDetail': "Successfully renamed \"{oldName}\" to \"{newName}\"";
168
+ readonly 'toast.rename.failed': "Rename failed";
169
+ readonly 'toast.rename.noChange': "No changes were made";
170
+ readonly 'toast.rename.noItem': "No valid item selected";
171
+ readonly 'toast.rename.unknownError': "An unknown error occurred";
172
+ readonly 'toast.delete.started': "{count, plural, one {Deleting \"{name}\"...} other {Deleting # items...}}";
173
+ readonly 'toast.delete.doneFolder': "Deleted folder \"{name}\"";
174
+ readonly 'toast.delete.doneFile': "Deleted \"{name}\"";
175
+ readonly 'toast.delete.doneMany': "{count, plural, one {Deleted # item} other {Deleted # items}}";
176
+ readonly 'toast.delete.doneFolderDetail': "Folder and its contents were deleted successfully";
177
+ readonly 'toast.delete.doneFileDetail': "Item was deleted successfully";
178
+ readonly 'toast.delete.doneManyDetail': "{count, plural, one {# item was deleted successfully} other {# items were deleted successfully}}";
179
+ readonly 'toast.delete.doneNames': "Deleted: {names}";
180
+ readonly 'toast.delete.failedOne': "Failed to delete \"{name}\"";
181
+ readonly 'toast.delete.failedMany': "{count, plural, one {Failed to delete # item} other {Failed to delete # items}}";
182
+ readonly 'toast.delete.failedNames': "Failed to delete: {names}";
183
+ readonly 'toast.delete.failedSome': "Some items could not be deleted";
184
+ readonly 'toast.delete.failedAll': "Failed to delete items";
185
+ readonly 'toast.folder.created': "Folder created";
186
+ readonly 'toast.folder.createdDetail': "Created folder \"{name}\"";
187
+ readonly 'toast.folder.failed': "Failed to create folder";
188
+ readonly 'toast.navigation.failed': "Navigation failed";
189
+ readonly 'toast.navigation.noFolder': "Could not find the target folder location";
190
+ readonly 'toast.navigation.error': "An error occurred while navigating to the target folder";
191
+ readonly 'toast.filesAdded': "Files added";
192
+ readonly 'toast.filesAddedDetail': "{count, plural, one {Added # file to the editor} other {Added # files to the editor}}";
193
+ readonly 'folder.currentLocation': "current location";
194
+ readonly 'folder.open': "Open folder {name}";
195
+ readonly 'folder.empty': "Empty";
196
+ readonly 'folder.itemCount': "{count, plural, one {# item} other {# items}}";
197
+ readonly 'item.previewLabel': "Preview {name}";
198
+ readonly 'item.audioFile': "Audio file";
199
+ readonly 'item.documentFile': "Document file";
200
+ readonly 'item.deleteMissing': "Delete missing file";
201
+ readonly 'item.folder': "Folder";
202
+ readonly 'recent.title': "Recent Files";
203
+ readonly 'recent.empty': "No recent files available!";
204
+ readonly 'newFolder.alt': "New Folder";
205
+ readonly 'newFolder.label': "New folder";
206
+ readonly 'search.noResults': "No results found";
207
+ readonly 'menu.open': "Open menu";
208
+ readonly 'menu.moreOptions': "More options";
209
+ readonly 'toolbar.more': "+{count} more";
210
+ readonly 'toolbar.moveMany': "{count, plural, one {Move # file} other {Move # files}}";
211
+ readonly 'toolbar.deleteMany': "{count, plural, one {Delete # file} other {Delete # files}}";
212
+ readonly 'selectedFiles.title': "Selected files";
213
+ readonly 'selectedFiles.empty': "No files selected";
214
+ readonly 'selectedFiles.count': "{count, plural, one {# file selected} other {# files selected}}";
215
+ readonly 'selectedFiles.confirmMany': "{count, plural, one {Use # file} other {Use # files}}";
216
+ readonly 'searchModal.placeholder': "Search files and folders...";
217
+ readonly 'searchModal.jumpToFolder': "Jump to folder";
218
+ readonly 'searchModal.empty': "No files found";
219
+ /** {name} is the file or folder, cut at 30 characters. */
220
+ readonly 'moveDialog.titleOne': "Move \"{name}\"";
221
+ readonly 'moveDialog.titleMany': "{count, plural, one {Move # item} other {Move # items}}";
222
+ /** The name of the top of the library in the folder list of the move window. */
223
+ readonly 'moveDialog.rootName': "File browser";
224
+ readonly 'moveDialog.movingTo': "Moving to {name}";
225
+ readonly 'moveDialog.confirmFolder': "Move folder";
226
+ readonly 'moveDialog.confirmItem': "Move to folder";
227
+ readonly 'moveDialog.confirmMany': "{count, plural, one {Move # item} other {Move # items}}";
228
+ readonly 'moveDialog.failedFolder': "Failed to move folder";
229
+ readonly 'moveDialog.failedItems': "Failed to move items";
230
+ readonly 'moveDialog.noTarget': "No target folder selected";
231
+ readonly 'moveDialog.noItems': "No items selected to move";
232
+ readonly 'moveDialog.pickDestination': "Please select a destination folder";
233
+ readonly 'moveDialog.noneMoved': "No items were moved successfully";
234
+ readonly 'moveDialog.partialTitle': "Some items moved";
235
+ /** {moved} of {total}. */
236
+ readonly 'moveDialog.partialDetail': "{total, plural, other {Moved {moved} out of # items}}";
237
+ readonly 'moveDialog.doneFolder': "Folder moved";
238
+ readonly 'moveDialog.doneOne': "Item moved";
239
+ readonly 'moveDialog.doneMany': "Items moved";
240
+ readonly 'moveDialog.doneFolderDetail': "Moved folder \"{name}\" successfully";
241
+ readonly 'moveDialog.doneItemsDetail': "{count, plural, one {Moved # item successfully} other {Moved # items successfully}}";
242
+ readonly 'preview.audioFailed': "Audio failed to load";
243
+ readonly 'preview.audioUnsupported': "Your browser does not support the audio element.";
244
+ readonly 'preview.videoFailed': "Video failed to load";
245
+ readonly 'preview.videoUnsupported': "Your browser does not support the video tag.";
246
+ readonly 'preview.errorAlt': "Error";
247
+ readonly 'preview.fileNotFound': "File not found";
248
+ readonly 'preview.loading': "Loading...";
249
+ readonly 'preview.textFailed': "Failed to load text file";
250
+ /** {reason} is what the server said ("Not Found"). */
251
+ readonly 'preview.textFailedReason': "Failed to load text file: {reason}";
252
+ readonly 'preview.unavailable': "Preview not available for this file type.";
253
+ readonly 'preview.pdfLoading': "Loading PDF...";
254
+ readonly 'preview.pdfFailed': "Failed to load PDF";
255
+ /** {page} and {total} are put in by the PDF viewer ({total} is "?" until the number of pages is known). */
256
+ readonly 'preview.pdfPage': "Page {page} of {total}";
257
+ readonly 'preview.pdfPreviousPage': "Previous page";
258
+ readonly 'preview.pdfNextPage': "Next page";
259
+ /** The sentence a font is shown in. Use a sentence that shows the letters of your language. */
260
+ readonly 'fontPreview.sample': "The quick brown fox jumps over the lazy dog";
261
+ readonly 'fontPreview.sampleShort': "The quick fox";
262
+ readonly 'metadata.title': "File Information";
263
+ readonly 'metadata.name': "Name:";
264
+ readonly 'metadata.type': "Type:";
265
+ readonly 'metadata.size': "Size:";
266
+ readonly 'metadata.modified': "Last Modified:";
267
+ readonly 'metadata.notAvailable': "N/A";
268
+ readonly 'date.fewSecondsAgo': "A few seconds ago";
269
+ readonly 'date.hoursAgo': "{count, plural, one {# hour ago} other {# hours ago}}";
270
+ readonly 'date.daysAgo': "{count, plural, one {# day ago} other {# days ago}}";
271
+ readonly 'date.weeksAgo': "{count, plural, one {# week ago} other {# weeks ago}}";
272
+ readonly 'date.aboutAMonthAgo': "About a month ago";
273
+ readonly 'date.severalMonthsAgo': "Several months ago";
274
+ readonly 'date.overAYearAgo': "Over a year ago";
275
+ };
276
+ /** The name of one message. */
277
+ export type FileBrowserMessageKey = keyof typeof FILE_BROWSER_MESSAGES;
@@ -0,0 +1,290 @@
1
+ /**
2
+ * Every word the File Browser shows, in English: the one place to read them, and the keys a page can replace with the
3
+ * `messages` option (or `setLanguage()` of the module).
4
+ *
5
+ * A message is plain text. `{name}` is a value the File Browser puts in; `{count, plural, one {# file} other {# files}}`
6
+ * picks the form that fits a number in the page's language. `\{`, `\}`, `\#` and `\\` write those characters
7
+ * themselves. See `translator.ts` for the whole format.
8
+ *
9
+ * Keys are grouped by where the words appear. A key that is left out of a page's `messages` keeps the English text
10
+ * below, so a language can be added a screen at a time.
11
+ */
12
+ export const FILE_BROWSER_MESSAGES = {
13
+ // ===== Words that appear in several places =====
14
+ 'action.cancel': 'Cancel',
15
+ 'action.confirm': 'Confirm',
16
+ 'action.create': 'Create',
17
+ 'action.delete': 'Delete',
18
+ 'action.done': 'Done',
19
+ 'action.download': 'Download',
20
+ 'action.move': 'Move',
21
+ 'action.rename': 'Rename',
22
+ 'action.tryAgain': 'Try again',
23
+ 'action.preview': 'Preview',
24
+ 'action.play': 'Play',
25
+ 'action.pause': 'Pause',
26
+ 'action.mute': 'Mute',
27
+ 'action.unmute': 'Unmute',
28
+ 'action.select': 'Select',
29
+ 'action.selected': 'Selected',
30
+ 'action.clearItems': 'Clear items',
31
+ /** The button that hands the picked files to the page. The module shows "Select" here. */
32
+ 'action.addToEditor': 'Add to Editor',
33
+ /** Put between names in a list of names ("a.png, b.png"). */
34
+ 'list.separator': ', ',
35
+ 'toast.inBackground': 'This will happen in the background',
36
+ 'toast.unknownError': 'Unknown error occurred',
37
+ // ===== The bar above the files =====
38
+ 'search.placeholder': 'Search...',
39
+ 'filter.by': 'Filter by {type}',
40
+ 'filterName.all': 'All',
41
+ 'filterName.image': 'Image',
42
+ 'filterName.audio': 'Audio',
43
+ 'filterName.video': 'Video',
44
+ 'filterName.document': 'Document',
45
+ 'filterName.font': 'Font',
46
+ 'filterName.svg': 'SVG',
47
+ 'filterOption.all': 'All',
48
+ 'filterOption.image': 'Images',
49
+ 'filterOption.video': 'Videos',
50
+ 'filterOption.document': 'Documents',
51
+ 'filterOption.audio': 'Audio',
52
+ 'filterOption.font': 'Fonts',
53
+ 'filterOption.svg': 'SVG',
54
+ 'sort.name': 'Name',
55
+ 'sort.date': 'Date',
56
+ 'sort.size': 'Size',
57
+ 'breadcrumbs.back': 'Back',
58
+ 'breadcrumbs.forward': 'Forward',
59
+ /** The first step of the path above the files. */
60
+ 'breadcrumbs.root': 'File browser',
61
+ /** What a screen reader says for the path above the files. */
62
+ 'breadcrumbs.label': 'breadcrumb',
63
+ // ===== What the list says when there is nothing to show =====
64
+ 'empty.library': 'No files yet!',
65
+ 'empty.libraryFiltered': 'No files of this type!',
66
+ 'empty.folder': 'No files in this folder!',
67
+ // ===== The page's own media library =====
68
+ 'library.partialNotice': 'Some files could not be loaded.',
69
+ 'library.truncatedNotice': 'Only the newest files are shown.',
70
+ 'library.notSetUp': 'The media library is not set up correctly.',
71
+ /** The name of the folder that holds the files, when the page's library does not name itself. */
72
+ 'library.defaultLabel': 'My uploads',
73
+ /** Why a call to the library failed, when the library gave no reason of its own. */
74
+ 'libraryError.loadFailed': 'Could not load the files',
75
+ 'libraryError.uploadFailed': 'The upload failed',
76
+ 'libraryError.renameFailed': 'Could not rename the file',
77
+ 'libraryError.deleteFailed': 'Could not delete the file',
78
+ 'libraryError.unreachable': 'Could not reach the media library',
79
+ 'libraryError.timeout': 'The media library did not answer in time',
80
+ 'libraryError.renameNotAllowed': 'This media library does not allow renaming files',
81
+ 'libraryError.deleteNotAllowed': 'This media library does not allow deleting files',
82
+ 'libraryError.fileGone': 'The file is no longer in the list',
83
+ 'libraryError.repeatedPage': 'The media library keeps returning the same files, so the rest was not loaded',
84
+ 'libraryError.accessToken': 'Could not get an access token from the page',
85
+ 'libraryError.accessTokenRenew': 'Could not get a fresh access token from the page',
86
+ 'libraryError.fileTooLarge': 'Files over {limit} MB cannot be uploaded here yet',
87
+ 'libraryError.uploadNotAllowed': 'This media library does not accept uploads',
88
+ // ===== Sizes of files: {size} is the number, written the way the language writes numbers =====
89
+ 'size.bytes': '{size} Bytes',
90
+ 'size.kb': '{size} KB',
91
+ 'size.mb': '{size} MB',
92
+ 'size.gb': '{size} GB',
93
+ 'size.tb': '{size} TB',
94
+ // ===== The kinds of file, as they appear inside a sentence ("Upload image files") =====
95
+ 'fileKind.any': 'any',
96
+ 'fileKind.image': 'image',
97
+ 'fileKind.video': 'video',
98
+ 'fileKind.audio': 'audio',
99
+ 'fileKind.document': 'document',
100
+ 'fileKind.font': 'font',
101
+ 'fileKind.svg': 'SVG',
102
+ /** {types} is a list of extensions (".jpg, .png"). */
103
+ 'fileTypes.allowed': 'Allowed types: {types}',
104
+ 'fileTypes.allowedSvg': 'Allowed types: SVG files (.svg)',
105
+ 'fileTypes.allowedDocument': 'Allowed types: document files ({types})',
106
+ /** One sentence listing every kind with its extensions (each a list joined with "list.separator"). */
107
+ 'fileTypes.addAll': 'Add images ({images}), audio ({audio}), video ({video}), documents ({documents}), fonts ({fonts}) or vector graphics ({svg}).',
108
+ 'fileTypes.fontNaming': 'Font naming convention:\nFontFamily-Weight.extension\n\nExample:\nGeistMono-Black.ttf',
109
+ // ===== Uploading =====
110
+ /** {types} is the kinds of file taken: the words of "fileKind.*" joined with "list.separator" ("image, video"). */
111
+ 'upload.uploading': 'Uploading...',
112
+ 'upload.foldersNotAllowed': 'Folders cannot be uploaded',
113
+ 'upload.invalidType': 'Invalid file type. Please use {types} files only.',
114
+ 'upload.dropActive': 'Drop to upload {types} files',
115
+ 'upload.button': 'Upload {types} files',
116
+ 'upload.dragHint': 'or drag and drop {types} files here',
117
+ /** On a small screen the sentence is one link. The words of "upload.chooseOrDropLink" inside it are underlined. */
118
+ 'upload.chooseOrDrop': 'Upload or drop {types} files here',
119
+ 'upload.chooseOrDropLink': 'Upload',
120
+ 'upload.panelTitle': 'File Upload Progress',
121
+ 'upload.progress': '{total, plural, other {{done}/# files uploaded}}',
122
+ 'upload.failedCount': '{count} failed',
123
+ 'upload.expandPanel': 'Expand panel',
124
+ 'upload.collapsePanel': 'Collapse panel',
125
+ 'upload.expandUploader': 'Expand uploader',
126
+ 'upload.collapseUploader': 'Collapse uploader',
127
+ 'upload.closeUploader': 'Close uploader',
128
+ 'upload.cancel': 'Cancel upload',
129
+ 'upload.retry': 'Retry upload',
130
+ 'upload.retryFailed': 'Retry failed uploads?',
131
+ 'upload.clearCompleted': 'Clear completed uploads',
132
+ 'upload.completedAlt': 'Completed',
133
+ 'upload.networkError': 'Network error',
134
+ 'upload.unknownError': 'Unknown error',
135
+ 'upload.skippedOne': 'Skipped duplicate file: {name}',
136
+ 'upload.skippedMany': '{count, plural, one {Skipped # duplicate file} other {Skipped # duplicate files}}',
137
+ 'upload.time.calculating': 'calculating...',
138
+ 'upload.time.lessThanSecond': 'less than a second',
139
+ 'upload.time.seconds': '{count, plural, one {# second} other {# seconds}}',
140
+ 'upload.time.minutes': '{count, plural, one {# minute} other {# minutes}}',
141
+ /** {time} is a time from "upload.time.*" ("5 seconds"). */
142
+ 'upload.timeLeft': '{time} left',
143
+ 'upload.complete': 'Upload complete.',
144
+ 'upload.removeFile': 'Remove file',
145
+ 'upload.uploadingProgress': '{total, plural, other {Uploading {done}/# files}}',
146
+ 'upload.filesTotal': '{count, plural, one {# file} other {# files}}',
147
+ 'upload.completeCount': '{done}/{total} complete',
148
+ // ===== Asking before a change =====
149
+ 'dialog.delete.folderTitle': 'Delete folder',
150
+ 'dialog.delete.itemsTitle': 'Delete items',
151
+ 'dialog.delete.fileTitle': 'Delete file',
152
+ 'dialog.delete.folderMessage': "Delete '{name}' and all content inside?",
153
+ 'dialog.delete.itemsMessage': '{count, plural, one {Are you sure you want to delete # item?} other {Are you sure you want to delete # items?}}',
154
+ 'dialog.delete.fileMessage': "Delete '{name}'?",
155
+ 'dialog.newFolder.placeholder': 'folder name...',
156
+ 'dialog.newFolder.invalidTitle': 'Invalid folder name',
157
+ 'dialog.newFolder.required': 'Folder name is required',
158
+ 'dialog.newFolder.invalidCharacters': 'Folder name can only contain letters, numbers, and spaces',
159
+ /** {max} is put in by the dialog: it knows its own limit. */
160
+ 'dialog.newFolder.tooLong': 'Folder name cannot exceed {max} characters',
161
+ /** The hint in the empty name field of the rename window, for a file and for a folder. */
162
+ 'dialog.rename.filePlaceholder': 'file name...',
163
+ 'dialog.rename.folderPlaceholder': 'folder name...',
164
+ 'dialog.rename.invalidTitle': 'Invalid name',
165
+ 'dialog.rename.enterName': 'Please enter a name',
166
+ 'dialog.rename.enterDifferentName': 'Please enter a different name',
167
+ 'dialog.rename.enterValidName': 'Please enter a valid name',
168
+ 'dialog.rename.tooShort': 'Name must be at least 1 character long',
169
+ /** {max} is put in by the dialog: it knows its own limit. */
170
+ 'dialog.rename.tooLong': 'Name must be {max} characters or less',
171
+ /** What a screen reader says for the X that closes a window. */
172
+ 'dialog.close': 'Close modal',
173
+ // ===== Messages that pop up after an action =====
174
+ 'toast.rename.started': 'Renaming "{name}"...',
175
+ 'toast.rename.done': 'Item renamed',
176
+ 'toast.rename.doneDetail': 'Successfully renamed "{oldName}" to "{newName}"',
177
+ 'toast.rename.failed': 'Rename failed',
178
+ 'toast.rename.noChange': 'No changes were made',
179
+ 'toast.rename.noItem': 'No valid item selected',
180
+ 'toast.rename.unknownError': 'An unknown error occurred',
181
+ 'toast.delete.started': '{count, plural, one {Deleting "{name}"...} other {Deleting # items...}}',
182
+ 'toast.delete.doneFolder': 'Deleted folder "{name}"',
183
+ 'toast.delete.doneFile': 'Deleted "{name}"',
184
+ 'toast.delete.doneMany': '{count, plural, one {Deleted # item} other {Deleted # items}}',
185
+ 'toast.delete.doneFolderDetail': 'Folder and its contents were deleted successfully',
186
+ 'toast.delete.doneFileDetail': 'Item was deleted successfully',
187
+ 'toast.delete.doneManyDetail': '{count, plural, one {# item was deleted successfully} other {# items were deleted successfully}}',
188
+ 'toast.delete.doneNames': 'Deleted: {names}',
189
+ 'toast.delete.failedOne': 'Failed to delete "{name}"',
190
+ 'toast.delete.failedMany': '{count, plural, one {Failed to delete # item} other {Failed to delete # items}}',
191
+ 'toast.delete.failedNames': 'Failed to delete: {names}',
192
+ 'toast.delete.failedSome': 'Some items could not be deleted',
193
+ 'toast.delete.failedAll': 'Failed to delete items',
194
+ 'toast.folder.created': 'Folder created',
195
+ 'toast.folder.createdDetail': 'Created folder "{name}"',
196
+ 'toast.folder.failed': 'Failed to create folder',
197
+ 'toast.navigation.failed': 'Navigation failed',
198
+ 'toast.navigation.noFolder': 'Could not find the target folder location',
199
+ 'toast.navigation.error': 'An error occurred while navigating to the target folder',
200
+ 'toast.filesAdded': 'Files added',
201
+ 'toast.filesAddedDetail': '{count, plural, one {Added # file to the editor} other {Added # files to the editor}}',
202
+ // ===== Folders and items in the list =====
203
+ 'folder.currentLocation': 'current location',
204
+ 'folder.open': 'Open folder {name}',
205
+ 'folder.empty': 'Empty',
206
+ 'folder.itemCount': '{count, plural, one {# item} other {# items}}',
207
+ 'item.previewLabel': 'Preview {name}',
208
+ 'item.audioFile': 'Audio file',
209
+ 'item.documentFile': 'Document file',
210
+ 'item.deleteMissing': 'Delete missing file',
211
+ 'item.folder': 'Folder',
212
+ 'recent.title': 'Recent Files',
213
+ 'recent.empty': 'No recent files available!',
214
+ 'newFolder.alt': 'New Folder',
215
+ 'newFolder.label': 'New folder',
216
+ 'search.noResults': 'No results found',
217
+ 'menu.open': 'Open menu',
218
+ 'menu.moreOptions': 'More options',
219
+ // ===== The bar over a selection, and the list of selected files =====
220
+ 'toolbar.more': '+{count} more',
221
+ 'toolbar.moveMany': '{count, plural, one {Move # file} other {Move # files}}',
222
+ 'toolbar.deleteMany': '{count, plural, one {Delete # file} other {Delete # files}}',
223
+ 'selectedFiles.title': 'Selected files',
224
+ 'selectedFiles.empty': 'No files selected',
225
+ 'selectedFiles.count': '{count, plural, one {# file selected} other {# files selected}}',
226
+ 'selectedFiles.confirmMany': '{count, plural, one {Use # file} other {Use # files}}',
227
+ // ===== Search window =====
228
+ 'searchModal.placeholder': 'Search files and folders...',
229
+ 'searchModal.jumpToFolder': 'Jump to folder',
230
+ 'searchModal.empty': 'No files found',
231
+ // ===== Moving files =====
232
+ /** {name} is the file or folder, cut at 30 characters. */
233
+ 'moveDialog.titleOne': 'Move "{name}"',
234
+ 'moveDialog.titleMany': '{count, plural, one {Move # item} other {Move # items}}',
235
+ /** The name of the top of the library in the folder list of the move window. */
236
+ 'moveDialog.rootName': 'File browser',
237
+ 'moveDialog.movingTo': 'Moving to {name}',
238
+ 'moveDialog.confirmFolder': 'Move folder',
239
+ 'moveDialog.confirmItem': 'Move to folder',
240
+ 'moveDialog.confirmMany': '{count, plural, one {Move # item} other {Move # items}}',
241
+ 'moveDialog.failedFolder': 'Failed to move folder',
242
+ 'moveDialog.failedItems': 'Failed to move items',
243
+ 'moveDialog.noTarget': 'No target folder selected',
244
+ 'moveDialog.noItems': 'No items selected to move',
245
+ 'moveDialog.pickDestination': 'Please select a destination folder',
246
+ 'moveDialog.noneMoved': 'No items were moved successfully',
247
+ 'moveDialog.partialTitle': 'Some items moved',
248
+ /** {moved} of {total}. */
249
+ 'moveDialog.partialDetail': '{total, plural, other {Moved {moved} out of # items}}',
250
+ 'moveDialog.doneFolder': 'Folder moved',
251
+ 'moveDialog.doneOne': 'Item moved',
252
+ 'moveDialog.doneMany': 'Items moved',
253
+ 'moveDialog.doneFolderDetail': 'Moved folder "{name}" successfully',
254
+ 'moveDialog.doneItemsDetail': '{count, plural, one {Moved # item successfully} other {Moved # items successfully}}',
255
+ // ===== Previews =====
256
+ 'preview.audioFailed': 'Audio failed to load',
257
+ 'preview.audioUnsupported': 'Your browser does not support the audio element.',
258
+ 'preview.videoFailed': 'Video failed to load',
259
+ 'preview.videoUnsupported': 'Your browser does not support the video tag.',
260
+ 'preview.errorAlt': 'Error',
261
+ 'preview.fileNotFound': 'File not found',
262
+ 'preview.loading': 'Loading...',
263
+ 'preview.textFailed': 'Failed to load text file',
264
+ /** {reason} is what the server said ("Not Found"). */
265
+ 'preview.textFailedReason': 'Failed to load text file: {reason}',
266
+ 'preview.unavailable': 'Preview not available for this file type.',
267
+ 'preview.pdfLoading': 'Loading PDF...',
268
+ 'preview.pdfFailed': 'Failed to load PDF',
269
+ /** {page} and {total} are put in by the PDF viewer ({total} is "?" until the number of pages is known). */
270
+ 'preview.pdfPage': 'Page {page} of {total}',
271
+ 'preview.pdfPreviousPage': 'Previous page',
272
+ 'preview.pdfNextPage': 'Next page',
273
+ /** The sentence a font is shown in. Use a sentence that shows the letters of your language. */
274
+ 'fontPreview.sample': 'The quick brown fox jumps over the lazy dog',
275
+ 'fontPreview.sampleShort': 'The quick fox',
276
+ 'metadata.title': 'File Information',
277
+ 'metadata.name': 'Name:',
278
+ 'metadata.type': 'Type:',
279
+ 'metadata.size': 'Size:',
280
+ 'metadata.modified': 'Last Modified:',
281
+ 'metadata.notAvailable': 'N/A',
282
+ // ===== How long ago =====
283
+ 'date.fewSecondsAgo': 'A few seconds ago',
284
+ 'date.hoursAgo': '{count, plural, one {# hour ago} other {# hours ago}}',
285
+ 'date.daysAgo': '{count, plural, one {# day ago} other {# days ago}}',
286
+ 'date.weeksAgo': '{count, plural, one {# week ago} other {# weeks ago}}',
287
+ 'date.aboutAMonthAgo': 'About a month ago',
288
+ 'date.severalMonthsAgo': 'Several months ago',
289
+ 'date.overAYearAgo': 'Over a year ago'
290
+ };