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/shared/shared-user-subscription | |
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/shared/shared-user-subscription')
-rw-r--r-- | client/src/app/shared/shared-user-subscription/subscribe-button.component.ts | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts index 72fa3f4fd..b918fda06 100644 --- a/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts +++ b/client/src/app/shared/shared-user-subscription/subscribe-button.component.ts | |||
@@ -3,7 +3,6 @@ import { Component, Input, OnChanges, OnInit } from '@angular/core' | |||
3 | import { Router } from '@angular/router' | 3 | import { Router } from '@angular/router' |
4 | import { AuthService, Notifier } from '@app/core' | 4 | import { AuthService, Notifier } from '@app/core' |
5 | import { Account, VideoChannel, VideoService } from '@app/shared/shared-main' | 5 | import { Account, VideoChannel, VideoService } from '@app/shared/shared-main' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
7 | import { FeedFormat } from '@shared/models' | 6 | import { FeedFormat } from '@shared/models' |
8 | import { UserSubscriptionService } from './user-subscription.service' | 7 | import { UserSubscriptionService } from './user-subscription.service' |
9 | 8 | ||
@@ -31,7 +30,6 @@ export class SubscribeButtonComponent implements OnInit, OnChanges { | |||
31 | private router: Router, | 30 | private router: Router, |
32 | private notifier: Notifier, | 31 | private notifier: Notifier, |
33 | private userSubscriptionService: UserSubscriptionService, | 32 | private userSubscriptionService: UserSubscriptionService, |
34 | private i18n: I18n, | ||
35 | private videoService: VideoService | 33 | private videoService: VideoService |
36 | ) { } | 34 | ) { } |
37 | 35 | ||
@@ -108,20 +106,14 @@ export class SubscribeButtonComponent implements OnInit, OnChanges { | |||
108 | () => { | 106 | () => { |
109 | this.notifier.success( | 107 | this.notifier.success( |
110 | this.account | 108 | this.account |
111 | ? this.i18n( | 109 | ? $localize`Subscribed to all current channels of ${this.account.displayName}. You will be notified of all their new videos.` |
112 | 'Subscribed to all current channels of {{nameWithHost}}. You will be notified of all their new videos.', | 110 | : $localize`Subscribed to ${this.videoChannels[0].displayName}. You will be notified of all their new videos.`, |
113 | { nameWithHost: this.account.displayName } | 111 | |
114 | ) | 112 | $localize`Subscribed` |
115 | : this.i18n( | ||
116 | 'Subscribed to {{nameWithHost}}. You will be notified of all their new videos.', | ||
117 | { nameWithHost: this.videoChannels[0].displayName } | ||
118 | ) | ||
119 | , | ||
120 | this.i18n('Subscribed') | ||
121 | ) | 113 | ) |
122 | }, | 114 | }, |
123 | 115 | ||
124 | err => this.notifier.error(err.message) | 116 | err => this.notifier.error(err.message) |
125 | ) | 117 | ) |
126 | } | 118 | } |
127 | 119 | ||
@@ -144,10 +136,10 @@ export class SubscribeButtonComponent implements OnInit, OnChanges { | |||
144 | complete: () => { | 136 | complete: () => { |
145 | this.notifier.success( | 137 | this.notifier.success( |
146 | this.account | 138 | this.account |
147 | ? this.i18n('Unsubscribed from all channels of {{nameWithHost}}', { nameWithHost: this.account.nameWithHost }) | 139 | ? $localize`Unsubscribed from all channels of ${this.account.nameWithHost}` |
148 | : this.i18n('Unsubscribed from {{nameWithHost}}', { nameWithHost: this.videoChannels[ 0 ].nameWithHost }) | 140 | : $localize`Unsubscribed from ${this.videoChannels[ 0 ].nameWithHost}`, |
149 | , | 141 | |
150 | this.i18n('Unsubscribed') | 142 | $localize`Unsubscribed` |
151 | ) | 143 | ) |
152 | }, | 144 | }, |
153 | 145 | ||