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/+my-account | |
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/+my-account')
18 files changed, 118 insertions, 179 deletions
diff --git a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts index 039c389e4..5c438c3bf 100644 --- a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts +++ b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-create.component.ts | |||
@@ -3,7 +3,6 @@ import { Router } from '@angular/router' | |||
3 | import { AuthService, Notifier } from '@app/core' | 3 | import { AuthService, Notifier } from '@app/core' |
4 | import { FormValidatorService, VideoChannelValidatorsService } from '@app/shared/shared-forms' | 4 | import { FormValidatorService, VideoChannelValidatorsService } from '@app/shared/shared-forms' |
5 | import { VideoChannelService } from '@app/shared/shared-main' | 5 | import { VideoChannelService } from '@app/shared/shared-main' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
7 | import { VideoChannelCreate } from '@shared/models' | 6 | import { VideoChannelCreate } from '@shared/models' |
8 | import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' | 7 | import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' |
9 | 8 | ||
@@ -21,9 +20,8 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE | |||
21 | private videoChannelValidatorsService: VideoChannelValidatorsService, | 20 | private videoChannelValidatorsService: VideoChannelValidatorsService, |
22 | private notifier: Notifier, | 21 | private notifier: Notifier, |
23 | private router: Router, | 22 | private router: Router, |
24 | private videoChannelService: VideoChannelService, | 23 | private videoChannelService: VideoChannelService |
25 | private i18n: I18n | 24 | ) { |
26 | ) { | ||
27 | super() | 25 | super() |
28 | } | 26 | } |
29 | 27 | ||
@@ -55,15 +53,13 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE | |||
55 | () => { | 53 | () => { |
56 | this.authService.refreshUserInformation() | 54 | this.authService.refreshUserInformation() |
57 | 55 | ||
58 | this.notifier.success( | 56 | this.notifier.success($localize`Video channel ${videoChannelCreate.displayName} created.`) |
59 | this.i18n('Video channel {{videoChannelName}} created.', { videoChannelName: videoChannelCreate.displayName }) | ||
60 | ) | ||
61 | this.router.navigate([ '/my-account', 'video-channels' ]) | 57 | this.router.navigate([ '/my-account', 'video-channels' ]) |
62 | }, | 58 | }, |
63 | 59 | ||
64 | err => { | 60 | err => { |
65 | if (err.status === 409) { | 61 | if (err.status === 409) { |
66 | this.error = this.i18n('This name already exists on this instance.') | 62 | this.error = $localize`This name already exists on this instance.` |
67 | return | 63 | return |
68 | } | 64 | } |
69 | 65 | ||
@@ -77,6 +73,6 @@ export class MyAccountVideoChannelCreateComponent extends MyAccountVideoChannelE | |||
77 | } | 73 | } |
78 | 74 | ||
79 | getFormButtonTitle () { | 75 | getFormButtonTitle () { |
80 | return this.i18n('Create') | 76 | return $localize`Create` |
81 | } | 77 | } |
82 | } | 78 | } |
diff --git a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-update.component.ts b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-update.component.ts index 489c437ea..485521dcc 100644 --- a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-update.component.ts +++ b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channel-update.component.ts | |||
@@ -4,7 +4,6 @@ import { ActivatedRoute, Router } from '@angular/router' | |||
4 | import { AuthService, Notifier, ServerService } from '@app/core' | 4 | import { AuthService, Notifier, ServerService } from '@app/core' |
5 | import { FormValidatorService, VideoChannelValidatorsService } from '@app/shared/shared-forms' | 5 | import { FormValidatorService, VideoChannelValidatorsService } from '@app/shared/shared-forms' |
6 | import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' | 6 | import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
8 | import { ServerConfig, VideoChannelUpdate } from '@shared/models' | 7 | import { ServerConfig, VideoChannelUpdate } from '@shared/models' |
9 | import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' | 8 | import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit' |
10 | 9 | ||
@@ -29,7 +28,6 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
29 | private router: Router, | 28 | private router: Router, |
30 | private route: ActivatedRoute, | 29 | private route: ActivatedRoute, |
31 | private videoChannelService: VideoChannelService, | 30 | private videoChannelService: VideoChannelService, |
32 | private i18n: I18n, | ||
33 | private serverService: ServerService | 31 | private serverService: ServerService |
34 | ) { | 32 | ) { |
35 | super() | 33 | super() |
@@ -87,9 +85,7 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
87 | () => { | 85 | () => { |
88 | this.authService.refreshUserInformation() | 86 | this.authService.refreshUserInformation() |
89 | 87 | ||
90 | this.notifier.success( | 88 | this.notifier.success($localize`Video channel ${videoChannelUpdate.displayName} updated.`) |
91 | this.i18n('Video channel {{videoChannelName}} updated.', { videoChannelName: videoChannelUpdate.displayName }) | ||
92 | ) | ||
93 | 89 | ||
94 | this.router.navigate([ '/my-account', 'video-channels' ]) | 90 | this.router.navigate([ '/my-account', 'video-channels' ]) |
95 | }, | 91 | }, |
@@ -102,7 +98,7 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
102 | this.videoChannelService.changeVideoChannelAvatar(this.videoChannelToUpdate.name, formData) | 98 | this.videoChannelService.changeVideoChannelAvatar(this.videoChannelToUpdate.name, formData) |
103 | .subscribe( | 99 | .subscribe( |
104 | data => { | 100 | data => { |
105 | this.notifier.success(this.i18n('Avatar changed.')) | 101 | this.notifier.success($localize`Avatar changed.`) |
106 | 102 | ||
107 | this.videoChannelToUpdate.updateAvatar(data.avatar) | 103 | this.videoChannelToUpdate.updateAvatar(data.avatar) |
108 | }, | 104 | }, |
@@ -124,7 +120,7 @@ export class MyAccountVideoChannelUpdateComponent extends MyAccountVideoChannelE | |||
124 | } | 120 | } |
125 | 121 | ||
126 | getFormButtonTitle () { | 122 | getFormButtonTitle () { |
127 | return this.i18n('Update') | 123 | return $localize`Update` |
128 | } | 124 | } |
129 | 125 | ||
130 | isBulkUpdateVideosDisplayed () { | 126 | isBulkUpdateVideosDisplayed () { |
diff --git a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.ts b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.ts index ad9368794..2aff09cd9 100644 --- a/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.ts +++ b/client/src/app/+my-account/+my-account-video-channels/my-account-video-channels.component.ts | |||
@@ -1,11 +1,10 @@ | |||
1 | import { ChartData } from 'chart.js' | 1 | import { ChartData } from 'chart.js' |
2 | import { max, maxBy, min, minBy } from 'lodash-es' | 2 | import { max, maxBy, min, minBy } from 'lodash-es' |
3 | import { flatMap, debounceTime } from 'rxjs/operators' | 3 | import { Subject } from 'rxjs' |
4 | import { debounceTime, mergeMap } from 'rxjs/operators' | ||
4 | import { Component, OnInit } from '@angular/core' | 5 | import { Component, OnInit } from '@angular/core' |
5 | import { AuthService, ConfirmService, Notifier, ScreenService, User } from '@app/core' | 6 | import { AuthService, ConfirmService, Notifier, ScreenService, User } from '@app/core' |
6 | import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' | 7 | import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
8 | import { Subject } from 'rxjs' | ||
9 | 8 | ||
10 | @Component({ | 9 | @Component({ |
11 | selector: 'my-account-video-channels', | 10 | selector: 'my-account-video-channels', |
@@ -30,9 +29,8 @@ export class MyAccountVideoChannelsComponent implements OnInit { | |||
30 | private notifier: Notifier, | 29 | private notifier: Notifier, |
31 | private confirmService: ConfirmService, | 30 | private confirmService: ConfirmService, |
32 | private videoChannelService: VideoChannelService, | 31 | private videoChannelService: VideoChannelService, |
33 | private screenService: ScreenService, | 32 | private screenService: ScreenService |
34 | private i18n: I18n | 33 | ) {} |
35 | ) {} | ||
36 | 34 | ||
37 | ngOnInit () { | 35 | ngOnInit () { |
38 | this.user = this.authService.getUser() | 36 | this.user = this.authService.getUser() |
@@ -110,17 +108,13 @@ export class MyAccountVideoChannelsComponent implements OnInit { | |||
110 | 108 | ||
111 | async deleteVideoChannel (videoChannel: VideoChannel) { | 109 | async deleteVideoChannel (videoChannel: VideoChannel) { |
112 | const res = await this.confirmService.confirmWithInput( | 110 | const res = await this.confirmService.confirmWithInput( |
113 | this.i18n( | 111 | $localize`Do you really want to delete ${videoChannel.displayName}? |
114 | // tslint:disable | 112 | It will delete ${videoChannel.videosCount} videos uploaded in this channel, and you will not be able to create another |
115 | 'Do you really want to delete {{channelDisplayName}}? It will delete {{videosCount}} videos uploaded in this channel, and you will not be able to create another channel with the same name ({{channelName}})!', | 113 | channel with the same name (${videoChannel.name})!`, |
116 | { channelDisplayName: videoChannel.displayName, videosCount: videoChannel.videosCount, channelName: videoChannel.name } | 114 | |
117 | ), | 115 | $localize`Please type the display name of the video channel (${videoChannel.displayName}) to confirm`, |
118 | this.i18n( | 116 | |
119 | 'Please type the display name of the video channel ({{displayName}}) to confirm', | 117 | $localize`Delete` |
120 | { displayName: videoChannel.displayName } | ||
121 | ), | ||
122 | videoChannel.displayName, | ||
123 | this.i18n('Delete') | ||
124 | ) | 118 | ) |
125 | if (res === false) return | 119 | if (res === false) return |
126 | 120 | ||
@@ -128,9 +122,7 @@ export class MyAccountVideoChannelsComponent implements OnInit { | |||
128 | .subscribe( | 122 | .subscribe( |
129 | () => { | 123 | () => { |
130 | this.loadVideoChannels() | 124 | this.loadVideoChannels() |
131 | this.notifier.success( | 125 | this.notifier.success($localize`Video channel ${videoChannel.displayName} deleted.`) |
132 | this.i18n('Video channel {{videoChannelName}} deleted.', { videoChannelName: videoChannel.displayName }) | ||
133 | ) | ||
134 | }, | 126 | }, |
135 | 127 | ||
136 | error => this.notifier.error(error.message) | 128 | error => this.notifier.error(error.message) |
@@ -139,7 +131,7 @@ export class MyAccountVideoChannelsComponent implements OnInit { | |||
139 | 131 | ||
140 | private loadVideoChannels () { | 132 | private loadVideoChannels () { |
141 | this.authService.userInformationLoaded | 133 | this.authService.userInformationLoaded |
142 | .pipe(flatMap(() => this.videoChannelService.listAccountVideoChannels(this.user.account, null, true, this.channelsSearch))) | 134 | .pipe(mergeMap(() => this.videoChannelService.listAccountVideoChannels(this.user.account, null, true, this.channelsSearch))) |
143 | .subscribe(res => { | 135 | .subscribe(res => { |
144 | this.videoChannels = res.data | 136 | this.videoChannels = res.data |
145 | this.totalItems = res.total | 137 | this.totalItems = res.total |
@@ -149,10 +141,10 @@ export class MyAccountVideoChannelsComponent implements OnInit { | |||
149 | labels: v.viewsPerDay.map(day => day.date.toLocaleDateString()), | 141 | labels: v.viewsPerDay.map(day => day.date.toLocaleDateString()), |
150 | datasets: [ | 142 | datasets: [ |
151 | { | 143 | { |
152 | label: this.i18n('Views for the day'), | 144 | label: $localize`Views for the day`, |
153 | data: v.viewsPerDay.map(day => day.views), | 145 | data: v.viewsPerDay.map(day => day.views), |
154 | fill: false, | 146 | fill: false, |
155 | borderColor: "#c6c6c6" | 147 | borderColor: '#c6c6c6' |
156 | } | 148 | } |
157 | ] | 149 | ] |
158 | } as ChartData)) | 150 | } as ChartData)) |
@@ -160,13 +152,15 @@ export class MyAccountVideoChannelsComponent implements OnInit { | |||
160 | // chart options that depend on chart data: | 152 | // chart options that depend on chart data: |
161 | // we don't want to skew values and have min at 0, so we define what the floor/ceiling is here | 153 | // we don't want to skew values and have min at 0, so we define what the floor/ceiling is here |
162 | this.videoChannelsMinimumDailyViews = min( | 154 | this.videoChannelsMinimumDailyViews = min( |
163 | this.videoChannels.map(v => minBy( // compute local minimum daily views for each channel, by their "views" attribute | 155 | // compute local minimum daily views for each channel, by their "views" attribute |
156 | this.videoChannels.map(v => minBy( | ||
164 | v.viewsPerDay, | 157 | v.viewsPerDay, |
165 | day => day.views | 158 | day => day.views |
166 | ).views) // the object returned is a ViewPerDate, so we still need to get the views attribute | 159 | ).views) // the object returned is a ViewPerDate, so we still need to get the views attribute |
167 | ) | 160 | ) |
168 | this.videoChannelsMaximumDailyViews = max( | 161 | this.videoChannelsMaximumDailyViews = max( |
169 | this.videoChannels.map(v => maxBy( // compute local maximum daily views for each channel, by their "views" attribute | 162 | // compute local maximum daily views for each channel, by their "views" attribute |
163 | this.videoChannels.map(v => maxBy( | ||
170 | v.viewsPerDay, | 164 | v.viewsPerDay, |
171 | day => day.views | 165 | day => day.views |
172 | ).views) // the object returned is a ViewPerDate, so we still need to get the views attribute | 166 | ).views) // the object returned is a ViewPerDate, so we still need to get the views attribute |
diff --git a/client/src/app/+my-account/my-account-history/my-account-history.component.ts b/client/src/app/+my-account/my-account-history/my-account-history.component.ts index dc78b3d6e..3298c56c7 100644 --- a/client/src/app/+my-account/my-account-history/my-account-history.component.ts +++ b/client/src/app/+my-account/my-account-history/my-account-history.component.ts | |||
@@ -13,7 +13,6 @@ import { | |||
13 | import { immutableAssign } from '@app/helpers' | 13 | import { immutableAssign } from '@app/helpers' |
14 | import { UserHistoryService } from '@app/shared/shared-main' | 14 | import { UserHistoryService } from '@app/shared/shared-main' |
15 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' | 15 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' |
16 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
17 | 16 | ||
18 | @Component({ | 17 | @Component({ |
19 | selector: 'my-account-history', | 18 | selector: 'my-account-history', |
@@ -30,7 +29,6 @@ export class MyAccountHistoryComponent extends AbstractVideoList implements OnIn | |||
30 | videosHistoryEnabled: boolean | 29 | videosHistoryEnabled: boolean |
31 | 30 | ||
32 | constructor ( | 31 | constructor ( |
33 | protected i18n: I18n, | ||
34 | protected router: Router, | 32 | protected router: Router, |
35 | protected serverService: ServerService, | 33 | protected serverService: ServerService, |
36 | protected route: ActivatedRoute, | 34 | protected route: ActivatedRoute, |
@@ -44,7 +42,7 @@ export class MyAccountHistoryComponent extends AbstractVideoList implements OnIn | |||
44 | ) { | 42 | ) { |
45 | super() | 43 | super() |
46 | 44 | ||
47 | this.titlePage = this.i18n('My videos history') | 45 | this.titlePage = $localize`My videos history` |
48 | } | 46 | } |
49 | 47 | ||
50 | ngOnInit () { | 48 | ngOnInit () { |
@@ -72,8 +70,8 @@ export class MyAccountHistoryComponent extends AbstractVideoList implements OnIn | |||
72 | .subscribe( | 70 | .subscribe( |
73 | () => { | 71 | () => { |
74 | const message = this.videosHistoryEnabled === true ? | 72 | const message = this.videosHistoryEnabled === true ? |
75 | this.i18n('Videos history is enabled') : | 73 | $localize`Videos history is enabled` : |
76 | this.i18n('Videos history is disabled') | 74 | $localize`Videos history is disabled` |
77 | 75 | ||
78 | this.notifier.success(message) | 76 | this.notifier.success(message) |
79 | 77 | ||
@@ -85,8 +83,8 @@ export class MyAccountHistoryComponent extends AbstractVideoList implements OnIn | |||
85 | } | 83 | } |
86 | 84 | ||
87 | async deleteHistory () { | 85 | async deleteHistory () { |
88 | const title = this.i18n('Delete videos history') | 86 | const title = $localize`Delete videos history` |
89 | const message = this.i18n('Are you sure you want to delete all your videos history?') | 87 | const message = $localize`Are you sure you want to delete all your videos history?` |
90 | 88 | ||
91 | const res = await this.confirmService.confirm(message, title) | 89 | const res = await this.confirmService.confirm(message, title) |
92 | if (res !== true) return | 90 | if (res !== true) return |
@@ -94,7 +92,7 @@ export class MyAccountHistoryComponent extends AbstractVideoList implements OnIn | |||
94 | this.userHistoryService.deleteUserVideosHistory() | 92 | this.userHistoryService.deleteUserVideosHistory() |
95 | .subscribe( | 93 | .subscribe( |
96 | () => { | 94 | () => { |
97 | this.notifier.success(this.i18n('Videos history deleted')) | 95 | this.notifier.success($localize`Videos history deleted`) |
98 | 96 | ||
99 | this.reloadVideos() | 97 | this.reloadVideos() |
100 | }, | 98 | }, |
diff --git a/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts b/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts index 0e62b5ca5..3bfffe2da 100644 --- a/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts +++ b/client/src/app/+my-account/my-account-ownership/my-account-accept-ownership/my-account-accept-ownership.component.ts | |||
@@ -3,7 +3,6 @@ import { AuthService, Notifier } from '@app/core' | |||
3 | import { FormReactive, FormValidatorService, VideoAcceptOwnershipValidatorsService } from '@app/shared/shared-forms' | 3 | import { FormReactive, FormValidatorService, VideoAcceptOwnershipValidatorsService } from '@app/shared/shared-forms' |
4 | import { VideoChannelService, VideoOwnershipService } from '@app/shared/shared-main' | 4 | import { VideoChannelService, VideoOwnershipService } from '@app/shared/shared-main' |
5 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 5 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
7 | import { VideoChangeOwnership, VideoChannel } from '@shared/models' | 6 | import { VideoChangeOwnership, VideoChannel } from '@shared/models' |
8 | 7 | ||
9 | @Component({ | 8 | @Component({ |
@@ -29,9 +28,8 @@ export class MyAccountAcceptOwnershipComponent extends FormReactive implements O | |||
29 | private notifier: Notifier, | 28 | private notifier: Notifier, |
30 | private authService: AuthService, | 29 | private authService: AuthService, |
31 | private videoChannelService: VideoChannelService, | 30 | private videoChannelService: VideoChannelService, |
32 | private modalService: NgbModal, | 31 | private modalService: NgbModal |
33 | private i18n: I18n | 32 | ) { |
34 | ) { | ||
35 | super() | 33 | super() |
36 | } | 34 | } |
37 | 35 | ||
@@ -63,7 +61,7 @@ export class MyAccountAcceptOwnershipComponent extends FormReactive implements O | |||
63 | .acceptOwnership(videoChangeOwnership.id, { channelId: channel }) | 61 | .acceptOwnership(videoChangeOwnership.id, { channelId: channel }) |
64 | .subscribe( | 62 | .subscribe( |
65 | () => { | 63 | () => { |
66 | this.notifier.success(this.i18n('Ownership accepted')) | 64 | this.notifier.success($localize`Ownership accepted`) |
67 | if (this.accepted) this.accepted.emit() | 65 | if (this.accepted) this.accepted.emit() |
68 | this.videoChangeOwnership = undefined | 66 | this.videoChangeOwnership = undefined |
69 | }, | 67 | }, |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts index 5444b97ae..396936ef3 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts | |||
@@ -3,7 +3,6 @@ import { tap } from 'rxjs/operators' | |||
3 | import { Component, OnInit } from '@angular/core' | 3 | import { Component, OnInit } from '@angular/core' |
4 | import { AuthService, ServerService, UserService } from '@app/core' | 4 | import { AuthService, ServerService, UserService } from '@app/core' |
5 | import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' | 5 | import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
7 | import { User } from '@shared/models' | 6 | import { User } from '@shared/models' |
8 | 7 | ||
9 | @Component({ | 8 | @Component({ |
@@ -21,9 +20,8 @@ export class MyAccountChangeEmailComponent extends FormReactive implements OnIni | |||
21 | private userValidatorsService: UserValidatorsService, | 20 | private userValidatorsService: UserValidatorsService, |
22 | private authService: AuthService, | 21 | private authService: AuthService, |
23 | private userService: UserService, | 22 | private userService: UserService, |
24 | private serverService: ServerService, | 23 | private serverService: ServerService |
25 | private i18n: I18n | 24 | ) { |
26 | ) { | ||
27 | super() | 25 | super() |
28 | } | 26 | } |
29 | 27 | ||
@@ -52,15 +50,15 @@ export class MyAccountChangeEmailComponent extends FormReactive implements OnIni | |||
52 | this.form.reset() | 50 | this.form.reset() |
53 | 51 | ||
54 | if (config.signup.requiresEmailVerification) { | 52 | if (config.signup.requiresEmailVerification) { |
55 | this.success = this.i18n('Please check your emails to verify your new email.') | 53 | this.success = $localize`Please check your emails to verify your new email.` |
56 | } else { | 54 | } else { |
57 | this.success = this.i18n('Email updated.') | 55 | this.success = $localize`Email updated.` |
58 | } | 56 | } |
59 | }, | 57 | }, |
60 | 58 | ||
61 | err => { | 59 | err => { |
62 | if (err.status === 401) { | 60 | if (err.status === 401) { |
63 | this.error = this.i18n('You current password is invalid.') | 61 | this.error = $localize`You current password is invalid.` |
64 | return | 62 | return |
65 | } | 63 | } |
66 | 64 | ||
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts index 6a16f8a2c..91fe4ec72 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts | |||
@@ -2,7 +2,6 @@ import { filter } from 'rxjs/operators' | |||
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { AuthService, Notifier, UserService } from '@app/core' | 3 | import { AuthService, Notifier, UserService } from '@app/core' |
4 | import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' | 4 | import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | import { User } from '@shared/models' | 5 | import { User } from '@shared/models' |
7 | 6 | ||
8 | @Component({ | 7 | @Component({ |
@@ -19,9 +18,8 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On | |||
19 | private userValidatorsService: UserValidatorsService, | 18 | private userValidatorsService: UserValidatorsService, |
20 | private notifier: Notifier, | 19 | private notifier: Notifier, |
21 | private authService: AuthService, | 20 | private authService: AuthService, |
22 | private userService: UserService, | 21 | private userService: UserService |
23 | private i18n: I18n | 22 | ) { |
24 | ) { | ||
25 | super() | 23 | super() |
26 | } | 24 | } |
27 | 25 | ||
@@ -47,7 +45,7 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On | |||
47 | 45 | ||
48 | this.userService.changePassword(currentPassword, newPassword).subscribe( | 46 | this.userService.changePassword(currentPassword, newPassword).subscribe( |
49 | () => { | 47 | () => { |
50 | this.notifier.success(this.i18n('Password updated.')) | 48 | this.notifier.success($localize`Password updated.`) |
51 | 49 | ||
52 | this.form.reset() | 50 | this.form.reset() |
53 | this.error = null | 51 | this.error = null |
@@ -55,7 +53,7 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On | |||
55 | 53 | ||
56 | err => { | 54 | err => { |
57 | if (err.status === 401) { | 55 | if (err.status === 401) { |
58 | this.error = this.i18n('You current password is invalid.') | 56 | this.error = $localize`You current password is invalid.` |
59 | return | 57 | return |
60 | } | 58 | } |
61 | 59 | ||
diff --git a/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts b/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts index ae6ac5387..387e9e7cd 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-danger-zone/my-account-danger-zone.component.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input } from '@angular/core' |
2 | import { AuthService, ConfirmService, Notifier, RedirectService, User, UserService } from '@app/core' | 2 | import { AuthService, ConfirmService, Notifier, RedirectService, User, UserService } from '@app/core' |
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
4 | 3 | ||
5 | @Component({ | 4 | @Component({ |
6 | selector: 'my-account-danger-zone', | 5 | selector: 'my-account-danger-zone', |
@@ -15,23 +14,22 @@ export class MyAccountDangerZoneComponent { | |||
15 | private notifier: Notifier, | 14 | private notifier: Notifier, |
16 | private userService: UserService, | 15 | private userService: UserService, |
17 | private confirmService: ConfirmService, | 16 | private confirmService: ConfirmService, |
18 | private redirectService: RedirectService, | 17 | private redirectService: RedirectService |
19 | private i18n: I18n | 18 | ) { } |
20 | ) { } | ||
21 | 19 | ||
22 | async deleteMe () { | 20 | async deleteMe () { |
23 | const res = await this.confirmService.confirmWithInput( | 21 | const res = await this.confirmService.confirmWithInput( |
24 | this.i18n('Are you sure you want to delete your account? This will delete all your data, including channels, videos and comments. Content cached by other servers and other third-parties might make longer to be deleted.'), | 22 | $localize`Are you sure you want to delete your account? This will delete all your data, including channels, videos and comments. Content cached by other servers and other third-parties might make longer to be deleted.`, |
25 | this.i18n('Type your username to confirm'), | 23 | $localize`Type your username to confirm`, |
26 | this.user.username, | 24 | this.user.username, |
27 | this.i18n('Delete your account'), | 25 | $localize`Delete your account`, |
28 | this.i18n('Delete my account') | 26 | $localize`Delete my account` |
29 | ) | 27 | ) |
30 | if (res === false) return | 28 | if (res === false) return |
31 | 29 | ||
32 | this.userService.deleteMe().subscribe( | 30 | this.userService.deleteMe().subscribe( |
33 | () => { | 31 | () => { |
34 | this.notifier.success(this.i18n('Your account is deleted.')) | 32 | this.notifier.success($localize`Your account is deleted.`) |
35 | 33 | ||
36 | this.authService.logout() | 34 | this.authService.logout() |
37 | this.redirectService.redirectToHomepage() | 35 | this.redirectService.redirectToHomepage() |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts index b892ab479..bcbea7fad 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts | |||
@@ -3,7 +3,6 @@ import { Subject } from 'rxjs' | |||
3 | import { Component, Input, OnInit } from '@angular/core' | 3 | import { Component, Input, OnInit } from '@angular/core' |
4 | import { Notifier, ServerService, User } from '@app/core' | 4 | import { Notifier, ServerService, User } from '@app/core' |
5 | import { UserNotificationService } from '@app/shared/shared-main' | 5 | import { UserNotificationService } from '@app/shared/shared-main' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
7 | import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from '@shared/models' | 6 | import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from '@shared/models' |
8 | 7 | ||
9 | @Component({ | 8 | @Component({ |
@@ -25,26 +24,25 @@ export class MyAccountNotificationPreferencesComponent implements OnInit { | |||
25 | private savePreferences = debounce(this.savePreferencesImpl.bind(this), 500) | 24 | private savePreferences = debounce(this.savePreferencesImpl.bind(this), 500) |
26 | 25 | ||
27 | constructor ( | 26 | constructor ( |
28 | private i18n: I18n, | ||
29 | private userNotificationService: UserNotificationService, | 27 | private userNotificationService: UserNotificationService, |
30 | private serverService: ServerService, | 28 | private serverService: ServerService, |
31 | private notifier: Notifier | 29 | private notifier: Notifier |
32 | ) { | 30 | ) { |
33 | this.labelNotifications = { | 31 | this.labelNotifications = { |
34 | newVideoFromSubscription: this.i18n('New video from your subscriptions'), | 32 | newVideoFromSubscription: $localize`New video from your subscriptions`, |
35 | newCommentOnMyVideo: this.i18n('New comment on your video'), | 33 | newCommentOnMyVideo: $localize`New comment on your video`, |
36 | abuseAsModerator: this.i18n('New abuse'), | 34 | abuseAsModerator: $localize`New abuse`, |
37 | videoAutoBlacklistAsModerator: this.i18n('Video blocked automatically waiting review'), | 35 | videoAutoBlacklistAsModerator: $localize`Video blocked automatically waiting review`, |
38 | blacklistOnMyVideo: this.i18n('One of your video is blocked/unblocked'), | 36 | blacklistOnMyVideo: $localize`One of your video is blocked/unblocked`, |
39 | myVideoPublished: this.i18n('Video published (after transcoding/scheduled update)'), | 37 | myVideoPublished: $localize`Video published (after transcoding/scheduled update)`, |
40 | myVideoImportFinished: this.i18n('Video import finished'), | 38 | myVideoImportFinished: $localize`Video import finished`, |
41 | newUserRegistration: this.i18n('A new user registered on your instance'), | 39 | newUserRegistration: $localize`A new user registered on your instance`, |
42 | newFollow: this.i18n('You or your channel(s) has a new follower'), | 40 | newFollow: $localize`You or your channel(s) has a new follower`, |
43 | commentMention: this.i18n('Someone mentioned you in video comments'), | 41 | commentMention: $localize`Someone mentioned you in video comments`, |
44 | newInstanceFollower: this.i18n('Your instance has a new follower'), | 42 | newInstanceFollower: $localize`Your instance has a new follower`, |
45 | autoInstanceFollowing: this.i18n('Your instance automatically followed another instance'), | 43 | autoInstanceFollowing: $localize`Your instance automatically followed another instance`, |
46 | abuseNewMessage: this.i18n('An abuse report received a new message'), | 44 | abuseNewMessage: $localize`An abuse report received a new message`, |
47 | abuseStateChange: this.i18n('One of your abuse reports has been accepted or rejected by moderators') | 45 | abuseStateChange: $localize`One of your abuse reports has been accepted or rejected by moderators` |
48 | } | 46 | } |
49 | this.notificationSettingKeys = Object.keys(this.labelNotifications) as (keyof UserNotificationSetting)[] | 47 | this.notificationSettingKeys = Object.keys(this.labelNotifications) as (keyof UserNotificationSetting)[] |
50 | 48 | ||
@@ -91,7 +89,7 @@ export class MyAccountNotificationPreferencesComponent implements OnInit { | |||
91 | this.userNotificationService.updateNotificationSettings(this.user, this.user.notificationSettings) | 89 | this.userNotificationService.updateNotificationSettings(this.user, this.user.notificationSettings) |
92 | .subscribe( | 90 | .subscribe( |
93 | () => { | 91 | () => { |
94 | this.notifier.success(this.i18n('Preferences saved'), undefined, 2000) | 92 | this.notifier.success($localize`Preferences saved`, undefined, 2000) |
95 | }, | 93 | }, |
96 | 94 | ||
97 | err => this.notifier.error(err.message) | 95 | err => this.notifier.error(err.message) |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts index b0d8494e7..ed0984bf7 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts | |||
@@ -2,7 +2,6 @@ import { Subject } from 'rxjs' | |||
2 | import { Component, Input, OnInit } from '@angular/core' | 2 | import { Component, Input, OnInit } from '@angular/core' |
3 | import { Notifier, User, UserService } from '@app/core' | 3 | import { Notifier, User, UserService } from '@app/core' |
4 | import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' | 4 | import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | 5 | ||
7 | @Component({ | 6 | @Component({ |
8 | selector: 'my-account-profile', | 7 | selector: 'my-account-profile', |
@@ -19,9 +18,8 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit { | |||
19 | protected formValidatorService: FormValidatorService, | 18 | protected formValidatorService: FormValidatorService, |
20 | private userValidatorsService: UserValidatorsService, | 19 | private userValidatorsService: UserValidatorsService, |
21 | private notifier: Notifier, | 20 | private notifier: Notifier, |
22 | private userService: UserService, | 21 | private userService: UserService |
23 | private i18n: I18n | 22 | ) { |
24 | ) { | ||
25 | super() | 23 | super() |
26 | } | 24 | } |
27 | 25 | ||
@@ -50,7 +48,7 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit { | |||
50 | this.user.account.displayName = displayName | 48 | this.user.account.displayName = displayName |
51 | this.user.account.description = description | 49 | this.user.account.description = description |
52 | 50 | ||
53 | this.notifier.success(this.i18n('Profile updated.')) | 51 | this.notifier.success($localize`Profile updated.`) |
54 | }, | 52 | }, |
55 | 53 | ||
56 | err => this.error = err.message | 54 | err => this.error = err.message |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts index a3a8ff1f1..7ea4610d4 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import { ViewportScroller } from '@angular/common' | 1 | import { ViewportScroller } from '@angular/common' |
2 | import { AfterViewChecked, Component, OnInit } from '@angular/core' | 2 | import { AfterViewChecked, Component, OnInit } from '@angular/core' |
3 | import { AuthService, Notifier, User, UserService } from '@app/core' | 3 | import { AuthService, Notifier, User, UserService } from '@app/core' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
5 | 4 | ||
6 | @Component({ | 5 | @Component({ |
7 | selector: 'my-account-settings', | 6 | selector: 'my-account-settings', |
@@ -17,9 +16,8 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked { | |||
17 | private viewportScroller: ViewportScroller, | 16 | private viewportScroller: ViewportScroller, |
18 | private userService: UserService, | 17 | private userService: UserService, |
19 | private authService: AuthService, | 18 | private authService: AuthService, |
20 | private notifier: Notifier, | 19 | private notifier: Notifier |
21 | private i18n: I18n | 20 | ) {} |
22 | ) {} | ||
23 | 21 | ||
24 | get userInformationLoaded () { | 22 | get userInformationLoaded () { |
25 | return this.authService.userInformationLoaded | 23 | return this.authService.userInformationLoaded |
@@ -41,7 +39,7 @@ export class MyAccountSettingsComponent implements OnInit, AfterViewChecked { | |||
41 | this.userService.changeAvatar(formData) | 39 | this.userService.changeAvatar(formData) |
42 | .subscribe( | 40 | .subscribe( |
43 | data => { | 41 | data => { |
44 | this.notifier.success(this.i18n('Avatar changed.')) | 42 | this.notifier.success($localize`Avatar changed.`) |
45 | 43 | ||
46 | this.user.updateAccountAvatar(data.avatar) | 44 | this.user.updateAccountAvatar(data.avatar) |
47 | }, | 45 | }, |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts index e72ae2366..5427dc3a0 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-create.component.ts | |||
@@ -1,13 +1,12 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { AuthService, Notifier, ServerService } from '@app/core' | 3 | import { AuthService, Notifier, ServerService } from '@app/core' |
4 | import { populateAsyncUserVideoChannels } from '@app/helpers' | ||
4 | import { FormValidatorService, VideoPlaylistValidatorsService } from '@app/shared/shared-forms' | 5 | import { FormValidatorService, VideoPlaylistValidatorsService } from '@app/shared/shared-forms' |
5 | import { VideoPlaylistService } from '@app/shared/shared-video-playlist' | 6 | import { VideoPlaylistService } from '@app/shared/shared-video-playlist' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
7 | import { VideoPlaylistCreate } from '@shared/models/videos/playlist/video-playlist-create.model' | 7 | import { VideoPlaylistCreate } from '@shared/models/videos/playlist/video-playlist-create.model' |
8 | import { VideoPlaylistPrivacy } from '@shared/models/videos/playlist/video-playlist-privacy.model' | 8 | import { VideoPlaylistPrivacy } from '@shared/models/videos/playlist/video-playlist-privacy.model' |
9 | import { MyAccountVideoPlaylistEdit } from './my-account-video-playlist-edit' | 9 | import { MyAccountVideoPlaylistEdit } from './my-account-video-playlist-edit' |
10 | import { populateAsyncUserVideoChannels } from '@app/helpers' | ||
11 | 10 | ||
12 | @Component({ | 11 | @Component({ |
13 | selector: 'my-account-video-playlist-create', | 12 | selector: 'my-account-video-playlist-create', |
@@ -24,9 +23,8 @@ export class MyAccountVideoPlaylistCreateComponent extends MyAccountVideoPlaylis | |||
24 | private notifier: Notifier, | 23 | private notifier: Notifier, |
25 | private router: Router, | 24 | private router: Router, |
26 | private videoPlaylistService: VideoPlaylistService, | 25 | private videoPlaylistService: VideoPlaylistService, |
27 | private serverService: ServerService, | 26 | private serverService: ServerService |
28 | private i18n: I18n | 27 | ) { |
29 | ) { | ||
30 | super() | 28 | super() |
31 | } | 29 | } |
32 | 30 | ||
@@ -70,9 +68,7 @@ export class MyAccountVideoPlaylistCreateComponent extends MyAccountVideoPlaylis | |||
70 | 68 | ||
71 | this.videoPlaylistService.createVideoPlaylist(videoPlaylistCreate).subscribe( | 69 | this.videoPlaylistService.createVideoPlaylist(videoPlaylistCreate).subscribe( |
72 | () => { | 70 | () => { |
73 | this.notifier.success( | 71 | this.notifier.success($localize`Playlist ${videoPlaylistCreate.displayName} created.`) |
74 | this.i18n('Playlist {{playlistName}} created.', { playlistName: videoPlaylistCreate.displayName }) | ||
75 | ) | ||
76 | this.router.navigate([ '/my-account', 'video-playlists' ]) | 72 | this.router.navigate([ '/my-account', 'video-playlists' ]) |
77 | }, | 73 | }, |
78 | 74 | ||
@@ -85,6 +81,6 @@ export class MyAccountVideoPlaylistCreateComponent extends MyAccountVideoPlaylis | |||
85 | } | 81 | } |
86 | 82 | ||
87 | getFormButtonTitle () { | 83 | getFormButtonTitle () { |
88 | return this.i18n('Create') | 84 | return $localize`Create` |
89 | } | 85 | } |
90 | } | 86 | } |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts index e278d9ed2..f6cdf1067 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-elements.component.ts | |||
@@ -6,7 +6,6 @@ import { ComponentPagination, ConfirmService, Notifier, ScreenService } from '@a | |||
6 | import { DropdownAction } from '@app/shared/shared-main' | 6 | import { DropdownAction } from '@app/shared/shared-main' |
7 | import { VideoShareComponent } from '@app/shared/shared-share-modal' | 7 | import { VideoShareComponent } from '@app/shared/shared-share-modal' |
8 | import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist' | 8 | import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist' |
9 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
10 | import { VideoPlaylistType } from '@shared/models' | 9 | import { VideoPlaylistType } from '@shared/models' |
11 | 10 | ||
12 | @Component({ | 11 | @Component({ |
@@ -35,7 +34,6 @@ export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestro | |||
35 | 34 | ||
36 | constructor ( | 35 | constructor ( |
37 | private notifier: Notifier, | 36 | private notifier: Notifier, |
38 | private i18n: I18n, | ||
39 | private router: Router, | 37 | private router: Router, |
40 | private confirmService: ConfirmService, | 38 | private confirmService: ConfirmService, |
41 | private route: ActivatedRoute, | 39 | private route: ActivatedRoute, |
@@ -47,12 +45,12 @@ export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestro | |||
47 | this.playlistActions = [ | 45 | this.playlistActions = [ |
48 | [ | 46 | [ |
49 | { | 47 | { |
50 | label: this.i18n('Update playlist'), | 48 | label: $localize`Update playlist`, |
51 | iconName: 'edit', | 49 | iconName: 'edit', |
52 | linkBuilder: playlist => [ '/my-account', 'video-playlists', 'update', playlist.uuid ] | 50 | linkBuilder: playlist => [ '/my-account', 'video-playlists', 'update', playlist.uuid ] |
53 | }, | 51 | }, |
54 | { | 52 | { |
55 | label: this.i18n('Delete playlist'), | 53 | label: $localize`Delete playlist`, |
56 | iconName: 'delete', | 54 | iconName: 'delete', |
57 | handler: playlist => this.deleteVideoPlaylist(playlist) | 55 | handler: playlist => this.deleteVideoPlaylist(playlist) |
58 | } | 56 | } |
@@ -126,11 +124,8 @@ export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestro | |||
126 | 124 | ||
127 | async deleteVideoPlaylist (videoPlaylist: VideoPlaylist) { | 125 | async deleteVideoPlaylist (videoPlaylist: VideoPlaylist) { |
128 | const res = await this.confirmService.confirm( | 126 | const res = await this.confirmService.confirm( |
129 | this.i18n( | 127 | $localize`Do you really want to delete ${videoPlaylist.displayName}?`, |
130 | 'Do you really want to delete {{playlistDisplayName}}?', | 128 | $localize`Delete` |
131 | { playlistDisplayName: videoPlaylist.displayName } | ||
132 | ), | ||
133 | this.i18n('Delete') | ||
134 | ) | 129 | ) |
135 | if (res === false) return | 130 | if (res === false) return |
136 | 131 | ||
@@ -138,10 +133,7 @@ export class MyAccountVideoPlaylistElementsComponent implements OnInit, OnDestro | |||
138 | .subscribe( | 133 | .subscribe( |
139 | () => { | 134 | () => { |
140 | this.router.navigate([ '/my-account', 'video-playlists' ]) | 135 | this.router.navigate([ '/my-account', 'video-playlists' ]) |
141 | 136 | this.notifier.success($localize`Playlist ${videoPlaylist.displayName} deleted.`) | |
142 | this.notifier.success( | ||
143 | this.i18n('Playlist {{playlistDisplayName}} deleted.', { playlistDisplayName: videoPlaylist.displayName }) | ||
144 | ) | ||
145 | }, | 137 | }, |
146 | 138 | ||
147 | error => this.notifier.error(error.message) | 139 | error => this.notifier.error(error.message) |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts index 6787fb757..149d0d94f 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlist-update.component.ts | |||
@@ -6,7 +6,6 @@ import { AuthService, Notifier, ServerService } from '@app/core' | |||
6 | import { populateAsyncUserVideoChannels } from '@app/helpers' | 6 | import { populateAsyncUserVideoChannels } from '@app/helpers' |
7 | import { FormValidatorService, VideoPlaylistValidatorsService } from '@app/shared/shared-forms' | 7 | import { FormValidatorService, VideoPlaylistValidatorsService } from '@app/shared/shared-forms' |
8 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' | 8 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' |
9 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
10 | import { VideoPlaylistUpdate } from '@shared/models' | 9 | import { VideoPlaylistUpdate } from '@shared/models' |
11 | import { MyAccountVideoPlaylistEdit } from './my-account-video-playlist-edit' | 10 | import { MyAccountVideoPlaylistEdit } from './my-account-video-playlist-edit' |
12 | 11 | ||
@@ -29,7 +28,6 @@ export class MyAccountVideoPlaylistUpdateComponent extends MyAccountVideoPlaylis | |||
29 | private router: Router, | 28 | private router: Router, |
30 | private route: ActivatedRoute, | 29 | private route: ActivatedRoute, |
31 | private videoPlaylistService: VideoPlaylistService, | 30 | private videoPlaylistService: VideoPlaylistService, |
32 | private i18n: I18n, | ||
33 | private serverService: ServerService | 31 | private serverService: ServerService |
34 | ) { | 32 | ) { |
35 | super() | 33 | super() |
@@ -91,10 +89,7 @@ export class MyAccountVideoPlaylistUpdateComponent extends MyAccountVideoPlaylis | |||
91 | 89 | ||
92 | this.videoPlaylistService.updateVideoPlaylist(this.videoPlaylistToUpdate, videoPlaylistUpdate).subscribe( | 90 | this.videoPlaylistService.updateVideoPlaylist(this.videoPlaylistToUpdate, videoPlaylistUpdate).subscribe( |
93 | () => { | 91 | () => { |
94 | this.notifier.success( | 92 | this.notifier.success($localize`Playlist ${videoPlaylistUpdate.displayName} updated.`) |
95 | this.i18n('Playlist {{videoPlaylistName}} updated.', { videoPlaylistName: videoPlaylistUpdate.displayName }) | ||
96 | ) | ||
97 | |||
98 | this.router.navigate([ '/my-account', 'video-playlists' ]) | 93 | this.router.navigate([ '/my-account', 'video-playlists' ]) |
99 | }, | 94 | }, |
100 | 95 | ||
@@ -107,7 +102,7 @@ export class MyAccountVideoPlaylistUpdateComponent extends MyAccountVideoPlaylis | |||
107 | } | 102 | } |
108 | 103 | ||
109 | getFormButtonTitle () { | 104 | getFormButtonTitle () { |
110 | return this.i18n('Update') | 105 | return $localize`Update` |
111 | } | 106 | } |
112 | 107 | ||
113 | private hydrateFormFromPlaylist () { | 108 | private hydrateFormFromPlaylist () { |
diff --git a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts index ba95b6c8b..1e569c0b6 100644 --- a/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts +++ b/client/src/app/+my-account/my-account-video-playlists/my-account-video-playlists.component.ts | |||
@@ -3,7 +3,6 @@ import { debounceTime, mergeMap } from 'rxjs/operators' | |||
3 | import { Component, OnInit } from '@angular/core' | 3 | import { Component, OnInit } from '@angular/core' |
4 | import { AuthService, ComponentPagination, ConfirmService, Notifier, User } from '@app/core' | 4 | import { AuthService, ComponentPagination, ConfirmService, Notifier, User } from '@app/core' |
5 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' | 5 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
7 | import { VideoPlaylistType } from '@shared/models' | 6 | import { VideoPlaylistType } from '@shared/models' |
8 | 7 | ||
9 | @Component({ | 8 | @Component({ |
@@ -30,9 +29,8 @@ export class MyAccountVideoPlaylistsComponent implements OnInit { | |||
30 | private authService: AuthService, | 29 | private authService: AuthService, |
31 | private notifier: Notifier, | 30 | private notifier: Notifier, |
32 | private confirmService: ConfirmService, | 31 | private confirmService: ConfirmService, |
33 | private videoPlaylistService: VideoPlaylistService, | 32 | private videoPlaylistService: VideoPlaylistService |
34 | private i18n: I18n | 33 | ) {} |
35 | ) {} | ||
36 | 34 | ||
37 | ngOnInit () { | 35 | ngOnInit () { |
38 | this.user = this.authService.getUser() | 36 | this.user = this.authService.getUser() |
@@ -49,11 +47,8 @@ export class MyAccountVideoPlaylistsComponent implements OnInit { | |||
49 | 47 | ||
50 | async deleteVideoPlaylist (videoPlaylist: VideoPlaylist) { | 48 | async deleteVideoPlaylist (videoPlaylist: VideoPlaylist) { |
51 | const res = await this.confirmService.confirm( | 49 | const res = await this.confirmService.confirm( |
52 | this.i18n( | 50 | $localize`Do you really want to delete ${videoPlaylist.displayName}?`, |
53 | 'Do you really want to delete {{playlistDisplayName}}?', | 51 | $localize`Delete` |
54 | { playlistDisplayName: videoPlaylist.displayName } | ||
55 | ), | ||
56 | this.i18n('Delete') | ||
57 | ) | 52 | ) |
58 | if (res === false) return | 53 | if (res === false) return |
59 | 54 | ||
@@ -63,9 +58,7 @@ export class MyAccountVideoPlaylistsComponent implements OnInit { | |||
63 | this.videoPlaylists = this.videoPlaylists | 58 | this.videoPlaylists = this.videoPlaylists |
64 | .filter(p => p.id !== videoPlaylist.id) | 59 | .filter(p => p.id !== videoPlaylist.id) |
65 | 60 | ||
66 | this.notifier.success( | 61 | this.notifier.success($localize`Playlist ${videoPlaylist.displayName}} deleted.`) |
67 | this.i18n('Playlist {{playlistDisplayName}} deleted.', { playlistDisplayName: videoPlaylist.displayName }) | ||
68 | ) | ||
69 | }, | 62 | }, |
70 | 63 | ||
71 | error => this.notifier.error(error.message) | 64 | error => this.notifier.error(error.message) |
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' | |||
7 | import { immutableAssign } from '@app/helpers' | 7 | import { immutableAssign } from '@app/helpers' |
8 | import { Video, VideoService } from '@app/shared/shared-main' | 8 | import { Video, VideoService } from '@app/shared/shared-main' |
9 | import { MiniatureDisplayOptions, OwnerDisplayType, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature' | 9 | import { MiniatureDisplayOptions, OwnerDisplayType, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature' |
10 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
11 | import { VideoSortField } from '@shared/models' | 10 | import { VideoSortField } from '@shared/models' |
12 | import { VideoChangeOwnershipComponent } from './video-change-ownership/video-change-ownership.component' | 11 | import { 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 | ||
diff --git a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts b/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts index 18e716a09..edd691694 100644 --- a/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts +++ b/client/src/app/+my-account/my-account-videos/video-change-ownership/video-change-ownership.component.ts | |||
@@ -3,7 +3,6 @@ import { Notifier, UserService } from '@app/core' | |||
3 | import { FormReactive, FormValidatorService, VideoChangeOwnershipValidatorsService } from '@app/shared/shared-forms' | 3 | import { FormReactive, FormValidatorService, VideoChangeOwnershipValidatorsService } from '@app/shared/shared-forms' |
4 | import { Video, VideoOwnershipService } from '@app/shared/shared-main' | 4 | import { Video, VideoOwnershipService } from '@app/shared/shared-main' |
5 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 5 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
7 | 6 | ||
8 | @Component({ | 7 | @Component({ |
9 | selector: 'my-video-change-ownership', | 8 | selector: 'my-video-change-ownership', |
@@ -25,9 +24,8 @@ export class VideoChangeOwnershipComponent extends FormReactive implements OnIni | |||
25 | private videoOwnershipService: VideoOwnershipService, | 24 | private videoOwnershipService: VideoOwnershipService, |
26 | private notifier: Notifier, | 25 | private notifier: Notifier, |
27 | private userService: UserService, | 26 | private userService: UserService, |
28 | private modalService: NgbModal, | 27 | private modalService: NgbModal |
29 | private i18n: I18n | 28 | ) { |
30 | ) { | ||
31 | super() | 29 | super() |
32 | } | 30 | } |
33 | 31 | ||
@@ -63,7 +61,7 @@ export class VideoChangeOwnershipComponent extends FormReactive implements OnIni | |||
63 | this.videoOwnershipService | 61 | this.videoOwnershipService |
64 | .changeOwnership(this.video.id, username) | 62 | .changeOwnership(this.video.id, username) |
65 | .subscribe( | 63 | .subscribe( |
66 | () => this.notifier.success(this.i18n('Ownership change request sent.')), | 64 | () => this.notifier.success($localize`Ownership change request sent.`), |
67 | 65 | ||
68 | err => this.notifier.error(err.message) | 66 | err => this.notifier.error(err.message) |
69 | ) | 67 | ) |
diff --git a/client/src/app/+my-account/my-account.component.ts b/client/src/app/+my-account/my-account.component.ts index 56373e5f1..d3bf8d143 100644 --- a/client/src/app/+my-account/my-account.component.ts +++ b/client/src/app/+my-account/my-account.component.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { AuthService, ScreenService, ServerService, AuthUser } from '@app/core' | 2 | import { AuthService, AuthUser, ScreenService, ServerService } from '@app/core' |
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
4 | import { ServerConfig } from '@shared/models' | 3 | import { ServerConfig } from '@shared/models' |
5 | import { TopMenuDropdownParam } from '../shared/shared-main/misc/top-menu-dropdown.component' | 4 | import { TopMenuDropdownParam } from '../shared/shared-main/misc/top-menu-dropdown.component' |
6 | 5 | ||
@@ -18,9 +17,8 @@ export class MyAccountComponent implements OnInit { | |||
18 | constructor ( | 17 | constructor ( |
19 | private serverService: ServerService, | 18 | private serverService: ServerService, |
20 | private authService: AuthService, | 19 | private authService: AuthService, |
21 | private screenService: ScreenService, | 20 | private screenService: ScreenService |
22 | private i18n: I18n | 21 | ) { } |
23 | ) { } | ||
24 | 22 | ||
25 | get isBroadcastMessageDisplayed () { | 23 | get isBroadcastMessageDisplayed () { |
26 | return this.screenService.isBroadcastMessageDisplayed | 24 | return this.screenService.isBroadcastMessageDisplayed |
@@ -46,31 +44,31 @@ export class MyAccountComponent implements OnInit { | |||
46 | 44 | ||
47 | private buildMenu () { | 45 | private buildMenu () { |
48 | const libraryEntries: TopMenuDropdownParam = { | 46 | const libraryEntries: TopMenuDropdownParam = { |
49 | label: this.i18n('My library'), | 47 | label: $localize`My library`, |
50 | children: [ | 48 | children: [ |
51 | { | 49 | { |
52 | label: this.i18n('My channels'), | 50 | label: $localize`My channels`, |
53 | routerLink: '/my-account/video-channels', | 51 | routerLink: '/my-account/video-channels', |
54 | iconName: 'channel' | 52 | iconName: 'channel' |
55 | }, | 53 | }, |
56 | { | 54 | { |
57 | label: this.i18n('My videos'), | 55 | label: $localize`My videos`, |
58 | routerLink: '/my-account/videos', | 56 | routerLink: '/my-account/videos', |
59 | iconName: 'videos', | 57 | iconName: 'videos', |
60 | isDisplayed: () => this.user.canSeeVideosLink | 58 | isDisplayed: () => this.user.canSeeVideosLink |
61 | }, | 59 | }, |
62 | { | 60 | { |
63 | label: this.i18n('My playlists'), | 61 | label: $localize`My playlists`, |
64 | routerLink: '/my-account/video-playlists', | 62 | routerLink: '/my-account/video-playlists', |
65 | iconName: 'playlists' | 63 | iconName: 'playlists' |
66 | }, | 64 | }, |
67 | { | 65 | { |
68 | label: this.i18n('My subscriptions'), | 66 | label: $localize`My subscriptions`, |
69 | routerLink: '/my-account/subscriptions', | 67 | routerLink: '/my-account/subscriptions', |
70 | iconName: 'subscriptions' | 68 | iconName: 'subscriptions' |
71 | }, | 69 | }, |
72 | { | 70 | { |
73 | label: this.i18n('My history'), | 71 | label: $localize`My history`, |
74 | routerLink: '/my-account/history/videos', | 72 | routerLink: '/my-account/history/videos', |
75 | iconName: 'history' | 73 | iconName: 'history' |
76 | } | 74 | } |
@@ -87,25 +85,25 @@ export class MyAccountComponent implements OnInit { | |||
87 | } | 85 | } |
88 | 86 | ||
89 | const miscEntries: TopMenuDropdownParam = { | 87 | const miscEntries: TopMenuDropdownParam = { |
90 | label: this.i18n('Misc'), | 88 | label: $localize`Misc`, |
91 | children: [ | 89 | children: [ |
92 | { | 90 | { |
93 | label: this.i18n('Muted accounts'), | 91 | label: $localize`Muted accounts`, |
94 | routerLink: '/my-account/blocklist/accounts', | 92 | routerLink: '/my-account/blocklist/accounts', |
95 | iconName: 'user-x' | 93 | iconName: 'user-x' |
96 | }, | 94 | }, |
97 | { | 95 | { |
98 | label: this.i18n('Muted servers'), | 96 | label: $localize`Muted servers`, |
99 | routerLink: '/my-account/blocklist/servers', | 97 | routerLink: '/my-account/blocklist/servers', |
100 | iconName: 'peertube-x' | 98 | iconName: 'peertube-x' |
101 | }, | 99 | }, |
102 | { | 100 | { |
103 | label: this.i18n('My abuse reports'), | 101 | label: $localize`My abuse reports`, |
104 | routerLink: '/my-account/abuses', | 102 | routerLink: '/my-account/abuses', |
105 | iconName: 'flag' | 103 | iconName: 'flag' |
106 | }, | 104 | }, |
107 | { | 105 | { |
108 | label: this.i18n('Ownership changes'), | 106 | label: $localize`Ownership changes`, |
109 | routerLink: '/my-account/ownership', | 107 | routerLink: '/my-account/ownership', |
110 | iconName: 'download' | 108 | iconName: 'download' |
111 | } | 109 | } |
@@ -114,11 +112,11 @@ export class MyAccountComponent implements OnInit { | |||
114 | 112 | ||
115 | this.menuEntries = [ | 113 | this.menuEntries = [ |
116 | { | 114 | { |
117 | label: this.i18n('My settings'), | 115 | label: $localize`My settings`, |
118 | routerLink: '/my-account/settings' | 116 | routerLink: '/my-account/settings' |
119 | }, | 117 | }, |
120 | { | 118 | { |
121 | label: this.i18n('My notifications'), | 119 | label: $localize`My notifications`, |
122 | routerLink: '/my-account/notifications' | 120 | routerLink: '/my-account/notifications' |
123 | }, | 121 | }, |
124 | libraryEntries, | 122 | libraryEntries, |