From 66357162f8e1227495f09bd4f68446aad7071c6d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 12 Aug 2020 10:40:04 +0200 Subject: Migrate to $localize * Remove i18n polyfill to translate things in components * Reduce bundle sizes * Improve runtime perf * Reduce a lot the time to make a full client build * Reduce client build complexity * We don't need a service to translate things anymore (so we will be able to translate title pages etc) Unfortunately we may loose some translations in the migration process. I'll put a message on weblate to notify translators --- .../src/app/+admin/system/jobs/jobs.component.ts | 6 ++---- .../src/app/+admin/system/logs/logs.component.ts | 24 ++++++++++------------ 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'client/src/app/+admin/system') diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts index ceb848976..96e0f25b0 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.ts +++ b/client/src/app/+admin/system/jobs/jobs.component.ts @@ -2,7 +2,6 @@ import { SortMeta } from 'primeng/api' import { Component, OnInit } from '@angular/core' import { Notifier, RestPagination, RestTable } from '@app/core' import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' -import { I18n } from '@ngx-translate/i18n-polyfill' import { Job, JobState, JobType } from '@shared/models' import { JobStateClient } from '../../../../types/job-state-client.type' import { JobTypeClient } from '../../../../types/job-type-client.type' @@ -43,9 +42,8 @@ export class JobsComponent extends RestTable implements OnInit { constructor ( private notifier: Notifier, - private jobsService: JobService, - private i18n: I18n - ) { + private jobsService: JobService + ) { super() } diff --git a/client/src/app/+admin/system/logs/logs.component.ts b/client/src/app/+admin/system/logs/logs.component.ts index 51f047188..c9c9dc3d1 100644 --- a/client/src/app/+admin/system/logs/logs.component.ts +++ b/client/src/app/+admin/system/logs/logs.component.ts @@ -1,6 +1,5 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' import { Notifier } from '@app/core' -import { I18n } from '@ngx-translate/i18n-polyfill' import { LogLevel } from '@shared/models' import { LogRow } from './log-row.model' import { LogsService } from './logs.service' @@ -25,9 +24,8 @@ export class LogsComponent implements OnInit { constructor ( private logsService: LogsService, - private notifier: Notifier, - private i18n: I18n - ) { } + private notifier: Notifier + ) { } ngOnInit (): void { this.buildTimeChoices() @@ -78,15 +76,15 @@ export class LogsComponent implements OnInit { this.timeChoices = [ { id: lastWeek.toISOString(), - label: this.i18n('Last week') + label: $localize`Last week` }, { id: lastDay.toISOString(), - label: this.i18n('Last day') + label: $localize`Last day` }, { id: lastHour.toISOString(), - label: this.i18n('Last hour') + label: $localize`Last hour` } ] @@ -97,19 +95,19 @@ export class LogsComponent implements OnInit { this.levelChoices = [ { id: 'debug', - label: this.i18n('Debug') + label: $localize`Debug` }, { id: 'info', - label: this.i18n('Info') + label: $localize`Info` }, { id: 'warn', - label: this.i18n('Warning') + label: $localize`Warning` }, { id: 'error', - label: this.i18n('Error') + label: $localize`Error` } ] @@ -120,11 +118,11 @@ export class LogsComponent implements OnInit { this.logTypeChoices = [ { id: 'standard', - label: this.i18n('Standard logs') + label: $localize`Standard logs` }, { id: 'audit', - label: this.i18n('Audit logs') + label: $localize`Audit logs` } ] -- cgit v1.2.3