Skip to content
Snippets Groups Projects
Commit c24a5439 authored by kevin.dezaphi's avatar kevin.dezaphi
Browse files

FEAT #8218 update lang home

parent b3049dc7
No related branches found
No related tags found
No related merge requests found
...@@ -636,5 +636,8 @@ export const LANG_EN = { ...@@ -636,5 +636,8 @@ export const LANG_EN = {
"menu" : "Menu", "menu" : "Menu",
"visaUser" : "Visa", "visaUser" : "Visa",
"signUser" : "Signatory", "signUser" : "Signatory",
"fewSeconds" : "few seconde",
"oneMinute" : "one minute",
"oneHour" : "one hour",
}; };
...@@ -661,4 +661,7 @@ export const LANG_FR = { ...@@ -661,4 +661,7 @@ export const LANG_FR = {
"menu" : "Menu", "menu" : "Menu",
"visaUser" : "Viseur", "visaUser" : "Viseur",
"signUser" : "Signataire", "signUser" : "Signataire",
"fewSeconds" : "quelques secondes",
"oneMinute" : "une minute",
"oneHour" : "une heure",
}; };
import {Pipe, PipeTransform, NgZone, ChangeDetectorRef, OnDestroy} from "@angular/core"; import {Pipe, PipeTransform, NgZone, ChangeDetectorRef, OnDestroy} from "@angular/core";
import { LANG } from '../app/translate.component';
@Pipe({ @Pipe({
name:'timeAgo', name:'timeAgo',
pure:false pure:false
}) })
export class TimeAgoPipe implements PipeTransform, OnDestroy { export class TimeAgoPipe implements PipeTransform, OnDestroy {
private timer: number; private timer: number;
lang: any = LANG;
constructor(private changeDetectorRef: ChangeDetectorRef, private ngZone: NgZone) {} constructor(private changeDetectorRef: ChangeDetectorRef, private ngZone: NgZone) {}
transform(value:string) { transform(value:string) {
this.removeTimer(); this.removeTimer();
...@@ -15,18 +18,18 @@ export class TimeAgoPipe implements PipeTransform, OnDestroy { ...@@ -15,18 +18,18 @@ export class TimeAgoPipe implements PipeTransform, OnDestroy {
let minuteNumber = ('0' + d.getMinutes()).slice(-2); let minuteNumber = ('0' + d.getMinutes()).slice(-2);
let now = new Date(); let now = new Date();
let month = []; let month = [];
month[0] = "Jan."; month[0] = this.lang.januaryShort;
month[1] = "Fév."; month[1] = this.lang.februaryShort;
month[2] = "Mars"; month[2] = this.lang.marchShort;
month[3] = "Avr."; month[3] = this.lang.aprilShort;
month[4] = "Mai"; month[4] = this.lang.mayShort;
month[5] = "Juin"; month[5] = this.lang.juneShort;
month[6] = "Juil."; month[6] = this.lang.julyShort;
month[7] = "Août"; month[7] = this.lang.augustShort;
month[8] = "Sept."; month[8] = this.lang.septemberShort;
month[9] = "Oct."; month[9] = this.lang.octoberShort;
month[10] = "Nov."; month[10] = this.lang.novemberShort;
month[11] = "Déc."; month[11] = this.lang.decemberShort;
let seconds = Math.round(Math.abs((now.getTime() - d.getTime())/1000)); let seconds = Math.round(Math.abs((now.getTime() - d.getTime())/1000));
let timeToUpdate = (Number.isNaN(seconds)) ? 1000 : this.getSecondsUntilUpdate(seconds) *1000; let timeToUpdate = (Number.isNaN(seconds)) ? 1000 : this.getSecondsUntilUpdate(seconds) *1000;
this.timer = this.ngZone.runOutsideAngular(() => { this.timer = this.ngZone.runOutsideAngular(() => {
...@@ -45,13 +48,13 @@ export class TimeAgoPipe implements PipeTransform, OnDestroy { ...@@ -45,13 +48,13 @@ export class TimeAgoPipe implements PipeTransform, OnDestroy {
if (Number.isNaN(seconds)){ if (Number.isNaN(seconds)){
return ''; return '';
} else if (seconds <= 45) { } else if (seconds <= 45) {
return 'quelques secondes'; return this.lang.fewSeconds;
} else if (seconds <= 90) { } else if (seconds <= 90) {
return 'une minute'; return this.lang.oneMinute;
} else if (minutes <= 45) { } else if (minutes <= 45) {
return minutes + ' minutes'; return minutes + ' ' + this.lang.minutes;
} else if (minutes <= 90) { } else if (minutes <= 90) {
return 'une heure'; return this.lang.oneHour;
} else if (hours <= 22) { } else if (hours <= 22) {
return hourNumber+':'+minuteNumber; return hourNumber+':'+minuteNumber;
//return hours + ' heures'; //return hours + ' heures';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment