aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+video-channels
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/+video-channels
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/+video-channels')
-rw-r--r--client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts4
-rw-r--r--client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts8
-rw-r--r--client/src/app/+video-channels/video-channels.component.ts12
3 files changed, 10 insertions, 14 deletions
diff --git a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts
index 19e4bc1f4..537c7d08e 100644
--- a/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts
+++ b/client/src/app/+video-channels/video-channel-about/video-channel-about.component.ts
@@ -2,7 +2,6 @@ import { Subscription } from 'rxjs'
2import { Component, OnDestroy, OnInit } from '@angular/core' 2import { Component, OnDestroy, OnInit } from '@angular/core'
3import { MarkdownService } from '@app/core' 3import { MarkdownService } from '@app/core'
4import { VideoChannel, VideoChannelService } from '@app/shared/shared-main' 4import { VideoChannel, VideoChannelService } from '@app/shared/shared-main'
5import { I18n } from '@ngx-translate/i18n-polyfill'
6 5
7@Component({ 6@Component({
8 selector: 'my-video-channel-about', 7 selector: 'my-video-channel-about',
@@ -17,7 +16,6 @@ export class VideoChannelAboutComponent implements OnInit, OnDestroy {
17 private videoChannelSub: Subscription 16 private videoChannelSub: Subscription
18 17
19 constructor ( 18 constructor (
20 private i18n: I18n,
21 private videoChannelService: VideoChannelService, 19 private videoChannelService: VideoChannelService,
22 private markdownService: MarkdownService 20 private markdownService: MarkdownService
23 ) { } 21 ) { }
@@ -40,6 +38,6 @@ export class VideoChannelAboutComponent implements OnInit, OnDestroy {
40 getVideoChannelDescription () { 38 getVideoChannelDescription () {
41 if (this.descriptionHTML) return this.descriptionHTML 39 if (this.descriptionHTML) return this.descriptionHTML
42 40
43 return this.i18n('No description') 41 return $localize`No description`
44 } 42 }
45} 43}
diff --git a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts
index 599d38da9..e1ec6bbcb 100644
--- a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts
+++ b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts
@@ -6,7 +6,6 @@ import { AuthService, ConfirmService, LocalStorageService, Notifier, ScreenServi
6import { immutableAssign } from '@app/helpers' 6import { immutableAssign } from '@app/helpers'
7import { VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main' 7import { VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main'
8import { AbstractVideoList } from '@app/shared/shared-video-miniature' 8import { AbstractVideoList } from '@app/shared/shared-video-miniature'
9import { I18n } from '@ngx-translate/i18n-polyfill'
10 9
11@Component({ 10@Component({
12 selector: 'my-video-channel-videos', 11 selector: 'my-video-channel-videos',
@@ -23,7 +22,6 @@ export class VideoChannelVideosComponent extends AbstractVideoList implements On
23 private videoChannelSub: Subscription 22 private videoChannelSub: Subscription
24 23
25 constructor ( 24 constructor (
26 protected i18n: I18n,
27 protected router: Router, 25 protected router: Router,
28 protected serverService: ServerService, 26 protected serverService: ServerService,
29 protected route: ActivatedRoute, 27 protected route: ActivatedRoute,
@@ -38,7 +36,7 @@ export class VideoChannelVideosComponent extends AbstractVideoList implements On
38 ) { 36 ) {
39 super() 37 super()
40 38
41 this.titlePage = this.i18n('Published videos') 39 this.titlePage = $localize`Published videos`
42 this.displayOptions = { 40 this.displayOptions = {
43 ...this.displayOptions, 41 ...this.displayOptions,
44 avatar: false 42 avatar: false
@@ -72,7 +70,9 @@ export class VideoChannelVideosComponent extends AbstractVideoList implements On
72 .getVideoChannelVideos(this.videoChannel, newPagination, this.sort, this.nsfwPolicy) 70 .getVideoChannelVideos(this.videoChannel, newPagination, this.sort, this.nsfwPolicy)
73 .pipe( 71 .pipe(
74 tap(({ total }) => { 72 tap(({ total }) => {
75 this.titlePage = this.i18n(`{total, plural, =1 {Published 1 video} other {Published {{total}} videos}}`, { total }) 73 this.titlePage = total === 1
74 ? $localize`Published 1 video`
75 : $localize`Published ${total} videos`
76 }) 76 })
77 ) 77 )
78 } 78 }
diff --git a/client/src/app/+video-channels/video-channels.component.ts b/client/src/app/+video-channels/video-channels.component.ts
index cae442ee7..ea8bda1cf 100644
--- a/client/src/app/+video-channels/video-channels.component.ts
+++ b/client/src/app/+video-channels/video-channels.component.ts
@@ -6,7 +6,6 @@ import { ActivatedRoute } from '@angular/router'
6import { AuthService, Notifier, RestExtractor, ScreenService } from '@app/core' 6import { AuthService, Notifier, RestExtractor, ScreenService } from '@app/core'
7import { ListOverflowItem, VideoChannel, VideoChannelService } from '@app/shared/shared-main' 7import { ListOverflowItem, VideoChannel, VideoChannelService } from '@app/shared/shared-main'
8import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' 8import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription'
9import { I18n } from '@ngx-translate/i18n-polyfill'
10 9
11@Component({ 10@Component({
12 templateUrl: './video-channels.component.html', 11 templateUrl: './video-channels.component.html',
@@ -23,7 +22,6 @@ export class VideoChannelsComponent implements OnInit, OnDestroy {
23 private routeSub: Subscription 22 private routeSub: Subscription
24 23
25 constructor ( 24 constructor (
26 private i18n: I18n,
27 private route: ActivatedRoute, 25 private route: ActivatedRoute,
28 private notifier: Notifier, 26 private notifier: Notifier,
29 private authService: AuthService, 27 private authService: AuthService,
@@ -59,14 +57,14 @@ export class VideoChannelsComponent implements OnInit, OnDestroy {
59 this.subscribeButton.unsubscribe() : 57 this.subscribeButton.unsubscribe() :
60 this.subscribeButton.subscribe() 58 this.subscribeButton.subscribe()
61 return false 59 return false
62 }, undefined, this.i18n('Subscribe to the account')) 60 }, undefined, $localize`Subscribe to the account`)
63 ] 61 ]
64 if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys) 62 if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys)
65 63
66 this.links = [ 64 this.links = [
67 { label: this.i18n('VIDEOS'), routerLink: 'videos' }, 65 { label: $localize`VIDEOS`, routerLink: 'videos' },
68 { label: this.i18n('VIDEO PLAYLISTS'), routerLink: 'video-playlists' }, 66 { label: $localize`VIDEO PLAYLISTS`, routerLink: 'video-playlists' },
69 { label: this.i18n('ABOUT'), routerLink: 'about' } 67 { label: $localize`ABOUT`, routerLink: 'about' }
70 ] 68 ]
71 } 69 }
72 70
@@ -91,6 +89,6 @@ export class VideoChannelsComponent implements OnInit, OnDestroy {
91 } 89 }
92 90
93 activateCopiedMessage () { 91 activateCopiedMessage () {
94 this.notifier.success(this.i18n('Username copied')) 92 this.notifier.success($localize`Username copied`)
95 } 93 }
96} 94}