aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+my-account/my-account-settings/my-account-notification-preferences
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-settings/my-account-notification-preferences
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-settings/my-account-notification-preferences')
-rw-r--r--client/src/app/+my-account/my-account-settings/my-account-notification-preferences/my-account-notification-preferences.component.ts32
1 files changed, 15 insertions, 17 deletions
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'
3import { Component, Input, OnInit } from '@angular/core' 3import { Component, Input, OnInit } from '@angular/core'
4import { Notifier, ServerService, User } from '@app/core' 4import { Notifier, ServerService, User } from '@app/core'
5import { UserNotificationService } from '@app/shared/shared-main' 5import { UserNotificationService } from '@app/shared/shared-main'
6import { I18n } from '@ngx-translate/i18n-polyfill'
7import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from '@shared/models' 6import { 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)