aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/follows
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-12 10:40:04 +0200
committerChocobozzz <me@florianbigard.com>2020-08-14 10:28:30 +0200
commit66357162f8e1227495f09bd4f68446aad7071c6d (patch)
tree7d4429506deb512b2fe1d0267f38a28cda20af55 /client/src/app/+admin/follows
parent8c360747995e17eb5520e22fc3d7bd4c3d26eeee (diff)
downloadPeerTube-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/follows')
-rw-r--r--client/src/app/+admin/follows/followers-list/followers-list.component.ts16
-rw-r--r--client/src/app/+admin/follows/following-list/following-list.component.ts14
-rw-r--r--client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts10
-rw-r--r--client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts14
4 files changed, 23 insertions, 31 deletions
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts
index 63135f898..904e3c338 100644
--- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts
+++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts
@@ -2,7 +2,6 @@ import { SortMeta } from 'primeng/api'
2import { Component, OnInit } from '@angular/core' 2import { Component, OnInit } from '@angular/core'
3import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' 3import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'
4import { InstanceFollowService } from '@app/shared/shared-instance' 4import { InstanceFollowService } from '@app/shared/shared-instance'
5import { I18n } from '@ngx-translate/i18n-polyfill'
6import { ActorFollow } from '@shared/models' 5import { ActorFollow } from '@shared/models'
7 6
8@Component({ 7@Component({
@@ -19,7 +18,6 @@ export class FollowersListComponent extends RestTable implements OnInit {
19 constructor ( 18 constructor (
20 private confirmService: ConfirmService, 19 private confirmService: ConfirmService,
21 private notifier: Notifier, 20 private notifier: Notifier,
22 private i18n: I18n,
23 private followService: InstanceFollowService 21 private followService: InstanceFollowService
24 ) { 22 ) {
25 super() 23 super()
@@ -40,7 +38,7 @@ export class FollowersListComponent extends RestTable implements OnInit {
40 .subscribe( 38 .subscribe(
41 () => { 39 () => {
42 const handle = follow.follower.name + '@' + follow.follower.host 40 const handle = follow.follower.name + '@' + follow.follower.host
43 this.notifier.success(this.i18n('{{handle}} accepted in instance followers', { handle })) 41 this.notifier.success($localize`${handle} accepted in instance followers`)
44 }, 42 },
45 43
46 err => { 44 err => {
@@ -51,15 +49,15 @@ export class FollowersListComponent extends RestTable implements OnInit {
51 } 49 }
52 50
53 async rejectFollower (follow: ActorFollow) { 51 async rejectFollower (follow: ActorFollow) {
54 const message = this.i18n('Do you really want to reject this follower?') 52 const message = $localize`Do you really want to reject this follower?`
55 const res = await this.confirmService.confirm(message, this.i18n('Reject')) 53 const res = await this.confirmService.confirm(message, $localize`Reject`)
56 if (res === false) return 54 if (res === false) return
57 55
58 this.followService.rejectFollower(follow) 56 this.followService.rejectFollower(follow)
59 .subscribe( 57 .subscribe(
60 () => { 58 () => {
61 const handle = follow.follower.name + '@' + follow.follower.host 59 const handle = follow.follower.name + '@' + follow.follower.host
62 this.notifier.success(this.i18n('{{handle}} rejected from instance followers', { handle })) 60 this.notifier.success($localize`${handle} rejected from instance followers`)
63 61
64 this.loadData() 62 this.loadData()
65 }, 63 },
@@ -72,15 +70,15 @@ export class FollowersListComponent extends RestTable implements OnInit {
72 } 70 }
73 71
74 async deleteFollower (follow: ActorFollow) { 72 async deleteFollower (follow: ActorFollow) {
75 const message = this.i18n('Do you really want to delete this follower?') 73 const message = $localize`Do you really want to delete this follower?`
76 const res = await this.confirmService.confirm(message, this.i18n('Delete')) 74 const res = await this.confirmService.confirm(message, $localize`Delete`)
77 if (res === false) return 75 if (res === false) return
78 76
79 this.followService.removeFollower(follow) 77 this.followService.removeFollower(follow)
80 .subscribe( 78 .subscribe(
81 () => { 79 () => {
82 const handle = follow.follower.name + '@' + follow.follower.host 80 const handle = follow.follower.name + '@' + follow.follower.host
83 this.notifier.success(this.i18n('{{handle}} removed from instance followers', { handle })) 81 this.notifier.success($localize`${handle} removed from instance followers`)
84 82
85 this.loadData() 83 this.loadData()
86 }, 84 },
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts
index dae8923b5..5f71f1238 100644
--- a/client/src/app/+admin/follows/following-list/following-list.component.ts
+++ b/client/src/app/+admin/follows/following-list/following-list.component.ts
@@ -3,7 +3,6 @@ import { Component, OnInit, ViewChild } from '@angular/core'
3import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' 3import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'
4import { InstanceFollowService } from '@app/shared/shared-instance' 4import { InstanceFollowService } from '@app/shared/shared-instance'
5import { BatchDomainsModalComponent } from '@app/shared/shared-moderation' 5import { BatchDomainsModalComponent } from '@app/shared/shared-moderation'
6import { I18n } from '@ngx-translate/i18n-polyfill'
7import { ActorFollow } from '@shared/models' 6import { ActorFollow } from '@shared/models'
8 7
9@Component({ 8@Component({
@@ -22,9 +21,8 @@ export class FollowingListComponent extends RestTable implements OnInit {
22 constructor ( 21 constructor (
23 private notifier: Notifier, 22 private notifier: Notifier,
24 private confirmService: ConfirmService, 23 private confirmService: ConfirmService,
25 private followService: InstanceFollowService, 24 private followService: InstanceFollowService
26 private i18n: I18n 25 ) {
27 ) {
28 super() 26 super()
29 } 27 }
30 28
@@ -47,7 +45,7 @@ export class FollowingListComponent extends RestTable implements OnInit {
47 async addFollowing (hosts: string[]) { 45 async addFollowing (hosts: string[]) {
48 this.followService.follow(hosts).subscribe( 46 this.followService.follow(hosts).subscribe(
49 () => { 47 () => {
50 this.notifier.success(this.i18n('Follow request(s) sent!')) 48 this.notifier.success($localize`Follow request(s) sent!`)
51 this.loadData() 49 this.loadData()
52 }, 50 },
53 51
@@ -57,14 +55,14 @@ export class FollowingListComponent extends RestTable implements OnInit {
57 55
58 async removeFollowing (follow: ActorFollow) { 56 async removeFollowing (follow: ActorFollow) {
59 const res = await this.confirmService.confirm( 57 const res = await this.confirmService.confirm(
60 this.i18n('Do you really want to unfollow {{host}}?', { host: follow.following.host }), 58 $localize`Do you really want to unfollow ${follow.following.host}?`,
61 this.i18n('Unfollow') 59 $localize`Unfollow`
62 ) 60 )
63 if (res === false) return 61 if (res === false) return
64 62
65 this.followService.unfollow(follow).subscribe( 63 this.followService.unfollow(follow).subscribe(
66 () => { 64 () => {
67 this.notifier.success(this.i18n('You are not following {{host}} anymore.', { host: follow.following.host })) 65 this.notifier.success($localize`You are not following ${follow.following.host} anymore.`)
68 this.loadData() 66 this.loadData()
69 }, 67 },
70 68
diff --git a/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts b/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts
index 662143abc..729b7f599 100644
--- a/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts
+++ b/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts
@@ -1,7 +1,6 @@
1import { Component, Input } from '@angular/core' 1import { Component, Input } from '@angular/core'
2import { Notifier } from '@app/core' 2import { Notifier } from '@app/core'
3import { RedundancyService } from '@app/shared/shared-main' 3import { RedundancyService } from '@app/shared/shared-main'
4import { I18n } from '@ngx-translate/i18n-polyfill'
5 4
6@Component({ 5@Component({
7 selector: 'my-redundancy-checkbox', 6 selector: 'my-redundancy-checkbox',
@@ -14,17 +13,16 @@ export class RedundancyCheckboxComponent {
14 13
15 constructor ( 14 constructor (
16 private notifier: Notifier, 15 private notifier: Notifier,
17 private redundancyService: RedundancyService, 16 private redundancyService: RedundancyService
18 private i18n: I18n 17 ) { }
19 ) { }
20 18
21 updateRedundancyState () { 19 updateRedundancyState () {
22 this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed) 20 this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed)
23 .subscribe( 21 .subscribe(
24 () => { 22 () => {
25 const stateLabel = this.redundancyAllowed ? this.i18n('enabled') : this.i18n('disabled') 23 const stateLabel = this.redundancyAllowed ? $localize`enabled` : $localize`disabled`
26 24
27 this.notifier.success(this.i18n('Redundancy for {{host}} is {{stateLabel}}', { host: this.host, stateLabel })) 25 this.notifier.success($localize`Redundancy for ${this.host} is ${stateLabel}`)
28 }, 26 },
29 27
30 err => this.notifier.error(err.message) 28 err => this.notifier.error(err.message)
diff --git a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts
index 07e2e0ff3..d6fd1a1ab 100644
--- a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts
+++ b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts
@@ -2,7 +2,6 @@ import { SortMeta } from 'primeng/api'
2import { Component, OnInit } from '@angular/core' 2import { Component, OnInit } from '@angular/core'
3import { ConfirmService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' 3import { ConfirmService, Notifier, RestPagination, RestTable, ServerService } from '@app/core'
4import { BytesPipe, RedundancyService } from '@app/shared/shared-main' 4import { BytesPipe, RedundancyService } from '@app/shared/shared-main'
5import { I18n } from '@ngx-translate/i18n-polyfill'
6import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' 5import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
7import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' 6import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models'
8import { VideosRedundancyStats } from '@shared/models/server' 7import { VideosRedundancyStats } from '@shared/models/server'
@@ -32,9 +31,8 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit
32 private notifier: Notifier, 31 private notifier: Notifier,
33 private confirmService: ConfirmService, 32 private confirmService: ConfirmService,
34 private redundancyService: RedundancyService, 33 private redundancyService: RedundancyService,
35 private serverService: ServerService, 34 private serverService: ServerService
36 private i18n: I18n 35 ) {
37 ) {
38 super() 36 super()
39 37
40 this.bytesPipe = new BytesPipe() 38 this.bytesPipe = new BytesPipe()
@@ -100,7 +98,7 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit
100 this.redundanciesGraphsData.push({ 98 this.redundanciesGraphsData.push({
101 stats, 99 stats,
102 graphData: { 100 graphData: {
103 labels: [ this.i18n('Used'), this.i18n('Available') ], 101 labels: [ $localize`Used`, $localize`Available` ],
104 datasets: [ 102 datasets: [
105 { 103 {
106 data: [ stats.totalUsed, totalSize ], 104 data: [ stats.totalUsed, totalSize ],
@@ -139,14 +137,14 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit
139 } 137 }
140 138
141 async removeRedundancy (redundancy: VideoRedundancy) { 139 async removeRedundancy (redundancy: VideoRedundancy) {
142 const message = this.i18n('Do you really want to remove this video redundancy?') 140 const message = $localize`Do you really want to remove this video redundancy?`
143 const res = await this.confirmService.confirm(message, this.i18n('Remove redundancy')) 141 const res = await this.confirmService.confirm(message, $localize`Remove redundancy`)
144 if (res === false) return 142 if (res === false) return
145 143
146 this.redundancyService.removeVideoRedundancies(redundancy) 144 this.redundancyService.removeVideoRedundancies(redundancy)
147 .subscribe( 145 .subscribe(
148 () => { 146 () => {
149 this.notifier.success(this.i18n('Video redundancies removed!')) 147 this.notifier.success($localize`Video redundancies removed!`)
150 this.loadData() 148 this.loadData()
151 }, 149 },
152 150