From 15e33fa347ce9827d5ef81cdec676a986f066ad0 Mon Sep 17 00:00:00 2001
From: "kevin.dezaphi" <kevin.dezaphi@maarch.org>
Date: Thu, 13 Sep 2018 15:35:12 +0200
Subject: [PATCH] FEAT #8218 lang

---
 src/frontend/lang/lang-en.ts           | 14 +++++++++++
 src/frontend/lang/lang-fr.ts           | 14 +++++++++++
 src/frontend/plugins/timeLimit.pipe.ts | 33 ++++++++++++++------------
 3 files changed, 46 insertions(+), 15 deletions(-)

diff --git a/src/frontend/lang/lang-en.ts b/src/frontend/lang/lang-en.ts
index 4582b1c2915..57737610dba 100755
--- a/src/frontend/lang/lang-en.ts
+++ b/src/frontend/lang/lang-en.ts
@@ -34,6 +34,7 @@ export const LANG_EN = {
     "application"                       : "Application",
     "appUpToDate"                       : "Your application is up to date",
     "april"                             : "April",
+    "aprilShort"                        : "Apr.",
     "archivalAgency"                    : "Archival agency",
     "archivalAgreement"                 : "Archival agreement",
     "arrivalDate"                       : "Arrival date",
@@ -42,6 +43,7 @@ export const LANG_EN = {
     "attachment"                        : "Attachment",
     "attachments"                       : "Attachments",
     "august"                            : "August",
+    "augustShort"                       : "Aug.",
     "authorize"                         : "Authorize",
     "autoLogoutAbsence"                 : "You are going to be automaticaly disconnected after your redirections",
     "available"                         : "available",
@@ -96,7 +98,9 @@ export const LANG_EN = {
     "date"                              : "Date",
     "day"                               : "Day",
     "dayOfMonth"                        : "Day of month",
+    "dayS"                              : "Day(s)",
     "december"                          : "December",
+    "decemberShort"                     : "Dec.",
     "default"                           : "default",
     "defaultAction"                     : "Default action",
     "delete"                            : "Delete",
@@ -142,6 +146,7 @@ export const LANG_EN = {
     "entityWithoutParentMessage"        : "If you're not a member of this entity, you will automatically become part of it.",
     "export_seda"                       : "Seda export",
     "february"                          : "February",
+    "februaryShort"                     : "Feb.",
     "fileplan"                          : "Fileplan",
     "filterBy"                          : "Filter by",
     "fingerprint"                       : "Digital fingerprint",
@@ -178,8 +183,11 @@ export const LANG_EN = {
     "isSearchBasket"                    : "Only search basket",
     "isSytemAction"                     : "System action",
     "january"                           : "January",
+    "januaryShort"                      : "Jan.",
     "july"                              : "July",
+    "julyShort"                         : "July",
     "june"                              : "June",
+    "juneShort"                         : "June",
     "keyword"                           : "Keyword",
     "keywordHelp"                       : "Keyword help",
     "keywordHelpDesc_1"                 : "Identifier of logged user",
@@ -213,7 +221,9 @@ export const LANG_EN = {
     "manageAbsences"                    : "Manage absences",
     "manageSignatures"                  : "Manage signatures",
     "march"                             : "March",
+    "marchShort"                        : "Mar.",
     "may"                               : "May",
+    "mayShort"                          : "May",
     "maxSize"                           : "Maximum size",
     "memberAllUsers"                    : "All users member",
     "memberDiffTypeUsers"               : "Diffusion type users member",
@@ -276,13 +286,16 @@ export const LANG_EN = {
     "notificationUpdated"               : "Notification updated",
     "notUsed"                           : "Not used",
     "november"                          : "November",
+    "novemberShort"                     : "Nov.",
     "object"                            : "Object",
     "october"                           : "October",
+    "octoberShort"                      : "Oct.",
     "optional"                          : "Optional",
     "others"                            : "Other(s)",
     "otherActions"                      : "Other(s) action(s)",
     "otherInformations"                 : "Other(s) information(s)",
     "otherParameters"                   : "Other(s) parameter(s)",
+    "outdated"                          : "Outdated",
     "outOf"                             : "of",
     "page"                              : "Page",
     "parameter"                         : "Parameter",
@@ -338,6 +351,7 @@ export const LANG_EN = {
     "saturday"                          : "Saturday",
     "save"                              : "Save",
     "september"                         : "September",
+    "septemberShort"                    : "Sept.",
     "sbSignatures"                      : "Signature Book Signatures",
     "script"                            : "Script",
     "scriptCreated"                     : "Script created",
diff --git a/src/frontend/lang/lang-fr.ts b/src/frontend/lang/lang-fr.ts
index 1196e2ed6cc..596445f1fe5 100755
--- a/src/frontend/lang/lang-fr.ts
+++ b/src/frontend/lang/lang-fr.ts
@@ -41,6 +41,7 @@ export const LANG_FR = {
     "application"                       : "Application",
     "appUpToDate"                       : "Votre application est à jour",
     "april"                             : "Avril",
+    "aprilShort"                        : "Avr.",
     "archival"                          : "Archivage",
     "archivalAgency"                    : "Convention d'archivage",
     "archivalAgreement"                 : "Service d'archive",
@@ -50,6 +51,7 @@ export const LANG_FR = {
     "attachment"                        : "Pièce jointe",
     "attachments"                       : "Pièces jointes",
     "august"                            : "Août",
+    "augustShort"                       : "Août",
     "authorize"                         : "Autoriser",
     "autoLogoutAbsence"                 : "Vous allez être automatiquement déconnecté après avoir défini vos redirections de bannettes",
     "available"                         : "disponible",
@@ -119,7 +121,9 @@ export const LANG_FR = {
     "date"                              : "Date",
     "day"                               : "Jour",
     "dayOfMonth"                        : "Jour du mois",
+    "dayS"                              : "Jour(s)",
     "december"                          : "Décembre",
+    "decemberShort"                     : "Déc.",
     "default"                           : "par défaut",
     "defaultAction"                     : "Action par défaut",
     "defaultPriority"                   : "Priorité par défaut",
@@ -191,6 +195,7 @@ export const LANG_FR = {
     "event"                             : "Événement",
     "export_seda"                       : "Export seda",
     "february"                          : "Février",
+    "februaryShort"                     : "Fév.",
     "field"                             : "Champ",
     "fieldNature"                       : "Nature champ",
     "fieldType"                         : "Type champ",
@@ -241,8 +246,11 @@ export const LANG_FR = {
     "isSearchBasket"                    : "Bannette de recherche uniquement",
     "isSytemAction"                     : "Action système",
     "january"                           : "Janvier",
+    "januaryShort"                      : "Jan.",
     "july"                              : "Juillet",
+    "julyShort"                         : "Juil.",
     "june"                              : "Juin",
+    "juneShort"                         : "Juin",
     "keyword"                           : "Mot-clé",
     "keywordHelp"                       : "Aide sur les mots-clés",
     "keywordHelpDesc_1"                 : "Identifiant de l'utilisateur connecté",
@@ -280,7 +288,9 @@ export const LANG_FR = {
     "manageSignatures"                  : "Gérer les signatures",
     "mandatory"                         : "Obligatoire",
     "march"                             : "Mars",
+    "marchShort"                        : "Mars",
     "may"                               : "Mai",
+    "mayShort"                          : "Mai",
     "maxSize"                           : "Taille maximale",
     "memberAllUsers"                    : "Tout les utilisateurs membres",
     "memberDiffTypeUsers"               : "Personnes membres du type de diffusion",
@@ -349,14 +359,17 @@ export const LANG_FR = {
     "notUsed"                           : "Non utilisé",
     "noUserReplacement"                 : "Aucun utilisateur de remplacement",
     "november"                          : "Novembre",
+    "novemberShort"                     : "Nov.",
     "numericPackageImported"            : "Pli numérique correctement importé",
     "object"                            : "Objet",
     "october"                           : "Octobre",
+    "octoberShort"                      : "Oct.",
     "optional"                          : "Optionnel",
     "otherActions"                      : "Action(s) supplémentaire(s)",
     "otherInformations"                 : "Information(s) complémentaire(s)",
     "otherParameters"                   : "Autre(s) paramètre(s)",
     "others"                            : "Autre(s)",
+    "outdated"                          : "Dépassée",
     "outOf"                             : "sur",
     "page"                              : "Page",
     "parameter"                         : "Paramètre",
@@ -440,6 +453,7 @@ export const LANG_FR = {
     "sendmail"                          : "Envoi de courriels",
     "sendTo"                            : "Envoyer à",
     "september"                         : "Septembre",
+    "septemberShort"                    : "Sept.",
     "shortLabel"                        : "Libellé court",
     "signAdded"                         : "Signature ajoutée",
     "signatureAdded"                    : "Signature ajoutée",
diff --git a/src/frontend/plugins/timeLimit.pipe.ts b/src/frontend/plugins/timeLimit.pipe.ts
index d3f88324a7a..85f68c985f6 100644
--- a/src/frontend/plugins/timeLimit.pipe.ts
+++ b/src/frontend/plugins/timeLimit.pipe.ts
@@ -1,10 +1,13 @@
 import {Pipe, PipeTransform, NgZone, ChangeDetectorRef, OnDestroy} from "@angular/core";
+import { LANG } from '../app/translate.component';
+
 @Pipe({
 	name:'timeLimit',
 	pure:false
 })
 export class TimeLimitPipe implements PipeTransform, OnDestroy {
 	private timer: number;
+	lang: any = LANG;
 	constructor(private changeDetectorRef: ChangeDetectorRef, private ngZone: NgZone) {}
 	transform(value:string) {
 		this.removeTimer();
@@ -15,18 +18,18 @@ export class TimeLimitPipe implements PipeTransform, OnDestroy {
 		let minuteNumber = ('0' + d.getMinutes()).slice(-2)
 		let now = new Date();
 		let month = new Array();
-		month[0] = "Jan.";
-		month[1] = "Fév.";
-		month[2] = "Mars";
-		month[3] = "Avr.";
-		month[4] = "Mai";
-		month[5] = "Juin";
-		month[6] = "Juil.";
-		month[7] = "Août";
-		month[8] = "Sept.";
-		month[9] = "Oct.";
-		month[10] = "Nov.";
-		month[11] = "Déc.";
+		month[0] = this.lang.januaryShort;
+		month[1] = this.lang.februaryShort;
+		month[2] = this.lang.marchShort;
+		month[3] = this.lang.aprilShort;
+		month[4] = this.lang.mayShort;
+		month[5] = this.lang.juneShort;
+		month[6] = this.lang.julyShort;
+		month[7] = this.lang.augustShort;
+		month[8] = this.lang.septemberShort;
+		month[9] = this.lang.octoberShort;
+		month[10] = this.lang.novemberShort;
+		month[11] = this.lang.decemberShort;
 		let seconds = Math.round(Math.abs((now.getTime() - d.getTime())/1000));
 		let timeToUpdate = (Number.isNaN(seconds)) ? 1000 : this.getSecondsUntilUpdate(seconds) *1000;
 		this.timer = this.ngZone.runOutsideAngular(() => {
@@ -43,14 +46,14 @@ export class TimeLimitPipe implements PipeTransform, OnDestroy {
 		let months = Math.round(Math.abs(days/30.416));
 		let years = Math.round(Math.abs(days/365));
 		if(now > d) {
-			return '<span class="timeDanger" color="warn">dépassée !</span>';
+			return '<span class="timeDanger" color="warn">' + this.lang.outdated + ' !</span>';
 		} else {
 			if (Number.isNaN(seconds)){
 				return '';
 			} else if (days <= 3) {
-				return '<span color="warn">'+days + ' jour(s)'+'</span>';
+				return '<span color="warn">'+ days + ' ' + this.lang.dayS +'</span>';
 			} else if (days <= 7) {
-				return '<span class="timeWarn">'+days + ' jour(s)'+'</span>';
+				return '<span class="timeWarn">'+ days + ' ' + this.lang.dayS +'</span>';
 			} else if (days <= 345) {
 				return '<span color="accent">'+d.getDate()+' '+ month[d.getMonth()]+'</span>';
 			} else if (days <= 545) {
-- 
GitLab