From 431453e3cff1f753b594ada5b44da013386b01bf Mon Sep 17 00:00:00 2001
From: Lukas Haase <lukas.haase@mni.thm.de>
Date: Mon, 4 May 2020 18:02:46 +0200
Subject: [PATCH] i18n support

---
 .../question-wall.component.html              | 22 +++++++++----------
 .../question-wall/question-wall.component.ts  |  5 +++--
 src/assets/i18n/participant/de.json           |  8 ++++++-
 src/assets/i18n/participant/en.json           |  8 ++++++-
 4 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/src/app/components/shared/questionwall/question-wall/question-wall.component.html b/src/app/components/shared/questionwall/question-wall/question-wall.component.html
index 3fb4cbe7a..538c1b893 100644
--- a/src/app/components/shared/questionwall/question-wall/question-wall.component.html
+++ b/src/app/components/shared/questionwall/question-wall/question-wall.component.html
@@ -13,27 +13,27 @@
         <ars-fill></ars-fill>
         <ars-col ars-btn-wrp [xp]="16" [extra]="true">
           <mat-menu #sortMenu>
-            <button mat-menu-item (click)="sortTime(true)">Newest</button>
-            <button mat-menu-item (click)="sortTime()">Oldest</button>
-            <button mat-menu-item (click)="sortScore(true)">Score</button>
+            <button mat-menu-item (click)="sortTime(true)">{{'question-wall.sort-new' | translate}}</button>
+            <button mat-menu-item (click)="sortTime()">{{'question-wall.sort-old' | translate}}</button>
+            <button mat-menu-item (click)="sortScore(true)">{{'question-wall.sort-score' | translate}}</button>
           </mat-menu>
           <mat-menu #filterMenu>
             <button mat-menu-item (click)="filterFavorites()">
               <mat-icon>star</mat-icon>
-              <span>Favorite</span>
+              <span>{{'question-wall.filter-favorite' | translate}}</span>
             </button>
-            <button mat-menu-item (click)="filterFavorites()">
+            <button mat-menu-item (click)="filterApproved()">
               <mat-icon>check_circle</mat-icon>
-              <span>approved</span>
+              <span>{{'question-wall.filter-approved' | translate}}</span>
             </button>
-            <button mat-menu-item (click)="filterFavorites()">
+            <button mat-menu-item (click)="filterDisapproved()">
               <mat-icon>block</mat-icon>
-              <span>disapproved</span>
+              <span>{{'question-wall.filter-disapproved' | translate}}</span>
             </button>
           </mat-menu>
-          <button ars-btn [mat-menu-trigger-for]="sortMenu" matRipple><i>sort</i><p>Sort</p></button>
+          <button ars-btn [mat-menu-trigger-for]="sortMenu" matRipple><i>sort</i><p>{{'question-wall.sort' | translate}}</p></button>
           <button ars-btn [mat-menu-trigger-for]="filterMenu" matRipple><i>filter_list</i><p>Filter</p></button>
-          <button ars-btn (click)="openUserMap()" matRipple><i>person</i><p>user</p></button>
+          <button ars-btn (click)="openUserMap()" matRipple><i>person</i><p>{{'question-wall.filter-user'| translate}}</p></button>
         </ars-col>
       </ars-fill>
     </ars-style-btn-material>
@@ -73,7 +73,7 @@
             </ars-col>
             <ars-fill></ars-fill>
             <ars-col ars-btn-wrp [xp]="48">
-              <button ars-btn (click)="deactivateFilter()" matRipple><i>remove_circle</i><p>remove filter</p></button>
+              <button ars-btn (click)="deactivateFilter()" matRipple><i>remove_circle</i><p>{{'question-wall.filter-remove' | translate}}</p></button>
             </ars-col>
           </ars-style-btn-material>
         </ars-row>
diff --git a/src/app/components/shared/questionwall/question-wall/question-wall.component.ts b/src/app/components/shared/questionwall/question-wall/question-wall.component.ts
index 39d77a44f..17cb3b3e9 100644
--- a/src/app/components/shared/questionwall/question-wall/question-wall.component.ts
+++ b/src/app/components/shared/questionwall/question-wall/question-wall.component.ts
@@ -158,7 +158,7 @@ export class QuestionWallComponent implements OnInit, AfterViewInit, OnDestroy {
 
   pushIncommingComment(comment: Comment): QuestionWallComment {
     const qwComment = new QuestionWallComment(comment, false);
-    this.comments.push(qwComment);
+    this.comments = [qwComment, ...this.comments];
     this.unreadComments++;
     return qwComment;
   }
@@ -199,6 +199,7 @@ export class QuestionWallComponent implements OnInit, AfterViewInit, OnDestroy {
   }
 
   openUserMap() {
+    this.hasFilter = false;
     this.createUserMap();
     this.userSelection = true;
   }
@@ -268,7 +269,7 @@ export class QuestionWallComponent implements OnInit, AfterViewInit, OnDestroy {
   }
 
   filterApproved() {
-    this.filter('check_circle', 'question-wall.filter-disapproved', '',
+    this.filter('check_circle', 'question-wall.filter-approved', '',
         x => x.comment.correct === CorrectWrong.CORRECT);
   }
 
diff --git a/src/assets/i18n/participant/de.json b/src/assets/i18n/participant/de.json
index 8f6492a3a..73389a6c9 100644
--- a/src/assets/i18n/participant/de.json
+++ b/src/assets/i18n/participant/de.json
@@ -128,9 +128,15 @@
     "auto-renew-off-icon": "cancel",
     "intro-title": "Fragen-Fokus",
     "intro-desc": "Klick auf eine Frage oder navigiere mit der Leertaste vorwärts oder mit den Pfeiltasten vor und zurück.",
+    "sort": "Sortieren",
     "sort-time": "Zeit",
     "sort-score": "Bewertung",
+    "sort-new": "Neuste",
+    "sort-old": "Älteste",
     "filter-user": "Benutzer",
-    "filter-favorite": "Favoriten"
+    "filter-favorite": "Favoriten",
+    "filter-approved": "Bejaht",
+    "filter-disapproved": "Verneint",
+    "filter-remove": "Filter entfernen"
   }
 }
diff --git a/src/assets/i18n/participant/en.json b/src/assets/i18n/participant/en.json
index e2ed3ab6e..fcd031005 100644
--- a/src/assets/i18n/participant/en.json
+++ b/src/assets/i18n/participant/en.json
@@ -127,9 +127,15 @@
     "auto-renew-off-icon": "cancel",
     "intro-title": "Question Focus",
     "intro-desc": "Click on a question or navigate forwards with the space bar or backwards and forwards with the arrow keys.",
+    "sort": "Sort",
     "sort-time": "Time",
     "sort-score": "Score",
+    "sort-new": "Newest",
+    "sort-old": "Oldest",
     "filter-user": "User",
-    "filter-favorite": "Favorites"
+    "filter-favorite": "Favorites",
+    "filter-approved": "Affirmed",
+    "filter-disapproved": "Negated",
+    "filter-remove": "Remove Filter"
   }
 }
-- 
GitLab