diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-12 10:40:04 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-14 10:28:30 +0200 |
commit | 66357162f8e1227495f09bd4f68446aad7071c6d (patch) | |
tree | 7d4429506deb512b2fe1d0267f38a28cda20af55 /client/src/app/+admin/system | |
parent | 8c360747995e17eb5520e22fc3d7bd4c3d26eeee (diff) | |
download | PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.tar.gz PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.tar.zst PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.zip |
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
Diffstat (limited to 'client/src/app/+admin/system')
-rw-r--r-- | client/src/app/+admin/system/jobs/jobs.component.ts | 6 | ||||
-rw-r--r-- | client/src/app/+admin/system/logs/logs.component.ts | 24 |
2 files changed, 13 insertions, 17 deletions
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' | |||
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { Notifier, RestPagination, RestTable } from '@app/core' | 3 | import { Notifier, RestPagination, RestTable } from '@app/core' |
4 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | 4 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | import { Job, JobState, JobType } from '@shared/models' | 5 | import { Job, JobState, JobType } from '@shared/models' |
7 | import { JobStateClient } from '../../../../types/job-state-client.type' | 6 | import { JobStateClient } from '../../../../types/job-state-client.type' |
8 | import { JobTypeClient } from '../../../../types/job-type-client.type' | 7 | import { JobTypeClient } from '../../../../types/job-type-client.type' |
@@ -43,9 +42,8 @@ export class JobsComponent extends RestTable implements OnInit { | |||
43 | 42 | ||
44 | constructor ( | 43 | constructor ( |
45 | private notifier: Notifier, | 44 | private notifier: Notifier, |
46 | private jobsService: JobService, | 45 | private jobsService: JobService |
47 | private i18n: I18n | 46 | ) { |
48 | ) { | ||
49 | super() | 47 | super() |
50 | } | 48 | } |
51 | 49 | ||
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 @@ | |||
1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' |
2 | import { Notifier } from '@app/core' | 2 | import { Notifier } from '@app/core' |
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
4 | import { LogLevel } from '@shared/models' | 3 | import { LogLevel } from '@shared/models' |
5 | import { LogRow } from './log-row.model' | 4 | import { LogRow } from './log-row.model' |
6 | import { LogsService } from './logs.service' | 5 | import { LogsService } from './logs.service' |
@@ -25,9 +24,8 @@ export class LogsComponent implements OnInit { | |||
25 | 24 | ||
26 | constructor ( | 25 | constructor ( |
27 | private logsService: LogsService, | 26 | private logsService: LogsService, |
28 | private notifier: Notifier, | 27 | private notifier: Notifier |
29 | private i18n: I18n | 28 | ) { } |
30 | ) { } | ||
31 | 29 | ||
32 | ngOnInit (): void { | 30 | ngOnInit (): void { |
33 | this.buildTimeChoices() | 31 | this.buildTimeChoices() |
@@ -78,15 +76,15 @@ export class LogsComponent implements OnInit { | |||
78 | this.timeChoices = [ | 76 | this.timeChoices = [ |
79 | { | 77 | { |
80 | id: lastWeek.toISOString(), | 78 | id: lastWeek.toISOString(), |
81 | label: this.i18n('Last week') | 79 | label: $localize`Last week` |
82 | }, | 80 | }, |
83 | { | 81 | { |
84 | id: lastDay.toISOString(), | 82 | id: lastDay.toISOString(), |
85 | label: this.i18n('Last day') | 83 | label: $localize`Last day` |
86 | }, | 84 | }, |
87 | { | 85 | { |
88 | id: lastHour.toISOString(), | 86 | id: lastHour.toISOString(), |
89 | label: this.i18n('Last hour') | 87 | label: $localize`Last hour` |
90 | } | 88 | } |
91 | ] | 89 | ] |
92 | 90 | ||
@@ -97,19 +95,19 @@ export class LogsComponent implements OnInit { | |||
97 | this.levelChoices = [ | 95 | this.levelChoices = [ |
98 | { | 96 | { |
99 | id: 'debug', | 97 | id: 'debug', |
100 | label: this.i18n('Debug') | 98 | label: $localize`Debug` |
101 | }, | 99 | }, |
102 | { | 100 | { |
103 | id: 'info', | 101 | id: 'info', |
104 | label: this.i18n('Info') | 102 | label: $localize`Info` |
105 | }, | 103 | }, |
106 | { | 104 | { |
107 | id: 'warn', | 105 | id: 'warn', |
108 | label: this.i18n('Warning') | 106 | label: $localize`Warning` |
109 | }, | 107 | }, |
110 | { | 108 | { |
111 | id: 'error', | 109 | id: 'error', |
112 | label: this.i18n('Error') | 110 | label: $localize`Error` |
113 | } | 111 | } |
114 | ] | 112 | ] |
115 | 113 | ||
@@ -120,11 +118,11 @@ export class LogsComponent implements OnInit { | |||
120 | this.logTypeChoices = [ | 118 | this.logTypeChoices = [ |
121 | { | 119 | { |
122 | id: 'standard', | 120 | id: 'standard', |
123 | label: this.i18n('Standard logs') | 121 | label: $localize`Standard logs` |
124 | }, | 122 | }, |
125 | { | 123 | { |
126 | id: 'audit', | 124 | id: 'audit', |
127 | label: this.i18n('Audit logs') | 125 | label: $localize`Audit logs` |
128 | } | 126 | } |
129 | ] | 127 | ] |
130 | 128 | ||