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-playlist/video-playlist-element-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-playlist/video-playlist-element-miniature.component.ts')
-rw-r--r-- | client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts index 57a5fbe61..5879c4978 100644 --- a/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts +++ b/client/src/app/shared/shared-video-playlist/video-playlist-element-miniature.component.ts | |||
@@ -2,7 +2,6 @@ import { ChangeDetectionStrategy, ChangeDetectorRef, Component, EventEmitter, In | |||
2 | import { AuthService, Notifier, ServerService } from '@app/core' | 2 | import { AuthService, Notifier, ServerService } from '@app/core' |
3 | import { Video } from '@app/shared/shared-main' | 3 | import { Video } from '@app/shared/shared-main' |
4 | import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' | 4 | import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | import { ServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate } from '@shared/models' | 5 | import { ServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate } from '@shared/models' |
7 | import { secondsToTime } from '../../../assets/player/utils' | 6 | import { secondsToTime } from '../../../assets/player/utils' |
8 | import { VideoPlaylistElement } from './video-playlist-element.model' | 7 | import { VideoPlaylistElement } from './video-playlist-element.model' |
@@ -44,7 +43,6 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit { | |||
44 | private authService: AuthService, | 43 | private authService: AuthService, |
45 | private serverService: ServerService, | 44 | private serverService: ServerService, |
46 | private notifier: Notifier, | 45 | private notifier: Notifier, |
47 | private i18n: I18n, | ||
48 | private videoPlaylistService: VideoPlaylistService, | 46 | private videoPlaylistService: VideoPlaylistService, |
49 | private cdr: ChangeDetectorRef | 47 | private cdr: ChangeDetectorRef |
50 | ) {} | 48 | ) {} |
@@ -97,8 +95,7 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit { | |||
97 | this.videoPlaylistService.removeVideoFromPlaylist(this.playlist.id, playlistElement.id, videoId) | 95 | this.videoPlaylistService.removeVideoFromPlaylist(this.playlist.id, playlistElement.id, videoId) |
98 | .subscribe( | 96 | .subscribe( |
99 | () => { | 97 | () => { |
100 | this.notifier.success(this.i18n('Video removed from {{name}}', { name: this.playlist.displayName })) | 98 | this.notifier.success($localize`Video removed from ${this.playlist.displayName}`) |
101 | |||
102 | this.elementRemoved.emit(playlistElement) | 99 | this.elementRemoved.emit(playlistElement) |
103 | }, | 100 | }, |
104 | 101 | ||
@@ -117,7 +114,7 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit { | |||
117 | this.videoPlaylistService.updateVideoOfPlaylist(this.playlist.id, playlistElement.id, body, this.playlistElement.video.id) | 114 | this.videoPlaylistService.updateVideoOfPlaylist(this.playlist.id, playlistElement.id, body, this.playlistElement.video.id) |
118 | .subscribe( | 115 | .subscribe( |
119 | () => { | 116 | () => { |
120 | this.notifier.success(this.i18n('Timestamps updated')) | 117 | this.notifier.success($localize`Timestamps updated`) |
121 | 118 | ||
122 | playlistElement.startTimestamp = body.startTimestamp | 119 | playlistElement.startTimestamp = body.startTimestamp |
123 | playlistElement.stopTimestamp = body.stopTimestamp | 120 | playlistElement.stopTimestamp = body.stopTimestamp |
@@ -140,10 +137,10 @@ export class VideoPlaylistElementMiniatureComponent implements OnInit { | |||
140 | 137 | ||
141 | if (start === null && stop === null) return '' | 138 | if (start === null && stop === null) return '' |
142 | 139 | ||
143 | if (start !== null && stop === null) return this.i18n('Starts at ') + startFormatted | 140 | if (start !== null && stop === null) return $localize`Starts at ` + startFormatted |
144 | if (start === null && stop !== null) return this.i18n('Stops at ') + stopFormatted | 141 | if (start === null && stop !== null) return $localize`Stops at ` + stopFormatted |
145 | 142 | ||
146 | return this.i18n('Starts at ') + startFormatted + this.i18n(' and stops at ') + stopFormatted | 143 | return $localize`Starts at ` + startFormatted + $localize` and stops at ` + stopFormatted |
147 | } | 144 | } |
148 | 145 | ||
149 | onDropdownOpenChange () { | 146 | onDropdownOpenChange () { |