traduction (en-fr-de-es-it-pt)

This commit is contained in:
Alexandre_BRAVO 2024-11-29 17:28:47 +01:00
parent ec0a13d95f
commit 9a29fa799c
6 changed files with 262 additions and 61 deletions

View File

@ -5,12 +5,12 @@
<!-- Première section --> <!-- Première section -->
<div <div
class="w-full sm:w-1/3 max-sm:h-2/5 p-4 sm:m-6 sm:mr-0 rounded-xl bg-NcBlack/40"> class="w-full sm:w-1/3 max-sm:h-2/5 p-4 sm:m-6 sm:mr-0 rounded-xl bg-NcBlack/40">
<WebContentViewer @zip-upload="handleZipUpload" @file-upload="handleFileUpload" @dragEnded="toggleDragEnded" zipUrl="http://localhost:8000/dummyZip.zip"/> <WebContentViewer :translate="translate" @zip-upload="handleZipUpload" @file-upload="handleFileUpload" @dragEnded="toggleDragEnded" zipUrl="http://localhost:8000/dummyZip.zip"/>
</div> </div>
<!-- Deuxième section --> <!-- Deuxième section -->
<div <div
class="w-full sm:w-2/3 max-sm:h-3/5 p-4 sm:m-6 sm:ml-4 bg-NcBlack rounded-xl"> class="w-full sm:w-2/3 max-sm:h-3/5 p-4 sm:m-6 sm:ml-4 bg-NcBlack rounded-xl">
<FileTable :file="sharedFile" :zip="zip" :dragEnded="dragEnded" @dragEnded="toggleDragEnded"/> <FileTable :file="sharedFile" :zip="zip" :dragEnded="dragEnded" :translate="translate" @dragEnded="toggleDragEnded"/>
</div> </div>
</div> </div>
</div> </div>
@ -21,6 +21,16 @@ import FileTable from './components/FileTable.vue';
import WebContentViewer from './components/WebContentViewer.vue'; import WebContentViewer from './components/WebContentViewer.vue';
import './output.css'; import './output.css';
// Traduction
import i18next from "i18next";
import file from "./assets/traduction.json";
await i18next.init({
lng: navigator.language.split('-')[0],
fallbackLng: "en",
resources: file,
});
export default { export default {
name: 'App', name: 'App',
components: { components: {
@ -46,6 +56,9 @@ export default {
this.zip = null; this.zip = null;
this.sharedFile = null; this.sharedFile = null;
}, },
translate(id) {
return i18next.t(id)
},
}, },
} }
</script> </script>

View File

