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-video-miniature/video-miniature.component.ts | |
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-video-miniature/video-miniature.component.ts')
-rw-r--r-- | client/src/app/shared/shared-video-miniature/video-miniature.component.ts | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts index 3c7046de5..cc5665ab1 100644 --- a/client/src/app/shared/shared-video-miniature/video-miniature.component.ts +++ b/client/src/app/shared/shared-video-miniature/video-miniature.component.ts | |||
@@ -11,7 +11,6 @@ import { | |||
11 | Output | 11 | Output |
12 | } from '@angular/core' | 12 | } from '@angular/core' |
13 | import { AuthService, ScreenService, ServerService, User } from '@app/core' | 13 | import { AuthService, ScreenService, ServerService, User } from '@app/core' |
14 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
15 | import { ServerConfig, VideoPlaylistType, VideoPrivacy, VideoState } from '@shared/models' | 14 | import { ServerConfig, VideoPlaylistType, VideoPrivacy, VideoState } from '@shared/models' |
16 | import { Video } from '../shared-main' | 15 | import { Video } from '../shared-main' |
17 | import { VideoPlaylistService } from '../shared-video-playlist' | 16 | import { VideoPlaylistService } from '../shared-video-playlist' |
@@ -95,7 +94,6 @@ export class VideoMiniatureComponent implements OnInit { | |||
95 | constructor ( | 94 | constructor ( |
96 | private screenService: ScreenService, | 95 | private screenService: ScreenService, |
97 | private serverService: ServerService, | 96 | private serverService: ServerService, |
98 | private i18n: I18n, | ||
99 | private authService: AuthService, | 97 | private authService: AuthService, |
100 | private videoPlaylistService: VideoPlaylistService, | 98 | private videoPlaylistService: VideoPlaylistService, |
101 | private cd: ChangeDetectorRef, | 99 | private cd: ChangeDetectorRef, |
@@ -116,10 +114,7 @@ export class VideoMiniatureComponent implements OnInit { | |||
116 | 114 | ||
117 | this.setUpBy() | 115 | this.setUpBy() |
118 | 116 | ||
119 | this.channelLinkTitle = this.i18n( | 117 | this.channelLinkTitle = $localize`${this.video.channel.name} (channel page)` |
120 | '{{name}} (channel page)', | ||
121 | { name: this.video.channel.name, handle: this.video.byVideoChannel } | ||
122 | ) | ||
123 | 118 | ||
124 | // We rely on mouseenter to lazy load actions | 119 | // We rely on mouseenter to lazy load actions |
125 | if (this.screenService.isInTouchScreen()) { | 120 | if (this.screenService.isInTouchScreen()) { |
@@ -164,24 +159,24 @@ export class VideoMiniatureComponent implements OnInit { | |||
164 | if (!video.state) return '' | 159 | if (!video.state) return '' |
165 | 160 | ||
166 | if (video.privacy.id !== VideoPrivacy.PRIVATE && video.state.id === VideoState.PUBLISHED) { | 161 | if (video.privacy.id !== VideoPrivacy.PRIVATE && video.state.id === VideoState.PUBLISHED) { |
167 | return this.i18n('Published') | 162 | return $localize`Published` |
168 | } | 163 | } |
169 | 164 | ||
170 | if (video.scheduledUpdate) { | 165 | if (video.scheduledUpdate) { |
171 | const updateAt = new Date(video.scheduledUpdate.updateAt.toString()).toLocaleString(this.localeId) | 166 | const updateAt = new Date(video.scheduledUpdate.updateAt.toString()).toLocaleString(this.localeId) |
172 | return this.i18n('Publication scheduled on ') + updateAt | 167 | return $localize`Publication scheduled on ` + updateAt |
173 | } | 168 | } |
174 | 169 | ||
175 | if (video.state.id === VideoState.TO_TRANSCODE && video.waitTranscoding === true) { | 170 | if (video.state.id === VideoState.TO_TRANSCODE && video.waitTranscoding === true) { |
176 | return this.i18n('Waiting transcoding') | 171 | return $localize`Waiting transcoding` |
177 | } | 172 | } |
178 | 173 | ||
179 | if (video.state.id === VideoState.TO_TRANSCODE) { | 174 | if (video.state.id === VideoState.TO_TRANSCODE) { |
180 | return this.i18n('To transcode') | 175 | return $localize`To transcode` |
181 | } | 176 | } |
182 | 177 | ||
183 | if (video.state.id === VideoState.TO_IMPORT) { | 178 | if (video.state.id === VideoState.TO_IMPORT) { |
184 | return this.i18n('To import') | 179 | return $localize`To import` |
185 | } | 180 | } |
186 | 181 | ||
187 | return '' | 182 | return '' |