RED-1905: ocr pages license & date pipe translation fixes

This commit is contained in:
Adina Țeudan 2021-08-09 17:26:25 +03:00
parent b46550da45
commit 43b04c7700
6 changed files with 54 additions and 47 deletions

View File

@ -71,6 +71,11 @@
<div>{{ currentInfo.numberOfAnalyzedPages }}</div>
</div>
<div class="row">
<div translate="license-info-screen.ocr-analyzed-pages"></div>
<div>{{ currentInfo.numberOfOcrPages }}</div>
</div>
<div class="section-title all-caps-label" translate="license-info-screen.usage-details"></div>
<div class="row">

View File

@ -1,11 +1,8 @@
<div *ngFor="let comment of annotation.comments" class="comment">
<div class="comment-details-wrapper">
<div class="comment-details">
<div>{{ getOwnerName(comment) }}</div>
<div [matTooltip]="comment.date | date: 'exactCommentDate'" [matTooltipPosition]="'above'">
<b> {{ getOwnerName(comment) }} </b>
{{ comment.date | date: 'commentDate' }}
</div>
<div [matTooltipPosition]="'above'" [matTooltip]="comment.date | date: 'exactCommentDate'" class="small-label">
<b> {{ getOwnerName(comment) }} </b>
{{ comment.date | date: 'commentDate' }}
</div>
<div class="comment-actions">
<iqser-circle-button

View File

@ -12,10 +12,6 @@
margin-bottom: 4px;
position: relative;
.comment-details {
opacity: 0.7;
}
.comment-actions {
display: none;
position: absolute;

View File

@ -2,23 +2,24 @@ import { Inject, LOCALE_ID, Pipe, PipeTransform } from '@angular/core';
import * as moment from 'moment';
import { TranslateService } from '@ngx-translate/core';
import { DatePipe as BaseDatePipe } from '@angular/common';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
const HOURS_IN_A_DAY = 24;
const MINUTES_IN_AN_HOUR = 60;
const MONTH_NAMES = {
0: 'jan',
1: 'feb',
2: 'mar',
3: 'apr',
4: 'may',
5: 'jun',
6: 'jul',
7: 'aug',
8: 'sep',
9: 'oct',
10: 'nov',
11: 'dec'
}
0: _('months.jan'),
1: _('months.feb'),
2: _('months.mar'),
3: _('months.apr'),
4: _('months.may'),
5: _('months.jun'),
6: _('months.jul'),
7: _('months.aug'),
8: _('months.sep'),
9: _('months.oct'),
10: _('months.nov'),
11: _('months.dec')
};
@Pipe({
name: 'date'
@ -62,7 +63,6 @@ export class DatePipe extends BaseDatePipe implements PipeTransform {
}
private _getCommentDate(item: string) {
const date = moment(item);
const day = date.date();
const month = date.month();
@ -80,15 +80,15 @@ export class DatePipe extends BaseDatePipe implements PipeTransform {
const isYesterdayFormat = date.isSame(yesterday, 'd');
if (isYesterdayFormat) return this._translateService.instant('yesterday');
const isShortMonthFormat = (day < thisDay - 1) && (year === thisYear || month >= thisMonth - 3)
const isShortMonthFormat = day < thisDay - 1 && (year === thisYear || month >= thisMonth - 3);
if (isShortMonthFormat) {
const translatedMonth = this._translateService.instant(`months.${MONTH_NAMES[month]}`);
const translatedMonth = this._translateService.instant(MONTH_NAMES[month]);
return `${day} ${translatedMonth}`;
}
const isShortMonthYearFormat = (year === thisYear - 1) && (month < thisMonth - 3)
const isShortMonthYearFormat = year === thisYear - 1 && month < thisMonth - 3;
if (isShortMonthYearFormat) {
const translatedMonth = this._translateService.instant(`months.${MONTH_NAMES[month]}`);
const translatedMonth = this._translateService.instant(MONTH_NAMES[month]);
return `${translatedMonth} ${year}`;
}
@ -98,11 +98,17 @@ export class DatePipe extends BaseDatePipe implements PipeTransform {
private _getExactCommentDate(item: string) {
const date = moment(item);
const day = date.date();
const month = this._translateService.instant(`months.${MONTH_NAMES[date.month()]}`);
const month = this._translateService.instant(MONTH_NAMES[date.month()]);
const year = date.year();
const hour = date.hour();
const minute = date.minute();
return this._translateService.instant('exact-comment-date', {day, month, year, hour, minute});
return this._translateService.instant('exact-comment-date', {
day,
month,
year,
hour,
minute
});
}
}

View File

@ -801,6 +801,7 @@
"side-nav-title": "Configurations",
"unsaved-changes": "You have unsaved changes. Save or revert before changing the tab."
},
"exact-comment-date": "{day} {month} {year} at {hour}:{minute}",
"file-attribute-types": {
"date": "Date",
"number": "Number",
@ -1078,6 +1079,7 @@
"licensed-to": "Licensed to",
"licensing-details": "Licensing Details",
"licensing-period": "Licensing Period",
"ocr-analyzed-pages": "OCR Analyzed Pages",
"total-analyzed": "Total Analyzed Pages Since {date}",
"unlicensed-analyzed": "Unlicensed Analyzed Pages",
"usage-details": "Usage Details"
@ -1108,6 +1110,20 @@
}
}
},
"months": {
"apr": "Apr.",
"aug": "Aug.",
"dec": "Dec.",
"feb": "Feb.",
"jan": "Jan.",
"jul": "Jul.",
"jun": "Jun.",
"mar": "Mar.",
"may": "May",
"nov": "Nov.",
"oct": "Oct.",
"sep": "Sep."
},
"notifications": {
"mark-read": "Mark as read",
"mark-unread": "Mark as unread",
@ -1250,22 +1266,6 @@
"less-than-an-hour": "< 1 hour",
"no-time-left": "Time to restore already passed"
},
"yesterday": "Yesterday",
"exact-comment-date": "{day} {month} {year} at {hour}:{minute}",
"months": {
"jan": "Jan.",
"feb": "Feb.",
"mar": "Mar.",
"apr": "Apr.",
"may": "May",
"jun": "Jun.",
"jul": "Jul.",
"aug": "Aug.",
"sep": "Sep.",
"oct": "Oct.",
"nov": "Nov.",
"dec": "Dec."
},
"top-bar": {
"navigation-items": {
"back": "Back",
@ -1389,5 +1389,6 @@
"text-placeholder": "Enter text"
},
"title": "Watermark"
}
},
"yesterday": "Yesterday"
}

View File

@ -19,6 +19,8 @@ export interface LicenseReport {
numberOfAnalyzedFiles?: number;
numberOfAnalyzedPages?: number;
numberOfDossiers?: number;
numberOfOcrFiles?: number;
numberOfOcrPages?: number;
offset?: number;
requestId?: string;
startDate?: Date;