From 19fcaaf457da88dd058181fb360024db903d6ba0 Mon Sep 17 00:00:00 2001
From: ncamera <nico_camera98@hotmail.com>
Date: Tue, 8 Nov 2022 23:01:35 -0300
Subject: [PATCH] Empezar a actualizar las traducciones

---
 .../app/layout/archivos/archivos.component.ts | 21 +++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/Frontend Angular 4/src/app/layout/archivos/archivos.component.ts b/Frontend Angular 4/src/app/layout/archivos/archivos.component.ts
index 9422921..718241f 100755
--- a/Frontend Angular 4/src/app/layout/archivos/archivos.component.ts	
+++ b/Frontend Angular 4/src/app/layout/archivos/archivos.component.ts	
@@ -158,6 +158,12 @@ export class ArchivosComponent {
    */
   modalSeeScoreOpened = true;
 
+  private notificationTypeDictonarty = {
+    error: (message: string) => this.notifService.error(message),
+    success: (message: string) => this.notifService.success(message),
+    warning: (message: string) => this.notifService.warning(message),
+  };
+
   constructor(
     private router: Router,
     private notifService: NotificacionService,
@@ -209,6 +215,13 @@ export class ArchivosComponent {
     }
     this.ordenarArchivos();
   }
+
+  showNotification(type: "error" | "success" | "warning", traslation: string) {
+    this.translateService
+      .get(traslation)
+      .subscribe(this.notificationTypeDictonarty[type]);
+  }
+
   ordenarMixto() {
     //1. primero las carpetas.
     this.archivosCompartidosSinDuplicados =
@@ -296,9 +309,7 @@ export class ArchivosComponent {
   mostrarEliminarDialogo() {
     // Chequear si se seleccionó un archivo
     if (!this.archivoSeleccionado) {
-      this.notifService.warning(
-        this.translateService.get("i18n.warning.file.noSelected").value
-      );
+      this.showNotification("warning", "i18n.warning.file.noSelected");
       return;
     }
 
@@ -658,9 +669,7 @@ export class ArchivosComponent {
    */
   confirmFileMove(event: CustomEvent) {
     if (!this.archivoSeleccionado) {
-      this.notifService.warning(
-        this.translateService.get("i18n.warning.file.noSelected").value
-      );
+      this.showNotification("warning", "i18n.warning.file.noSelected");
       return;
     }
 
-- 
GitLab