@firecms/media_manager 3.1.0 → 3.2.0-canary.4c3b8f2

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.
@@ -13,6 +13,7 @@ import {
13
13
  AppsIcon,
14
14
  Icon
15
15
  } from "@firecms/ui";
16
+ import { useTranslation } from "@firecms/core";
16
17
  import { useMediaManager } from "../MediaManagerProvider";
17
18
  import { MediaAssetCard } from "./MediaAssetCard";
18
19
  import { MediaAssetDetails } from "./MediaAssetDetails";
@@ -35,6 +36,7 @@ export function MediaLibraryView({
35
36
  const [uploadDialogOpen, setUploadDialogOpen] = useState(false);
36
37
  const [viewMode, setViewMode] = useState<"grid" | "list">("grid");
37
38
  const fileInputRef = useRef<HTMLInputElement>(null);
39
+ const { t } = useTranslation();
38
40
 
39
41
  const handleSearch = useCallback((query?: string) => {
40
42
  controller.searchAssets(query ?? "");
@@ -64,14 +66,14 @@ export function MediaLibraryView({
64
66
  <div className="flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between">
65
67
  <div className="flex items-center gap-3">
66
68
  <Typography variant="h5" className="font-semibold">
67
- Media Library
69
+ {t("media_library")}
68
70
  </Typography>
69
71
  {controller.totalCount !== undefined && (
70
72
  <Typography
71
73
  variant="caption"
72
74
  className="bg-surface-accent-100 dark:bg-surface-accent-800 px-2 py-0.5 rounded-full"
73
75
  >
74
- {controller.totalCount} assets
76
+ {t("media_assets_count", { count: controller.totalCount.toString() })}
75
77
  </Typography>
76
78
  )}
77
79
  </div>
@@ -79,13 +81,13 @@ export function MediaLibraryView({
79
81
  <div className="flex items-center gap-2 w-full sm:w-auto">
80
82
  <SearchBar
81
83
  onTextSearch={handleSearch}
82
- placeholder="Search assets..."
84
+ placeholder={t("media_search_assets")}
83
85
  className="flex-1 sm:w-64"
84
86
  />
85
87
 
86
88
  <div
87
89
  className="flex items-center gap-1 border-l border-surface-accent-200 dark:border-surface-accent-700 pl-2 ml-2">
88
- <Tooltip title="Grid view">
90
+ <Tooltip title={t("media_grid_view")}>
89
91
  <IconButton
90
92
  onClick={() => setViewMode("grid")}
91
93
  className={cls(
@@ -95,7 +97,7 @@ export function MediaLibraryView({
95
97
  <AppsIcon size="small"/>
96
98
  </IconButton>
97
99
  </Tooltip>
98
- <Tooltip title="List view">
100
+ <Tooltip title={t("media_list_view")}>
99
101
  <IconButton
100
102
  onClick={() => setViewMode("list")}
101
103
  className={cls(
@@ -107,7 +109,7 @@ export function MediaLibraryView({
107
109
  </Tooltip>
108
110
  </div>
109
111
 
110
- <Tooltip title="Refresh">
112
+ <Tooltip title={t("media_refresh")}>
111
113
  <IconButton onClick={handleRefresh} disabled={controller.loading}>
112
114
  <RefreshIcon size="small"/>
113
115
  </IconButton>
@@ -118,7 +120,7 @@ export function MediaLibraryView({
118
120
  onClick={handleUploadClick}
119
121
  >
120
122
  <AddIcon size="small"/>
121
- Upload
123
+ {t("media_upload")}
122
124
  </Button>
123
125
  </div>
124
126
  </div>
@@ -135,20 +137,20 @@ export function MediaLibraryView({
135
137
  ) : controller.error ? (
136
138
  <div className="flex flex-col items-center justify-center h-64 gap-4">
137
139
  <Typography className="text-red-500">
138
- Error loading assets: {controller.error.message}
140
+ {t("media_error_loading", { message: controller.error.message })}
139
141
  </Typography>
140
142
  <Button onClick={handleRefresh}>
141
- Try Again
143
+ {t("media_try_again")}
142
144
  </Button>
143
145
  </div>
144
146
  ) : controller.assets.length === 0 ? (
145
147
  <div className="flex flex-col items-center justify-center h-64 gap-4">
146
148
  <Typography className="text-surface-accent-500">
147
- No media assets yet
149
+ {t("media_no_assets")}
148
150
  </Typography>
149
151
  <Button onClick={handleUploadClick}>
150
152
  <AddIcon size="small"/>
151
- Upload your first file
153
+ {t("media_upload_first_file")}
152
154
  </Button>
153
155
  </div>
154
156
  ) : (
@@ -9,6 +9,7 @@ import {
9
9
  CloudUploadIcon,
10
10
  CircularProgress
11
11
  } from "@firecms/ui";
12
+ import { useTranslation } from "@firecms/core";
12
13
 
13
14
  export interface MediaUploadDialogProps {
14
15
  open: boolean;
@@ -33,6 +34,7 @@ export function MediaUploadDialog({
33
34
  const [uploading, setUploading] = useState(false);
34
35
  const [error, setError] = useState<string | null>(null);
35
36
  const [selectedFiles, setSelectedFiles] = useState<File[]>([]);
37
+ const { t } = useTranslation();
36
38
 
37
39
  const validateFiles = useCallback((files: File[]): { valid: File[]; errors: string[] } => {
38
40
  const valid: File[] = [];
@@ -40,7 +42,7 @@ export function MediaUploadDialog({
40
42
 
41
43
  for (const file of files) {
42
44
  if (maxFileSize && file.size > maxFileSize) {
43
- errors.push(`${file.name}: File too large (max ${formatSize(maxFileSize)})`);
45
+ errors.push(t("media_file_too_large", { name: file.name, size: formatSize(maxFileSize) }));
44
46
  continue;
45
47
  }
46
48
  if (acceptedMimeTypes && !acceptedMimeTypes.some(type => {
@@ -49,7 +51,7 @@ export function MediaUploadDialog({
49
51
  }
50
52
  return file.type === type;
51
53
  })) {
52
- errors.push(`${file.name}: File type not allowed`);
54
+ errors.push(t("media_file_type_not_allowed", { name: file.name }));
53
55
  continue;
54
56
  }
55
57
  valid.push(file);
@@ -112,7 +114,7 @@ export function MediaUploadDialog({
112
114
  setSelectedFiles([]);
113
115
  onClose();
114
116
  } catch (err) {
115
- setError(err instanceof Error ? err.message : "Upload failed");
117
+ setError(err instanceof Error ? err.message : t("media_upload_failed"));
116
118
  } finally {
117
119
  setUploading(false);
118
120
  }
@@ -141,7 +143,7 @@ export function MediaUploadDialog({
141
143
  <DialogContent className="p-0">
142
144
  <div className="p-4 border-b border-surface-accent-200 dark:border-surface-accent-700">
143
145
  <Typography variant="h6">
144
- Upload Files
146
+ {t("media_upload_files")}
145
147
  </Typography>
146
148
  </div>
147
149
 
@@ -171,10 +173,10 @@ export function MediaUploadDialog({
171
173
  />
172
174
  <div className="text-center">
173
175
  <Typography variant="body1" className="font-medium">
174
- Drop files here or click to browse
176
+ {t("media_drop_files")}
175
177
  </Typography>
176
178
  <Typography variant="caption" className="text-surface-accent-500">
177
- Maximum file size: {formatSize(maxFileSize)}
179
+ {t("media_max_file_size", { size: formatSize(maxFileSize) })}
178
180
  </Typography>
179
181
  </div>
180
182
  <input
@@ -198,7 +200,7 @@ export function MediaUploadDialog({
198
200
  {selectedFiles.length > 0 && (
199
201
  <div className="mt-4 space-y-2">
200
202
  <Typography variant="caption" className="text-surface-accent-500">
201
- Selected files ({selectedFiles.length})
203
+ {t("media_selected_files_count", { count: selectedFiles.length.toString() })}
202
204
  </Typography>
203
205
  <div className="max-h-40 overflow-auto space-y-1">
204
206
  {selectedFiles.map((file, index) => (
@@ -226,7 +228,7 @@ export function MediaUploadDialog({
226
228
  }}
227
229
  disabled={uploading}
228
230
  >
229
- Remove
231
+ {t("media_remove")}
230
232
  </Button>
231
233
  </div>
232
234
  ))}
@@ -242,7 +244,7 @@ export function MediaUploadDialog({
242
244
  onClick={handleClose}
243
245
  disabled={uploading}
244
246
  >
245
- Cancel
247
+ {t("cancel")}
246
248
  </Button>
247
249
  <Button
248
250
  variant="filled"
@@ -252,10 +254,10 @@ export function MediaUploadDialog({
252
254
  {uploading ? (
253
255
  <>
254
256
  <CircularProgress size="smallest" />
255
- Uploading...
257
+ {t("media_uploading")}
256
258
  </>
257
259
  ) : (
258
- `Upload ${selectedFiles.length > 0 ? `(${selectedFiles.length})` : ""}`
260
+ `${t("media_upload")} ${selectedFiles.length > 0 ? `(${selectedFiles.length})` : ""}`
259
261
  )}
260
262
  </Button>
261
263
  </DialogActions>
@@ -0,0 +1,45 @@
1
+ export const mediaManagerTranslationsDe = {
2
+ media_library: "Mediathek",
3
+ media_library_description: "Bilder und Dateien verwalten",
4
+ media_search_assets: "Assets durchsuchen...",
5
+ media_grid_view: "Rasteransicht",
6
+ media_list_view: "Listenansicht",
7
+ media_refresh: "Aktualisieren",
8
+ media_upload: "Hochladen",
9
+ media_error_loading: "Fehler beim Laden der Assets: {{message}}",
10
+ media_try_again: "Erneut versuchen",
11
+ media_no_assets: "Noch keine Medien-Assets",
12
+ media_upload_first_file: "Laden Sie Ihre erste Datei hoch",
13
+ media_asset_updated: "Asset erfolgreich aktualisiert",
14
+ media_error_updating: "Fehler beim Aktualisieren des Assets: {{message}}",
15
+ media_asset_deleted: "Asset erfolgreich gelöscht",
16
+ media_error_deleting: "Fehler beim Löschen des Assets: {{message}}",
17
+ media_error_getting_url: "Fehler beim Abrufen der Download-URL",
18
+ media_preview_not_available: "Vorschau nicht verfügbar",
19
+ media_dimensions: "Abmessungen",
20
+ media_size: "Größe",
21
+ media_type: "Typ",
22
+ media_created: "Erstellt",
23
+ media_file_name: "Dateiname",
24
+ media_title: "Titel",
25
+ media_alt_text: "Alternativtext",
26
+ media_recommended_seo: "Empfohlen für SEO",
27
+ media_caption: "Bildunterschrift",
28
+ media_tags: "Schlagwörter",
29
+ media_add_tag: "Schlagwort hinzufügen...",
30
+ media_add: "Hinzufügen",
31
+ media_save_changes: "Änderungen speichern",
32
+ media_delete_asset: "Asset löschen?",
33
+ media_delete_confirmation: "Sind Sie sicher, dass Sie \"{{name}}\" löschen möchten? Diese Aktion kann nicht rückgängig gemacht werden.",
34
+ media_file_too_large: "{{name}}: Datei ist zu groß (max. {{size}})",
35
+ media_file_type_not_allowed: "{{name}}: Dateityp nicht zulässig",
36
+ media_upload_failed: "Hochladen fehlgeschlagen",
37
+ media_upload_files: "Dateien hochladen",
38
+ media_drop_files: "Dateien hier ablegen oder zum Durchsuchen klicken",
39
+ media_max_file_size: "Maximale Dateigröße: {{size}}",
40
+ media_selected_files_count: "Ausgewählte Dateien ({{count}})",
41
+ media_remove: "Entfernen",
42
+ media_uploading: "Wird hochgeladen...",
43
+ media_manage_description: "Verwalten Sie Ihre Mediendateien und Assets",
44
+ media_assets_count: "{{count}} Assets"
45
+ };
@@ -0,0 +1,45 @@
1
+ export const mediaManagerTranslationsEn = {
2
+ media_library: "Media Library",
3
+ media_library_description: "Manage images and files",
4
+ media_search_assets: "Search assets...",
5
+ media_grid_view: "Grid view",
6
+ media_list_view: "List view",
7
+ media_refresh: "Refresh",
8
+ media_upload: "Upload",
9
+ media_error_loading: "Error loading assets: {{message}}",
10
+ media_try_again: "Try Again",
11
+ media_no_assets: "No media assets yet",
12
+ media_upload_first_file: "Upload your first file",
13
+ media_asset_updated: "Asset updated successfully",
14
+ media_error_updating: "Error updating asset: {{message}}",
15
+ media_asset_deleted: "Asset deleted successfully",
16
+ media_error_deleting: "Error deleting asset: {{message}}",
17
+ media_error_getting_url: "Error getting download URL",
18
+ media_preview_not_available: "Preview not available",
19
+ media_dimensions: "Dimensions",
20
+ media_size: "Size",
21
+ media_type: "Type",
22
+ media_created: "Created",
23
+ media_file_name: "File Name",
24
+ media_title: "Title",
25
+ media_alt_text: "Alt Text",
26
+ media_recommended_seo: "Recommended for SEO",
27
+ media_caption: "Caption",
28
+ media_tags: "Tags",
29
+ media_add_tag: "Add a tag...",
30
+ media_add: "Add",
31
+ media_save_changes: "Save Changes",
32
+ media_delete_asset: "Delete Asset?",
33
+ media_delete_confirmation: "Are you sure you want to delete \"{{name}}\"? This action cannot be undone.",
34
+ media_file_too_large: "{{name}}: File too large (max {{size}})",
35
+ media_file_type_not_allowed: "{{name}}: File type not allowed",
36
+ media_upload_failed: "Upload failed",
37
+ media_upload_files: "Upload Files",
38
+ media_drop_files: "Drop files here or click to browse",
39
+ media_max_file_size: "Maximum file size: {{size}}",
40
+ media_selected_files_count: "Selected files ({{count}})",
41
+ media_remove: "Remove",
42
+ media_uploading: "Uploading...",
43
+ media_manage_description: "Manage your media files and assets",
44
+ media_assets_count: "{{count}} assets"
45
+ };
@@ -0,0 +1,45 @@
1
+ export const mediaManagerTranslationsEs = {
2
+ media_library: "Biblioteca de Medios",
3
+ media_library_description: "Gestionar imágenes y archivos",
4
+ media_search_assets: "Buscar recursos...",
5
+ media_grid_view: "Vista de cuadrícula",
6
+ media_list_view: "Vista de lista",
7
+ media_refresh: "Actualizar",
8
+ media_upload: "Subir",
9
+ media_error_loading: "Error al cargar recursos: {{message}}",
10
+ media_try_again: "Volver a intentar",
11
+ media_no_assets: "Aún no hay recursos multimedia",
12
+ media_upload_first_file: "Sube tu primer archivo",
13
+ media_asset_updated: "Recurso actualizado con éxito",
14
+ media_error_updating: "Error al actualizar recurso: {{message}}",
15
+ media_asset_deleted: "Recurso eliminado con éxito",
16
+ media_error_deleting: "Error al eliminar recurso: {{message}}",
17
+ media_error_getting_url: "Error al obtener URL de descarga",
18
+ media_preview_not_available: "Vista previa no disponible",
19
+ media_dimensions: "Dimensiones",
20
+ media_size: "Tamaño",
21
+ media_type: "Tipo",
22
+ media_created: "Creado",
23
+ media_file_name: "Nombre del archivo",
24
+ media_title: "Título",
25
+ media_alt_text: "Texto alternativo",
26
+ media_recommended_seo: "Recomendado para SEO",
27
+ media_caption: "Leyenda",
28
+ media_tags: "Etiquetas",
29
+ media_add_tag: "Añadir una etiqueta...",
30
+ media_add: "Añadir",
31
+ media_save_changes: "Guardar cambios",
32
+ media_delete_asset: "¿Eliminar recurso?",
33
+ media_delete_confirmation: "¿Estás seguro de que deseas eliminar \"{{name}}\"? Esta acción no se puede deshacer.",
34
+ media_file_too_large: "{{name}}: Archivo demasiado grande (máx. {{size}})",
35
+ media_file_type_not_allowed: "{{name}}: Tipo de archivo no permitido",
36
+ media_upload_failed: "Error al subir",
37
+ media_upload_files: "Subir archivos",
38
+ media_drop_files: "Suelta archivos aquí o haz clic para buscar",
39
+ media_max_file_size: "Tamaño máximo de archivo: {{size}}",
40
+ media_selected_files_count: "Archivos seleccionados ({{count}})",
41
+ media_remove: "Quitar",
42
+ media_uploading: "Subiendo...",
43
+ media_manage_description: "Gestiona tus archivos y recursos multimedia",
44
+ media_assets_count: "{{count}} recursos"
45
+ };
@@ -0,0 +1,45 @@
1
+ export const mediaManagerTranslationsFr = {
2
+ media_library: "Médiathèque",
3
+ media_library_description: "Gérer les images et les fichiers",
4
+ media_search_assets: "Rechercher des éléments...",
5
+ media_grid_view: "Vue en grille",
6
+ media_list_view: "Vue en liste",
7
+ media_refresh: "Rafraîchir",
8
+ media_upload: "Télécharger",
9
+ media_error_loading: "Erreur lors du chargement des éléments : {{message}}",
10
+ media_try_again: "Réessayer",
11
+ media_no_assets: "Pas encore d'éléments multimédias",
12
+ media_upload_first_file: "Téléchargez votre premier fichier",
13
+ media_asset_updated: "Élément mis à jour avec succès",
14
+ media_error_updating: "Erreur lors de la mise à jour de l'élément : {{message}}",
15
+ media_asset_deleted: "Élément supprimé avec succès",
16
+ media_error_deleting: "Erreur lors de la suppression de l'élément : {{message}}",
17
+ media_error_getting_url: "Erreur lors de l'obtention de l'URL de téléchargement",
18
+ media_preview_not_available: "Aperçu non disponible",
19
+ media_dimensions: "Dimensions",
20
+ media_size: "Taille",
21
+ media_type: "Type",
22
+ media_created: "Créé",
23
+ media_file_name: "Nom du fichier",
24
+ media_title: "Titre",
25
+ media_alt_text: "Texte alternatif",
26
+ media_recommended_seo: "Recommandé pour le référencement (SEO)",
27
+ media_caption: "Légende",
28
+ media_tags: "Balises",
29
+ media_add_tag: "Ajouter une balise...",
30
+ media_add: "Ajouter",
31
+ media_save_changes: "Enregistrer les modifications",
32
+ media_delete_asset: "Supprimer l'élément ?",
33
+ media_delete_confirmation: "Êtes-vous sûr de vouloir supprimer \"{{name}}\" ? Cette action ne peut pas être annulée.",
34
+ media_file_too_large: "{{name}} : Fichier trop volumineux (max {{size}})",
35
+ media_file_type_not_allowed: "{{name}} : Type de fichier non autorisé",
36
+ media_upload_failed: "Le téléchargement a échoué",
37
+ media_upload_files: "Télécharger des fichiers",
38
+ media_drop_files: "Déposez les fichiers ici ou cliquez pour parcourir",
39
+ media_max_file_size: "Taille maximale du fichier : {{size}}",
40
+ media_selected_files_count: "Fichiers sélectionnés ({{count}})",
41
+ media_remove: "Retirer",
42
+ media_uploading: "Téléchargement en cours...",
43
+ media_manage_description: "Gérez vos fichiers et éléments multimédias",
44
+ media_assets_count: "{{count}} éléments"
45
+ };
@@ -0,0 +1,45 @@
1
+ export const mediaManagerTranslationsHi = {
2
+ media_library: "मीडिया लाइब्रेरी",
3
+ media_library_description: "चित्र और फ़ाइलें प्रबंधित करें",
4
+ media_search_assets: "संपत्तियां खोजें...",
5
+ media_grid_view: "ग्रिड दृश्य",
6
+ media_list_view: "सूची दृश्य",
7
+ media_refresh: "रीफ्रेश करें",
8
+ media_upload: "अपलोड करें",
9
+ media_error_loading: "संपत्तियों को लोड करने में त्रुटि: {{message}}",
10
+ media_try_again: "पुनः प्रयास करें",
11
+ media_no_assets: "अभी तक कोई मीडिया संपत्ति नहीं",
12
+ media_upload_first_file: "अपनी पहली फ़ाइल अपलोड करें",
13
+ media_asset_updated: "संपत्ति सफलतापूर्वक अपडेट की गई",
14
+ media_error_updating: "संपत्ति को अपडेट करने में त्रुटि: {{message}}",
15
+ media_asset_deleted: "संपत्ति सफलतापूर्वक हटा दी गई",
16
+ media_error_deleting: "संपत्ति को हटाने में त्रुटि: {{message}}",
17
+ media_error_getting_url: "डाउनलोड URL प्राप्त करने में त्रुटि",
18
+ media_preview_not_available: "पूर्वावलोकन उपलब्ध नहीं है",
19
+ media_dimensions: "आयाम",
20
+ media_size: "आकार",
21
+ media_type: "प्रकार",
22
+ media_created: "बनाया गया",
23
+ media_file_name: "फ़ाइल का नाम",
24
+ media_title: "शीर्षक",
25
+ media_alt_text: "वैकल्पिक पाठ",
26
+ media_recommended_seo: "SEO के लिए अनुशंसित",
27
+ media_caption: "कैप्शन",
28
+ media_tags: "टैग",
29
+ media_add_tag: "एक टैग जोड़ें...",
30
+ media_add: "जोड़ें",
31
+ media_save_changes: "परिवर्तन सहेजें",
32
+ media_delete_asset: "संपत्ति हटाएं?",
33
+ media_delete_confirmation: "क्या आप निश्चित रूप से \"{{name}}\" को हटाना चाहते हैं? यह क्रिया पूर्ववत नहीं की जा सकती।",
34
+ media_file_too_large: "{{name}}: फ़ाइल बहुत बड़ी है (अधिकतम {{size}})",
35
+ media_file_type_not_allowed: "{{name}}: फ़ाइल प्रकार की अनुमति नहीं है",
36
+ media_upload_failed: "अपलोड विफल रहा",
37
+ media_upload_files: "फ़ाइलें अपलोड करें",
38
+ media_drop_files: "फ़ाइलें यहाँ छोड़ें या ब्राउज़ करने के लिए क्लिक करें",
39
+ media_max_file_size: "अधिकतम फ़ाइल आकार: {{size}}",
40
+ media_selected_files_count: "चयनित फ़ाइलें ({{count}})",
41
+ media_remove: "हटाएं",
42
+ media_uploading: "अपलोड हो रहा है...",
43
+ media_manage_description: "अपनी मीडिया फ़ाइलें और संपत्तियां प्रबंधित करें",
44
+ media_assets_count: "{{count}} संपत्तियां"
45
+ };
@@ -0,0 +1,45 @@
1
+ export const mediaManagerTranslationsIt = {
2
+ media_library: "Libreria multimediale",
3
+ media_library_description: "Gestisci immagini e file",
4
+ media_search_assets: "Cerca risorse...",
5
+ media_grid_view: "Visualizzazione griglia",
6
+ media_list_view: "Visualizzazione elenco",
7
+ media_refresh: "Aggiorna",
8
+ media_upload: "Carica",
9
+ media_error_loading: "Errore durante il caricamento delle risorse: {{message}}",
10
+ media_try_again: "Riprova",
11
+ media_no_assets: "Nessuna risorsa multimediale ancora presente",
12
+ media_upload_first_file: "Carica il tuo primo file",
13
+ media_asset_updated: "Risorsa aggiornata con successo",
14
+ media_error_updating: "Errore durante l'aggiornamento della risorsa: {{message}}",
15
+ media_asset_deleted: "Risorsa eliminata con successo",
16
+ media_error_deleting: "Errore durante l'eliminazione della risorsa: {{message}}",
17
+ media_error_getting_url: "Errore durante il recupero dell'URL di download",
18
+ media_preview_not_available: "Anteprima non disponibile",
19
+ media_dimensions: "Dimensioni",
20
+ media_size: "Dimensione",
21
+ media_type: "Tipo",
22
+ media_created: "Creato",
23
+ media_file_name: "Nome file",
24
+ media_title: "Titolo",
25
+ media_alt_text: "Testo alternativo",
26
+ media_recommended_seo: "Consigliato per la SEO",
27
+ media_caption: "Didascalia",
28
+ media_tags: "Tag",
29
+ media_add_tag: "Aggiungi un tag...",
30
+ media_add: "Aggiungi",
31
+ media_save_changes: "Salva modifiche",
32
+ media_delete_asset: "Elimina risorsa?",
33
+ media_delete_confirmation: "Sei sicuro di voler eliminare \"{{name}}\"? Questa azione non può essere annullata.",
34
+ media_file_too_large: "{{name}}: File troppo grande (max {{size}})",
35
+ media_file_type_not_allowed: "{{name}}: Tipo di file non consentito",
36
+ media_upload_failed: "Caricamento fallito",
37
+ media_upload_files: "Carica file",
38
+ media_drop_files: "Rilascia i file qui o fai clic per sfogliare",
39
+ media_max_file_size: "Dimensione massima del file: {{size}}",
40
+ media_selected_files_count: "File selezionati ({{count}})",
41
+ media_remove: "Rimuovi",
42
+ media_uploading: "Caricamento in corso...",
43
+ media_manage_description: "Gestisci i tuoi file e risorse multimediali",
44
+ media_assets_count: "{{count}} risorse"
45
+ };
@@ -0,0 +1,45 @@
1
+ export const mediaManagerTranslationsPt = {
2
+ media_library: "Biblioteca de Média",
3
+ media_library_description: "Gerir imagens e ficheiros",
4
+ media_search_assets: "Pesquisar recursos...",
5
+ media_grid_view: "Vista em grelha",
6
+ media_list_view: "Vista em lista",
7
+ media_refresh: "Atualizar",
8
+ media_upload: "Carregar",
9
+ media_error_loading: "Erro ao carregar recursos: {{message}}",
10
+ media_try_again: "Tentar Novamente",
11
+ media_no_assets: "Ainda não há recursos de média",
12
+ media_upload_first_file: "Carregue o seu primeiro ficheiro",
13
+ media_asset_updated: "Recurso atualizado com sucesso",
14
+ media_error_updating: "Erro ao atualizar recurso: {{message}}",
15
+ media_asset_deleted: "Recurso eliminado com sucesso",
16
+ media_error_deleting: "Erro ao eliminar recurso: {{message}}",
17
+ media_error_getting_url: "Erro ao obter URL de download",
18
+ media_preview_not_available: "Pré-visualização não disponível",
19
+ media_dimensions: "Dimensões",
20
+ media_size: "Tamanho",
21
+ media_type: "Tipo",
22
+ media_created: "Criado",
23
+ media_file_name: "Nome do Ficheiro",
24
+ media_title: "Título",
25
+ media_alt_text: "Texto Alternativo",
26
+ media_recommended_seo: "Recomendado para SEO",
27
+ media_caption: "Legenda",
28
+ media_tags: "Etiquetas",
29
+ media_add_tag: "Adicionar uma etiqueta...",
30
+ media_add: "Adicionar",
31
+ media_save_changes: "Guardar Alterações",
32
+ media_delete_asset: "Eliminar Recurso?",
33
+ media_delete_confirmation: "Tem a certeza de que quer eliminar \"{{name}}\"? Esta ação não pode ser desfeita.",
34
+ media_file_too_large: "{{name}}: Ficheiro demasiado grande (máx {{size}})",
35
+ media_file_type_not_allowed: "{{name}}: Tipo de ficheiro não permitido",
36
+ media_upload_failed: "Falha no carregamento",
37
+ media_upload_files: "Carregar Ficheiros",
38
+ media_drop_files: "Solte ficheiros aqui ou clique para navegar",
39
+ media_max_file_size: "Tamanho máximo de ficheiro: {{size}}",
40
+ media_selected_files_count: "Ficheiros selecionados ({{count}})",
41
+ media_remove: "Remover",
42
+ media_uploading: "A carregar...",
43
+ media_manage_description: "Gerir os seus ficheiros e recursos de média",
44
+ media_assets_count: "{{count}} recursos"
45
+ };
@@ -1,10 +1,17 @@
1
1
  import React, { useMemo, createContext, useContext, PropsWithChildren } from "react";
2
- import { FireCMSPlugin, CMSView } from "@firecms/core";
2
+ import { FireCMSPlugin, CMSView, useTranslation } from "@firecms/core";
3
3
  import { MediaManagerConfig } from "./types";
4
4
  import { MediaManagerProvider } from "./MediaManagerProvider";
5
5
  import { useMediaManagerController } from "./useMediaManagerController";
6
6
  import { MediaLibraryCard } from "./components/MediaLibraryCard";
7
7
  import { MediaLibraryView } from "./components/MediaLibraryView";
8
+ import { mediaManagerTranslationsEn } from "./locales/en";
9
+ import { mediaManagerTranslationsEs } from "./locales/es";
10
+ import { mediaManagerTranslationsDe } from "./locales/de";
11
+ import { mediaManagerTranslationsFr } from "./locales/fr";
12
+ import { mediaManagerTranslationsIt } from "./locales/it";
13
+ import { mediaManagerTranslationsHi } from "./locales/hi";
14
+ import { mediaManagerTranslationsPt } from "./locales/pt";
8
15
 
9
16
  const DEFAULT_STORAGE_PATH = "media";
10
17
  const DEFAULT_COLLECTION_PATH = "media_assets";
@@ -54,15 +61,14 @@ function buildMediaView(): CMSView {
54
61
  return {
55
62
  path: "media",
56
63
  name: "Media Library",
57
- description: "Manage your media files and assets",
64
+ description: "Manage your media files",
58
65
  group: "Media",
59
66
  icon: "perm_media",
60
67
  view: <MediaLibraryViewInternal />
61
68
  };
62
69
  }
63
70
 
64
- // Single static instance of the view
65
- const MEDIA_VIEW = buildMediaView();
71
+ // Removed static MEDIA_VIEW because it depends on translation
66
72
 
67
73
  /**
68
74
  * Hook to create the Media Manager plugin for FireCMS.
@@ -83,15 +89,26 @@ const MEDIA_VIEW = buildMediaView();
83
89
  * ```
84
90
  */
85
91
  export function useMediaManagerPlugin(props: MediaManagerPluginProps): FireCMSPlugin {
92
+ const mediaView = useMemo(() => buildMediaView(), []);
93
+
86
94
  return useMemo(() => ({
87
95
  key: "media_manager",
88
- views: [MEDIA_VIEW],
96
+ views: [mediaView],
89
97
  provider: {
90
98
  Component: ({ children }: PropsWithChildren) => (
91
99
  <MediaManagerConfigContext.Provider value={props}>
92
100
  {children}
93
101
  </MediaManagerConfigContext.Provider>
94
102
  )
103
+ },
104
+ i18n: {
105
+ en: mediaManagerTranslationsEn,
106
+ es: mediaManagerTranslationsEs,
107
+ de: mediaManagerTranslationsDe,
108
+ fr: mediaManagerTranslationsFr,
109
+ it: mediaManagerTranslationsIt,
110
+ hi: mediaManagerTranslationsHi,
111
+ pt: mediaManagerTranslationsPt
95
112
  }
96
113
  } satisfies FireCMSPlugin), []);
97
114
  }