aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts
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/+my-account/my-account-videos/my-account-videos.component.ts
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/+my-account/my-account-videos/my-account-videos.component.ts')
-rw-r--r--client/src/app/+my-account/my-account-videos/my-account-videos.component.ts17
1 files changed, 7 insertions, 10 deletions
diff --git a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts
index 2274c6a7b..46a02a41a 100644
--- a/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts
+++ b/client/src/app/+my-account/my-account-videos/my-account-videos.component.ts
@@ -7,7 +7,6 @@ import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook'
7import { immutableAssign } from '@app/helpers' 7import { immutableAssign } from '@app/helpers'
8import { Video, VideoService } from '@app/shared/shared-main' 8import { Video, VideoService } from '@app/shared/shared-main'
9import { MiniatureDisplayOptions, OwnerDisplayType, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature' 9import { MiniatureDisplayOptions, OwnerDisplayType, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature'
10import { I18n } from '@ngx-translate/i18n-polyfill'
11import { VideoSortField } from '@shared/models' 10import { VideoSortField } from '@shared/models'
12import { VideoChangeOwnershipComponent } from './video-change-ownership/video-change-ownership.component' 11import { VideoChangeOwnershipComponent } from './video-change-ownership/video-change-ownership.component'
13 12
@@ -50,11 +49,10 @@ export class MyAccountVideosComponent implements OnInit, DisableForReuseHook {
50 protected authService: AuthService, 49 protected authService: AuthService,
51 protected notifier: Notifier, 50 protected notifier: Notifier,
52 protected screenService: ScreenService, 51 protected screenService: ScreenService,
53 private i18n: I18n,
54 private confirmService: ConfirmService, 52 private confirmService: ConfirmService,
55 private videoService: VideoService 53 private videoService: VideoService
56 ) { 54 ) {
57 this.titlePage = this.i18n('My videos') 55 this.titlePage = $localize`My videos`
58 } 56 }
59 57
60 ngOnInit () { 58 ngOnInit () {
@@ -97,8 +95,8 @@ export class MyAccountVideosComponent implements OnInit, DisableForReuseHook {
97 .map(k => parseInt(k, 10)) 95 .map(k => parseInt(k, 10))
98 96
99 const res = await this.confirmService.confirm( 97 const res = await this.confirmService.confirm(
100 this.i18n('Do you really want to delete {{deleteLength}} videos?', { deleteLength: toDeleteVideosIds.length }), 98 $localize`Do you really want to delete ${toDeleteVideosIds.length} videos?`,
101 this.i18n('Delete') 99 $localize`Delete`
102 ) 100 )
103 if (res === false) return 101 if (res === false) return
104 102
@@ -114,8 +112,7 @@ export class MyAccountVideosComponent implements OnInit, DisableForReuseHook {
114 .pipe(toArray()) 112 .pipe(toArray())
115 .subscribe( 113 .subscribe(
116 () => { 114 () => {
117 this.notifier.success(this.i18n('{{deleteLength}} videos deleted.', { deleteLength: toDeleteVideosIds.length })) 115 this.notifier.success($localize`${toDeleteVideosIds.length} videos deleted.`)
118
119 this.selection = {} 116 this.selection = {}
120 }, 117 },
121 118
@@ -125,15 +122,15 @@ export class MyAccountVideosComponent implements OnInit, DisableForReuseHook {
125 122
126 async deleteVideo (video: Video) { 123 async deleteVideo (video: Video) {
127 const res = await this.confirmService.confirm( 124 const res = await this.confirmService.confirm(
128 this.i18n('Do you really want to delete {{videoName}}?', { videoName: video.name }), 125 $localize`Do you really want to delete ${video.name}?`,
129 this.i18n('Delete') 126 $localize`Delete`
130 ) 127 )
131 if (res === false) return 128 if (res === false) return
132 129
133 this.videoService.removeVideo(video.id) 130 this.videoService.removeVideo(video.id)
134 .subscribe( 131 .subscribe(
135 () => { 132 () => {
136 this.notifier.success(this.i18n('Video {{videoName}} deleted.', { videoName: video.name })) 133 this.notifier.success($localize`Video ${video.name} deleted.`)
137 this.removeVideoFromArray(video.id) 134 this.removeVideoFromArray(video.id)
138 }, 135 },
139 136