@ -1,14 +1,200 @@
{ {
"en": { "en": {
"translation": { "translation": {
"welcome": "Welcome to the app!", "all.files" : "All files",
"hello": "Hello, {{name}}!" "favorites": "Favorites",
"no.content": "No content to display",
"enter.file.name": "Enter the name of the file",
"modify.file.name": "Modify the name of the file",
"you.are.going.to.erase.file.folder" : "You are going to erase the file/folder",
"apply.to.all.*" : "Apply to all*",
"*.text" : "* You can't undo this action",
"create.new.file": "Create a new file",
"name.of.file": "Name of the file",
"change.file.name": "Change the name of the file",
"file.already.exist" : "The file already exists",
"file.pt.1" : "The file \"",
"file.pt.2" : "\" already exists, what do you want to do ?",
"cant.rename": "You can't rename the file/folder : ",
"cant.create.folder": "You can't create the folder : ",
"already.exists": ", because it already exists.",
"name": "Name",
"size": "Size",
"type": "Type",
"options": "Options",
"new": "New",
"delete": "Delete",
"edit": "Edit",
"cancel": "Cancel",
"confirm": "Confirm",
"create": "Create",
"overwrite": "Overwrite",
"rename": "Rename"
} }
}, },
"fr": { "fr": {
"translation": { "translation": {
"welcome": "Bienvenue dans l'application !", "all.files": "Tous les fichiers",
"hello": "Bonjour, {{name}} !" "favorites": "Favoris",
"no.content": "Aucun contenu à afficher",
"enter.file.name": "Entrez le nom du fichier",
"modify.file.name": "Modifier le nom du fichier",
"you.are.going.to.erase.file.folder": "Vous allez supprimer le fichier/dossier",
"apply.to.all.*": "Appliquer à tous*",
"*.text": "* Vous ne pouvez pas annuler cette action",
"create.new.file": "Créer un nouveau fichier",
"name.of.file": "Nom du fichier",
"change.file.name": "Changer le nom du fichier",
"file.already.exist": "Le fichier existe déjà",
"file.pt.1": "Le fichier \"",
"file.pt.2": "\" existe déjà, que voulez-vous faire?",
"cant.rename": "Vous ne pouvez pas renommer le fichier/dossier : ",
"cant.create.folder": "Vous ne pouvez pas créer le dossier : ",
"already.exists": ", car il existe déjà.",
"name": "Nom",
"size": "Taille",
"type": "Type",
"options": "Options",
"new": "Nouveau",
"delete": "Supprimer",
"edit": "Modifier",
"cancel": "Annuler",
"confirm": "Confirmer",
"create": "Créer",
"overwrite": "Écraser",
"rename": "Renommer"
}
},
"de": {
"translation": {
"all.files" : "Alle Dateien",
"favorites": "Favoriten",
"no.content": "Kein Inhalt zum Anzeigen",
"enter.file.name": "Geben Sie den Namen der Datei ein",
"modify.file.name": "Ändern Sie den Namen der Datei",
"you.are.going.to.erase.file.folder" : "Sie sind dabei, die Datei/den Ordner zu löschen",
"apply.to.all.*" : "Auf alle anwenden*",
"*.text" : "* Diese Aktion kann nicht rückgängig gemacht werden",
"create.new.file": "Neue Datei erstellen",
"name.of.file": "Name der Datei",
"change.file.name": "Ändern Sie den Namen der Datei",
"file.already.exist" : "Die Datei existiert bereits",
"file.pt.1" : "Die Datei \"",
"file.pt.2" : "\" existiert bereits, was möchten Sie tun?",
"cant.rename": "Die Datei/der Ordner kann nicht umbenannt werden: ",
"cant.create.folder": "Der Ordner kann nicht erstellt werden: ",
"already.exists": ", da er bereits existiert.",
"name": "Name",
"size": "Größe",
"type": "Typ",
"options": "Optionen",
"new": "Neu",
"delete": "Löschen",
"edit": "Bearbeiten",
"cancel": "Abbrechen",
"confirm": "Bestätigen",
"create": "Erstellen",
"overwrite": "Überschreiben",
"rename": "Umbenennen"
}
},
"es": {
"translation": {
"all.files": "Todos los archivos",
"favorites": "Favoritos",
"no.content": "No hay contenido para mostrar",
"enter.file.name": "Introduce el nombre del archivo",
"modify.file.name": "Modificar el nombre del archivo",
"you.are.going.to.erase.file.folder": "Vas a eliminar el archivo/carpeta",
"apply.to.all.*": "Aplicar a todos*",
"*.text": "* No puedes deshacer esta acción",
"create.new.file": "Crear un nuevo archivo",
"name.of.file": "Nombre del archivo",
"change.file.name": "Cambiar el nombre del archivo",
"file.already.exist": "El archivo ya existe",
"file.pt.1": "El archivo \"",
"file.pt.2": "\" ya existe, ¿qué quieres hacer?",
"cant.rename": "No puedes renombrar el archivo/carpeta: ",
"cant.create.folder": "No puedes crear la carpeta: ",
"already.exists": ", porque ya existe.",
"name": "Nombre",
"size": "Tamaño",
"type": "Tipo",
"options": "Opciones",
"new": "Nuevo",
"delete": "Eliminar",
"edit": "Editar",
"cancel": "Cancelar",
"confirm": "Confirmar",
"create": "Crear",
"overwrite": "Sobrescribir",
"rename": "Renombrar"
}
},
"pt": {
"translation": {
"all.files" : "Todos os arquivos",
"favorites": "Favoritos",
"no.content": "Nenhum conteúdo para exibir",
"enter.file.name": "Digite o nome do arquivo",
"modify.file.name": "Modificar o nome do arquivo",
"you.are.going.to.erase.file.folder" : "Você está prestes a apagar o arquivo/pasta",
"apply.to.all.*" : "Aplicar a todos*",
"*.text" : "* Esta ação não pode ser desfeita",
"create.new.file": "Criar um novo arquivo",
"name.of.file": "Nome do arquivo",
"change.file.name": "Alterar o nome do arquivo",
"file.already.exist" : "O arquivo já existe",
"file.pt.1" : "O arquivo \"",
"file.pt.2" : "\" já existe, o que você deseja fazer?",
"cant.rename": "Não é possível renomear o arquivo/pasta: ",
"cant.create.folder": "Não é possível criar a pasta: ",
"already.exists": ", porque já existe.",
"name": "Nome",
"size": "Tamanho",
"type": "Tipo",
"options": "Opções",
"new": "Novo",
"delete": "Excluir",
"edit": "Editar",
"cancel": "Cancelar",
"confirm": "Confirmar",
"create": "Criar",
"overwrite": "Sobrescrever",
"rename": "Renomear"
}
},
"it": {
"translation": {
"all.files" : "Tutti i file",
"favorites": "Preferiti",
"no.content": "Nessun contenuto da visualizzare",
"enter.file.name": "Inserisci il nome del file",
"modify.file.name": "Modifica il nome del file",
"you.are.going.to.erase.file.folder" : "Stai per cancellare il file/la cartella",
"apply.to.all.*" : "Applica a tutti*",
"*.text" : "* Non puoi annullare questa azione",
"create.new.file": "Crea un nuovo file",
"name.of.file": "Nome del file",
"change.file.name": "Cambia il nome del file",
"file.already.exist" : "Il file esiste già",
"file.pt.1" : "Il file \"",
"file.pt.2" : "\" esiste già, cosa vuoi fare?",
"cant.rename": "Non puoi rinominare il file/la cartella: ",
"cant.create.folder": "Non puoi creare la cartella: ",
"already.exists": ", perché esiste già.",
"name": "Nome",
"size": "Dimensione",
"type": "Tipo",
"options": "Opzioni",
"new": "Nuovo",
"delete": "Elimina",
"edit": "Modifica",
"cancel": "Annulla",
"confirm": "Conferma",
"create": "Crea",
"overwrite": "Sovrascrivi",
"rename": "Rinomina"
} }
} }
} }

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="fixed inset-0 flex items-center justify-center bg-gray-700 bg-opacity-50 z-50" @click="closeModal"> <div class="fixed inset-0 flex items-center justify-center bg-gray-700 bg-opacity-50 z-50" @click="closeModal">
<div class="bg-NcBlack rounded-lg shadow-lg p-6 w-96" @click.stop> <div class="bg-NcBlack rounded-lg shadow-lg p-6 w-96" @click.stop>
<h2 class="text-lg font-semibold mb-4">Modifier le nom du fichier</h2> <h2 class="text-lg font-semibold mb-4">{{ translate('modify.file.name') }}</h2>
<input <input
type="text" type="text"
v-model="newFileName" v-model="newFileName"
@ -11,8 +11,8 @@
class="w-full px-4 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" class="w-full px-4 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
/> />
<div class="flex justify-end mt-4 space-x-2"> <div class="flex justify-end mt-4 space-x-2">
<button @click="save" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">Sauvegarder</button> <button @click="save" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">{{ translate('rename') }}</button>
<button @click="closeModal" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">Annuler</button> <button @click="closeModal" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">{{ translate('cancel') }}</button>
</div> </div>
</div> </div>
</div> </div>
@ -29,6 +29,10 @@ export default {
isDirectory:{ isDirectory:{
type: Boolean, type: Boolean,
required: true, required: true,
},
translate: {
type: Function,
Required: true,
} }
}, },
data() { data() {

View File

@ -1,43 +1,43 @@
<template> <template>
<div class="fixed inset-0 flex items-center justify-center bg-gray-700 bg-opacity-50 z-50"> <div class="fixed inset-0 flex items-center justify-center bg-gray-700 bg-opacity-50 z-50">
<div v-if="!displayRename && !displayOverwrite" class="bg-NcBlack rounded-lg shadow-lg p-6 w-96"> <div v-if="!displayRename && !displayOverwrite" class="bg-NcBlack rounded-lg shadow-lg p-6 w-96">
<h2 class="text-lg font-semibold mb-4">Le fichier existe déjà</h2> <h2 class="text-lg font-semibold mb-4">{{ translate('file.already.exist') }}</h2>
<p>Le fichier "{{ fileName }}" existe déjà. Que voulez-vous faire ?</p> <p>{{ translate('file.pt.1') }}{{ fileName }}{{ translate('file.pt.2') }}</p>
<div class="flex justify-end mt-4 space-x-2"> <div class="flex justify-end mt-4 space-x-2">
<button @click="toggleOverwrite">Écraser</button> <button @click="toggleOverwrite">{{ translate('overwrite') }}</button>
<button v-if="!isDirectory" @click="toggleRename">Renommer</button> <button v-if="!isDirectory" @click="toggleRename">{{ translate('rename') }}</button>
<button @click="onCancel">Annuler</button> <button @click="onCancel">{{ translate('cancel') }}</button>
</div> </div>
</div> </div>
<!-- Renommer le fichier --> <!-- Renommer le fichier -->
<div v-if="displayRename" class="bg-NcBlack rounded-lg shadow-lg p-6 w-96"> <div v-if="displayRename" class="bg-NcBlack rounded-lg shadow-lg p-6 w-96">
<h2 class="text-lg font-semibold mb-4">Modifier le nom du fichier</h2> <h2 class="text-lg font-semibold mb-4">{{ translate('change.file.name') }}</h2>
<input <input
type="text" type="text"
v-model="newFileName" v-model="newFileName"
@input="onInputChange" @input="onInputChange"
@keyup.enter="save" @keyup.enter="save"
placeholder="Entrez le nom du fichier" :placeholder="translate('enter.file.name')"
class="w-full px-4 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" class="w-full px-4 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
/> />
<div class="flex justify-end mt-4 space-x-2"> <div class="flex justify-end mt-4 space-x-2">
<button @click="save" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">Valider</button> <button @click="save" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">{{ translate('confirm') }}</button>
<button @click="toggleRename" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">Annuler</button> <button @click="toggleRename" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">{{ translate('cancel') }}</button>
</div> </div>
</div> </div>
<!-- Appliquer l'ecrasement a tous --> <!-- Appliquer l'ecrasement a tous -->
<div v-if="displayOverwrite" class="bg-NcBlack rounded-lg shadow-lg p-6 w-96"> <div v-if="displayOverwrite" class="bg-NcBlack rounded-lg shadow-lg p-6 w-96">
<h2 class="text-lg font-semibold mb-4">Vous allez ecraser le fichier/dossier</h2> <h2 class="text-lg font-semibold mb-4">{{ translate('you.are.going.to.erase.file.folder') }}</h2>
<div class="flex items-center content-evenly"> <div class="flex items-center content-evenly">
<input type="checkbox" v-model="forAll" /> <input type="checkbox" v-model="forAll" />
<p>Appliquer à tous*</p> <p>{{ translate('apply.to.all.*') }}</p>
</div> </div>
<p class="text-xs text-gray-400">* ecrasera tous les fichiers qui ont le même nom sur votre dépôt</p> <p class="text-xs text-gray-400">{{ translate('*.text') }}</p>
<div class="flex justify-end mt-4 space-x-2"> <div class="flex justify-end mt-4 space-x-2">
<button @click="onOverwrite" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">Valider</button> <button @click="onOverwrite" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">{{ translate('confirm') }}</button>
<button @click="toggleOverwrite" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">Annuler</button> <button @click="toggleOverwrite" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">{{ translate('cancel') }}</button>
</div> </div>
</div> </div>
</div> </div>
@ -53,6 +53,10 @@ export default {
isDirectory:{ isDirectory:{
type: Boolean, type: Boolean,
required: true, required: true,
},
translate: {
type: Function,
Required: true,
} }
}, },
data() { data() {

View File

@ -6,13 +6,13 @@
:class="getClassButton('default')" :class="getClassButton('default')"
@click="changeTab('default')" @click="changeTab('default')"
> >
Tous les fichiers {{ translate('all.files') }}
</button> </button>
<button <button
:class="getClassButton('favorites')" :class="getClassButton('favorites')"
@click="changeTab('favorites')" @click="changeTab('favorites')"
> >
Favoris {{ translate('favorites') }}
</button> </button>
</div> </div>
@ -30,7 +30,7 @@
<button v-if="!isTransfering" @click="toggleAddFilePopup" <button v-if="!isTransfering" @click="toggleAddFilePopup"
class="flex items-center space-x-2 bg-blue-100 text-blue-600 font-medium px-4 py-2 rounded-md hover:bg-blue-200 transition"> class="flex items-center space-x-2 bg-blue-100 text-blue-600 font-medium px-4 py-2 rounded-md hover:bg-blue-200 transition">
<Plus :size="20" /> <Plus :size="20" />
<span>Nouveau</span> <span>{{translate('new')}}</span>
</button> </button>
<div v-else> <div v-else>
<ProgressBar :value="transferProgress" :color="transferStatus" /> <ProgressBar :value="transferProgress" :color="transferStatus" />
@ -45,17 +45,17 @@
<div v-if="isAddFilePopupVisible" <div v-if="isAddFilePopupVisible"
class="fixed inset-0 flex items-center justify-center bg-gray-700 bg-opacity-50 z-50"> class="fixed inset-0 flex items-center justify-center bg-gray-700 bg-opacity-50 z-50">
<div class="bg-NcBlack rounded-lg shadow-lg p-6 w-96"> <div class="bg-NcBlack rounded-lg shadow-lg p-6 w-96">
<h2 class="text-lg font-semibold mb-4">Créer un nouveau fichier</h2> <h2 class="text-lg font-semibold mb-4">{{ translate('create.new.file') }}</h2>
<input v-model="newFileName" type="text" placeholder="Nom du fichier" <input v-model="newFileName" type="text" :placeholder="translate('name.of.file')"
class="w-full px-4 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" /> class="w-full px-4 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" />
<div class="flex justify-end mt-4 space-x-2"> <div class="flex justify-end mt-4 space-x-2">
<button @click="toggleAddFilePopup"
class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">
Annuler
</button>
<button @click="createNewFile" <button @click="createNewFile"
class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition"> class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition">
Créer {{translate('create')}}
</button>
<button @click="toggleAddFilePopup"
class="px-4 py-2 bg-gray-200 text-gray-700 rounded-md hover:bg-gray-300 transition">
{{translate('cancel')}}
</button> </button>
</div> </div>
</div> </div>
@ -63,10 +63,10 @@
<!-- En-tête --> <!-- En-tête -->
<div class="flex h-12 items-center border-b border-gray-300"> <div class="flex h-12 items-center border-b border-gray-300">
<div class="w-7/12 px-4 py-2 text-gray-500 font-semibold border-r border-gray-300">Nom</div> <div class="w-7/12 px-4 py-2 text-gray-500 font-semibold border-r border-gray-300">{{ translate('name') }}</div>
<div class="w-2/12 px-4 py-2 text-gray-500 font-semibold border-r border-gray-300">Type</div> <div class="w-2/12 px-4 py-2 text-gray-500 font-semibold border-r border-gray-300">{{ translate('type') }}</div>
<div class="w-2/12 px-4 py-2 text-gray-500 font-semibold">Taille</div> <div class="w-2/12 px-4 py-2 text-gray-500 font-semibold">{{ translate('size') }}</div>
<div class="w-1/12 px-4 py-2 text-gray-500 font-semibold">Options</div> <div class="w-1/12 px-4 py-2 text-gray-500 font-semibold">{{ translate('options') }}</div>
</div> </div>
<!-- Contenu --> <!-- Contenu -->
@ -130,23 +130,24 @@
<template #icon> <template #icon>
<Delete :size="20" /> <Delete :size="20" />
</template> </template>
Supprimer {{ translate('delete') }}
</NcActionButton> </NcActionButton>
<NcActionButton @click="editElem(file)"> <NcActionButton @click="editElem(file)">
<template #icon> <template #icon>
<Pencil :size="20" /> <Pencil :size="20" />
</template> </template>
Editer {{ translate('edit') }}
</NcActionButton> </NcActionButton>
</NcActions> </NcActions>
</div> </div>
</div> </div>
</div> </div>
<EditFileName v-if="!editDialogDisabled" :initialFileName="initialFileName" :isDirectory="isDirectory" <EditFileName v-if="!editDialogDisabled" :initialFileName="initialFileName" :isDirectory="isDirectory" :translate="translate"
@update="updateFileName" @close="closeEditDialog"> @update="updateFileName" @close="closeEditDialog">
</EditFileName> </EditFileName>
<FileExistsDialog v-if="!fileExistDialogDisabled" :fileName="initialFileName" :isDirectory="isDirectory" @overwrite="setOverwrite" @rename="setRename" @cancel="cancelDrop"> <FileExistsDialog v-if="!fileExistDialogDisabled" :fileName="initialFileName" :isDirectory="isDirectory" :translate="translate"
@overwrite="setOverwrite" @rename="setRename" @cancel="cancelDrop">
</FileExistsDialog> </FileExistsDialog>
</div> </div>
</div> </div>
@ -170,10 +171,6 @@ import Plus from 'vue-material-design-icons/Plus.vue'
import Delete from 'vue-material-design-icons/Delete.vue'; import Delete from 'vue-material-design-icons/Delete.vue';
import Pencil from 'vue-material-design-icons/Pencil.vue' import Pencil from 'vue-material-design-icons/Pencil.vue'
// Traduction
import i18next from "i18next";
import file from "../assets/traduction.json";
export default { export default {
name: 'FileTable', name: 'FileTable',
components: { components: {
@ -200,6 +197,10 @@ export default {
dragEnded: { dragEnded: {
type: Boolean, type: Boolean,
Required: true, Required: true,
},
translate: {
type: Function,
Required: true,
} }
}, },
watch: { watch: {
@ -240,14 +241,6 @@ export default {
async mounted() { async mounted() {
await this.fetchFiles(); await this.fetchFiles();
this.breadcrumbParts = this.getBreadcrumbParts(); this.breadcrumbParts = this.getBreadcrumbParts();
await i18next.init({
lng: navigator.language.split('-')[0],
fallbackLng: "en",
resources: file,
});
console.log(i18next.t('welcome'))
}, },
methods: { methods: {
async changeTab(name) { async changeTab(name) {
@ -374,7 +367,7 @@ export default {
await this.fetchFiles(); await this.fetchFiles();
} }
else { else {
alert(`Vous ne pouvez pas creer le dossier : ${this.newFileName} car un autre dossier porte deja le meme nom.`); alert(this.translate("cant.create.folder") + this.newFileName + this.translate('already.exists'));
} }
} catch (error) { } catch (error) {
console.error('Erreur lors de la création du fichier :', error); console.error('Erreur lors de la création du fichier :', error);
@ -624,7 +617,7 @@ export default {
await client.moveFile(oldName, newName); await client.moveFile(oldName, newName);
} }
else { else {
alert(`Vous ne pouvez pas renommez le fichier/dossier : ${names.newFileName} car un autre fichier/dossier porte deja le meme nom.`); alert(this.translate('cant.rename') + names.newFileName + this.translate('already.exists'));
} }
} }
catch (error) { catch (error) {
@ -668,9 +661,6 @@ export default {
return cssStyle; return cssStyle;
}, },
translate(id) {
return i18next.t(id)
},
async sleep(ms) { async sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
} }

View File

@ -1,8 +1,8 @@
<template> <template>
<div class="flex flex-col h-full w-full border"> <div class="flex flex-col h-full w-full border">
<div class="flex h-12 items-center border-b border-gray-300"> <div class="flex h-12 items-center border-b border-gray-300">
<div class="w-5/6 px-4 py-2 text-gray-500 font-semibold border-r border-gray-300">Nom</div> <div class="w-5/6 px-4 py-2 text-gray-500 font-semibold border-r border-gray-300">{{ translate('name') }}</div>
<div class="w-1/6 px-4 py-2 text-gray-500 font-semibold">Taille</div> <div class="w-1/6 px-4 py-2 text-gray-500 font-semibold">{{ translate('size') }}</div>
</div> </div>
<!-- Fichier .zip --> <!-- Fichier .zip -->
@ -85,7 +85,7 @@
<component :is="Loading" class="text-white w-24 h-24 animate-spin" :size="40" /> <component :is="Loading" class="text-white w-24 h-24 animate-spin" :size="40" />
</div> </div>
<div v-if="!isLoading && zipContent.length === 0" class="flex h-full items-center justify-center"> <div v-if="!isLoading && zipContent.length === 0" class="flex h-full items-center justify-center">
<span class="text-gray-500">Aucun contenu à afficher</span> <span class="text-gray-500">{{ translate('no.content') }}</span>
</div> </div>
</div> </div>
</template> </template>
@ -119,6 +119,10 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
translate: {
type: Function,
Required: true,
}
}, },
computed: { computed: {
sortedFiles() { sortedFiles() {