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/+videos | |
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/+videos')
17 files changed, 135 insertions, 186 deletions
diff --git a/client/src/app/+videos/+video-edit/shared/i18n-primeng-calendar.service.ts b/client/src/app/+videos/+video-edit/shared/i18n-primeng-calendar.service.ts index b05852ff8..2acbace48 100644 --- a/client/src/app/+videos/+video-edit/shared/i18n-primeng-calendar.service.ts +++ b/client/src/app/+videos/+video-edit/shared/i18n-primeng-calendar.service.ts | |||
@@ -1,76 +1,75 @@ | |||
1 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
2 | import { Injectable } from '@angular/core' | 1 | import { Injectable } from '@angular/core' |
3 | 2 | ||
4 | @Injectable() | 3 | @Injectable() |
5 | export class I18nPrimengCalendarService { | 4 | export class I18nPrimengCalendarService { |
6 | private readonly calendarLocale: any = {} | 5 | private readonly calendarLocale: any = {} |
7 | 6 | ||
8 | constructor (private i18n: I18n) { | 7 | constructor () { |
9 | this.calendarLocale = { | 8 | this.calendarLocale = { |
10 | firstDayOfWeek: 0, | 9 | firstDayOfWeek: 0, |
11 | dayNames: [ | 10 | dayNames: [ |
12 | this.i18n('Sunday'), | 11 | $localize`Sunday`, |
13 | this.i18n('Monday'), | 12 | $localize`Monday`, |
14 | this.i18n('Tuesday'), | 13 | $localize`Tuesday`, |
15 | this.i18n('Wednesday'), | 14 | $localize`Wednesday`, |
16 | this.i18n('Thursday'), | 15 | $localize`Thursday`, |
17 | this.i18n('Friday'), | 16 | $localize`Friday`, |
18 | this.i18n('Saturday') | 17 | $localize`Saturday` |
19 | ], | 18 | ], |
20 | 19 | ||
21 | dayNamesShort: [ | 20 | dayNamesShort: [ |
22 | this.i18n({ value: 'Sun', description: 'Day name short' }), | 21 | $localize`:Day name short:Sun`, |
23 | this.i18n({ value: 'Mon', description: 'Day name short' }), | 22 | $localize`:Day name short:Mon`, |
24 | this.i18n({ value: 'Tue', description: 'Day name short' }), | 23 | $localize`:Day name short:Tue`, |
25 | this.i18n({ value: 'Wed', description: 'Day name short' }), | 24 | $localize`:Day name short:Wed`, |
26 | this.i18n({ value: 'Thu', description: 'Day name short' }), | 25 | $localize`:Day name short:Thu`, |
27 | this.i18n({ value: 'Fri', description: 'Day name short' }), | 26 | $localize`:Day name short:Fri`, |
28 | this.i18n({ value: 'Sat', description: 'Day name short' }) | 27 | $localize`:Day name short:Sat` |
29 | ], | 28 | ], |
30 | 29 | ||
31 | dayNamesMin: [ | 30 | dayNamesMin: [ |
32 | this.i18n({ value: 'Su', description: 'Day name min' }), | 31 | $localize`:Day name min:Su`, |
33 | this.i18n({ value: 'Mo', description: 'Day name min' }), | 32 | $localize`:Day name min:Mo`, |
34 | this.i18n({ value: 'Tu', description: 'Day name min' }), | 33 | $localize`:Day name min:Tu`, |
35 | this.i18n({ value: 'We', description: 'Day name min' }), | 34 | $localize`:Day name min:We`, |
36 | this.i18n({ value: 'Th', description: 'Day name min' }), | 35 | $localize`:Day name min:Th`, |
37 | this.i18n({ value: 'Fr', description: 'Day name min' }), | 36 | $localize`:Day name min:Fr`, |
38 | this.i18n({ value: 'Sa', description: 'Day name min' }) | 37 | $localize`:Day name min:Sa` |
39 | ], | 38 | ], |
40 | 39 | ||
41 | monthNames: [ | 40 | monthNames: [ |
42 | this.i18n('January'), | 41 | $localize`January`, |
43 | this.i18n('February'), | 42 | $localize`February`, |
44 | this.i18n('March'), | 43 | $localize`March`, |
45 | this.i18n('April'), | 44 | $localize`April`, |
46 | this.i18n('May'), | 45 | $localize`May`, |
47 | this.i18n('June'), | 46 | $localize`June`, |
48 | this.i18n('July'), | 47 | $localize`July`, |
49 | this.i18n('August'), | 48 | $localize`August`, |
50 | this.i18n('September'), | 49 | $localize`September`, |
51 | this.i18n('October'), | 50 | $localize`October`, |
52 | this.i18n('November'), | 51 | $localize`November`, |
53 | this.i18n('December') | 52 | $localize`December` |
54 | ], | 53 | ], |
55 | 54 | ||
56 | monthNamesShort: [ | 55 | monthNamesShort: [ |
57 | this.i18n({ value: 'Jan', description: 'Month name short' }), | 56 | $localize`:Month name short:Jan`, |
58 | this.i18n({ value: 'Feb', description: 'Month name short' }), | 57 | $localize`:Month name short:Feb`, |
59 | this.i18n({ value: 'Mar', description: 'Month name short' }), | 58 | $localize`:Month name short:Mar`, |
60 | this.i18n({ value: 'Apr', description: 'Month name short' }), | 59 | $localize`:Month name short:Apr`, |
61 | this.i18n({ value: 'May', description: 'Month name short' }), | 60 | $localize`:Month name short:May`, |
62 | this.i18n({ value: 'Jun', description: 'Month name short' }), | 61 | $localize`:Month name short:Jun`, |
63 | this.i18n({ value: 'Jul', description: 'Month name short' }), | 62 | $localize`:Month name short:Jul`, |
64 | this.i18n({ value: 'Aug', description: 'Month name short' }), | 63 | $localize`:Month name short:Aug`, |
65 | this.i18n({ value: 'Sep', description: 'Month name short' }), | 64 | $localize`:Month name short:Sep`, |
66 | this.i18n({ value: 'Oct', description: 'Month name short' }), | 65 | $localize`:Month name short:Oct`, |
67 | this.i18n({ value: 'Nov', description: 'Month name short' }), | 66 | $localize`:Month name short:Nov`, |
68 | this.i18n({ value: 'Dec', description: 'Month name short' }) | 67 | $localize`:Month name short:Dec` |
69 | ], | 68 | ], |
70 | 69 | ||
71 | today: this.i18n('Today'), | 70 | today: $localize`Today`, |
72 | 71 | ||
73 | clear: this.i18n('Clear') | 72 | clear: $localize`Clear` |
74 | } | 73 | } |
75 | } | 74 | } |
76 | 75 | ||
@@ -86,9 +85,6 @@ export class I18nPrimengCalendarService { | |||
86 | } | 85 | } |
87 | 86 | ||
88 | getDateFormat () { | 87 | getDateFormat () { |
89 | return this.i18n({ | 88 | return $localize`:Date format in this locale.:yy-mm-dd` |
90 | value: 'yy-mm-dd ', | ||
91 | description: 'Date format in this locale.' | ||
92 | }) | ||
93 | } | 89 | } |
94 | } | 90 | } |
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts index ba3b7c96a..050b6d931 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.ts +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.ts | |||
@@ -7,7 +7,6 @@ import { removeElementFromArray } from '@app/helpers' | |||
7 | import { FormReactiveValidationMessages, FormValidatorService, SelectChannelItem, VideoValidatorsService } from '@app/shared/shared-forms' | 7 | import { FormReactiveValidationMessages, FormValidatorService, SelectChannelItem, VideoValidatorsService } from '@app/shared/shared-forms' |
8 | import { InstanceService } from '@app/shared/shared-instance' | 8 | import { InstanceService } from '@app/shared/shared-instance' |
9 | import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main' | 9 | import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main' |
10 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
11 | import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' | 10 | import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models' |
12 | import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service' | 11 | import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service' |
13 | import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' | 12 | import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component' |
@@ -63,7 +62,6 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
63 | private serverService: ServerService, | 62 | private serverService: ServerService, |
64 | private instanceService: InstanceService, | 63 | private instanceService: InstanceService, |
65 | private i18nPrimengCalendarService: I18nPrimengCalendarService, | 64 | private i18nPrimengCalendarService: I18nPrimengCalendarService, |
66 | private i18n: I18n, | ||
67 | private ngZone: NgZone | 65 | private ngZone: NgZone |
68 | ) { | 66 | ) { |
69 | this.calendarLocale = this.i18nPrimengCalendarService.getCalendarLocale() | 67 | this.calendarLocale = this.i18nPrimengCalendarService.getCalendarLocale() |
@@ -137,8 +135,8 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
137 | .subscribe(res => { | 135 | .subscribe(res => { |
138 | this.videoLanguages = res.languages | 136 | this.videoLanguages = res.languages |
139 | .map(l => res.about.instance.languages.includes(l.id) | 137 | .map(l => res.about.instance.languages.includes(l.id) |
140 | ? { ...l, group: this.i18n('Instance languages'), groupOrder: 0 } | 138 | ? { ...l, group: $localize`Instance languages`, groupOrder: 0 } |
141 | : { ...l, group: this.i18n('All languages'), groupOrder: 1 }) | 139 | : { ...l, group: $localize`All languages`, groupOrder: 1 }) |
142 | .sort((a, b) => a.groupOrder - b.groupOrder) | 140 | .sort((a, b) => a.groupOrder - b.groupOrder) |
143 | }) | 141 | }) |
144 | 142 | ||
@@ -148,8 +146,8 @@ export class VideoEditComponent implements OnInit, OnDestroy { | |||
148 | if (this.schedulePublicationPossible) { | 146 | if (this.schedulePublicationPossible) { |
149 | this.videoPrivacies.push({ | 147 | this.videoPrivacies.push({ |
150 | id: this.SPECIAL_SCHEDULED_PRIVACY, | 148 | id: this.SPECIAL_SCHEDULED_PRIVACY, |
151 | label: this.i18n('Scheduled'), | 149 | label: $localize`Scheduled`, |
152 | description: this.i18n('Hide the video until a specific date') | 150 | description: $localize`Hide the video until a specific date` |
153 | }) | 151 | }) |
154 | } | 152 | } |
155 | }) | 153 | }) |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts index 3a8e6eecc..e9ad8af7a 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts | |||
@@ -4,10 +4,9 @@ import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@a | |||
4 | import { scrollToTop } from '@app/helpers' | 4 | import { scrollToTop } from '@app/helpers' |
5 | import { FormValidatorService } from '@app/shared/shared-forms' | 5 | import { FormValidatorService } from '@app/shared/shared-forms' |
6 | import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' | 6 | import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' |
7 | import { VideoSend } from './video-send' | ||
8 | import { LoadingBarService } from '@ngx-loading-bar/core' | 7 | import { LoadingBarService } from '@ngx-loading-bar/core' |
9 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
10 | import { VideoPrivacy, VideoUpdate } from '@shared/models' | 8 | import { VideoPrivacy, VideoUpdate } from '@shared/models' |
9 | import { VideoSend } from './video-send' | ||
11 | 10 | ||
12 | @Component({ | 11 | @Component({ |
13 | selector: 'my-video-import-torrent', | 12 | selector: 'my-video-import-torrent', |
@@ -43,9 +42,8 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
43 | protected videoService: VideoService, | 42 | protected videoService: VideoService, |
44 | protected videoCaptionService: VideoCaptionService, | 43 | protected videoCaptionService: VideoCaptionService, |
45 | private router: Router, | 44 | private router: Router, |
46 | private videoImportService: VideoImportService, | 45 | private videoImportService: VideoImportService |
47 | private i18n: I18n | 46 | ) { |
48 | ) { | ||
49 | super() | 47 | super() |
50 | } | 48 | } |
51 | 49 | ||
@@ -127,7 +125,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
127 | .subscribe( | 125 | .subscribe( |
128 | () => { | 126 | () => { |
129 | this.isUpdatingVideo = false | 127 | this.isUpdatingVideo = false |
130 | this.notifier.success(this.i18n('Video to import updated.')) | 128 | this.notifier.success($localize`Video to import updated.`) |
131 | 129 | ||
132 | this.router.navigate([ '/my-account', 'video-imports' ]) | 130 | this.router.navigate([ '/my-account', 'video-imports' ]) |
133 | }, | 131 | }, |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts index da25663d7..8bad81097 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts | |||
@@ -5,10 +5,9 @@ import { AuthService, CanComponentDeactivate, Notifier, ServerService } from '@a | |||
5 | import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers' | 5 | import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers' |
6 | import { FormValidatorService } from '@app/shared/shared-forms' | 6 | import { FormValidatorService } from '@app/shared/shared-forms' |
7 | import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' | 7 | import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' |
8 | import { VideoSend } from './video-send' | ||
9 | import { LoadingBarService } from '@ngx-loading-bar/core' | 8 | import { LoadingBarService } from '@ngx-loading-bar/core' |
10 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
11 | import { VideoPrivacy, VideoUpdate } from '@shared/models' | 9 | import { VideoPrivacy, VideoUpdate } from '@shared/models' |
10 | import { VideoSend } from './video-send' | ||
12 | 11 | ||
13 | @Component({ | 12 | @Component({ |
14 | selector: 'my-video-import-url', | 13 | selector: 'my-video-import-url', |
@@ -42,9 +41,8 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom | |||
42 | protected videoService: VideoService, | 41 | protected videoService: VideoService, |
43 | protected videoCaptionService: VideoCaptionService, | 42 | protected videoCaptionService: VideoCaptionService, |
44 | private router: Router, | 43 | private router: Router, |
45 | private videoImportService: VideoImportService, | 44 | private videoImportService: VideoImportService |
46 | private i18n: I18n | 45 | ) { |
47 | ) { | ||
48 | super() | 46 | super() |
49 | } | 47 | } |
50 | 48 | ||
@@ -137,7 +135,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, CanCom | |||
137 | .subscribe( | 135 | .subscribe( |
138 | () => { | 136 | () => { |
139 | this.isUpdatingVideo = false | 137 | this.isUpdatingVideo = false |
140 | this.notifier.success(this.i18n('Video to import updated.')) | 138 | this.notifier.success($localize`Video to import updated.`) |
141 | 139 | ||
142 | this.router.navigate([ '/my-account', 'video-imports' ]) | 140 | this.router.navigate([ '/my-account', 'video-imports' ]) |
143 | }, | 141 | }, |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts index e18e3c9a7..416b655a4 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts | |||
@@ -7,7 +7,6 @@ import { scrollToTop } from '@app/helpers' | |||
7 | import { FormValidatorService } from '@app/shared/shared-forms' | 7 | import { FormValidatorService } from '@app/shared/shared-forms' |
8 | import { BytesPipe, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' | 8 | import { BytesPipe, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' |
9 | import { LoadingBarService } from '@ngx-loading-bar/core' | 9 | import { LoadingBarService } from '@ngx-loading-bar/core' |
10 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
11 | import { VideoPrivacy } from '@shared/models' | 10 | import { VideoPrivacy } from '@shared/models' |
12 | import { VideoSend } from './video-send' | 11 | import { VideoSend } from './video-send' |
13 | 12 | ||
@@ -59,9 +58,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
59 | protected videoService: VideoService, | 58 | protected videoService: VideoService, |
60 | protected videoCaptionService: VideoCaptionService, | 59 | protected videoCaptionService: VideoCaptionService, |
61 | private userService: UserService, | 60 | private userService: UserService, |
62 | private router: Router, | 61 | private router: Router |
63 | private i18n: I18n | 62 | ) { |
64 | ) { | ||
65 | super() | 63 | super() |
66 | } | 64 | } |
67 | 65 | ||
@@ -88,10 +86,10 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
88 | 86 | ||
89 | if (this.videoUploaded === true) { | 87 | if (this.videoUploaded === true) { |
90 | // FIXME: cannot concatenate strings inside i18n service :/ | 88 | // FIXME: cannot concatenate strings inside i18n service :/ |
91 | text = this.i18n('Your video was uploaded to your account and is private.') + ' ' + | 89 | text = $localize`Your video was uploaded to your account and is private.` + ' ' + |
92 | this.i18n('But associated data (tags, description...) will be lost, are you sure you want to leave this page?') | 90 | $localize`But associated data (tags, description...) will be lost, are you sure you want to leave this page?` |
93 | } else { | 91 | } else { |
94 | text = this.i18n('Your video is not uploaded yet, are you sure you want to leave this page?') | 92 | text = $localize`Your video is not uploaded yet, are you sure you want to leave this page?` |
95 | } | 93 | } |
96 | 94 | ||
97 | return { | 95 | return { |
@@ -111,9 +109,9 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
111 | 109 | ||
112 | getAudioUploadLabel () { | 110 | getAudioUploadLabel () { |
113 | const videofile = this.getVideoFile() | 111 | const videofile = this.getVideoFile() |
114 | if (!videofile) return this.i18n('Upload') | 112 | if (!videofile) return $localize`Upload` |
115 | 113 | ||
116 | return this.i18n('Upload {{videofileName}}', { videofileName: videofile.name }) | 114 | return $localize`Upload ${videofile.name}` |
117 | } | 115 | } |
118 | 116 | ||
119 | fileChange () { | 117 | fileChange () { |
@@ -130,7 +128,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
130 | 128 | ||
131 | this.firstStepError.emit() | 129 | this.firstStepError.emit() |
132 | 130 | ||
133 | this.notifier.info(this.i18n('Upload cancelled')) | 131 | this.notifier.info($localize`Upload cancelled`) |
134 | } | 132 | } |
135 | } | 133 | } |
136 | 134 | ||
@@ -242,7 +240,7 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
242 | this.isUpdatingVideo = false | 240 | this.isUpdatingVideo = false |
243 | this.isUploadingVideo = false | 241 | this.isUploadingVideo = false |
244 | 242 | ||
245 | this.notifier.success(this.i18n('Video published.')) | 243 | this.notifier.success($localize`Video published.`) |
246 | this.router.navigate([ '/videos/watch', video.uuid ]) | 244 | this.router.navigate([ '/videos/watch', video.uuid ]) |
247 | }, | 245 | }, |
248 | 246 | ||
@@ -260,14 +258,12 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
260 | // Check global user quota | 258 | // Check global user quota |
261 | const videoQuota = this.authService.getUser().videoQuota | 259 | const videoQuota = this.authService.getUser().videoQuota |
262 | if (videoQuota !== -1 && (this.userVideoQuotaUsed + videofile.size) > videoQuota) { | 260 | if (videoQuota !== -1 && (this.userVideoQuotaUsed + videofile.size) > videoQuota) { |
263 | const msg = this.i18n( | 261 | const videoSizeBytes = bytePipes.transform(videofile.size, 0) |
264 | 'Your video quota is exceeded with this video (video size: {{videoSize}}, used: {{videoQuotaUsed}}, quota: {{videoQuota}})', | 262 | const videoQuotaUsedBytes = bytePipes.transform(this.userVideoQuotaUsed, 0) |
265 | { | 263 | const videoQuotaBytes = bytePipes.transform(videoQuota, 0) |
266 | videoSize: bytePipes.transform(videofile.size, 0), | 264 | |
267 | videoQuotaUsed: bytePipes.transform(this.userVideoQuotaUsed, 0), | 265 | const msg = $localize`Your video quota is exceeded with this video ( |
268 | videoQuota: bytePipes.transform(videoQuota, 0) | 266 | video size: ${videoSizeBytes}, used: ${videoQuotaUsedBytes}, quota: ${videoQuotaBytes})` |
269 | } | ||
270 | ) | ||
271 | this.notifier.error(msg) | 267 | this.notifier.error(msg) |
272 | 268 | ||
273 | return false | 269 | return false |
@@ -282,14 +278,12 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
282 | // Check daily user quota | 278 | // Check daily user quota |
283 | const videoQuotaDaily = this.authService.getUser().videoQuotaDaily | 279 | const videoQuotaDaily = this.authService.getUser().videoQuotaDaily |
284 | if (videoQuotaDaily !== -1 && (this.userVideoQuotaUsedDaily + videofile.size) > videoQuotaDaily) { | 280 | if (videoQuotaDaily !== -1 && (this.userVideoQuotaUsedDaily + videofile.size) > videoQuotaDaily) { |
285 | const msg = this.i18n( | 281 | const videoSizeBytes = bytePipes.transform(videofile.size, 0) |
286 | 'Your daily video quota is exceeded with this video (video size: {{videoSize}}, used: {{quotaUsedDaily}}, quota: {{quotaDaily}})', | 282 | const quotaUsedDailyBytes = bytePipes.transform(this.userVideoQuotaUsedDaily, 0) |
287 | { | 283 | const quotaDailyBytes = bytePipes.transform(videoQuotaDaily, 0) |
288 | videoSize: bytePipes.transform(videofile.size, 0), | 284 | |
289 | quotaUsedDaily: bytePipes.transform(this.userVideoQuotaUsedDaily, 0), | 285 | const msg = $localize`Your daily video quota is exceeded with this video ( |
290 | quotaDaily: bytePipes.transform(videoQuotaDaily, 0) | 286 | video size: ${videoSizeBytes}, used: ${quotaUsedDailyBytes}, quota: ${quotaDailyBytes})` |
291 | } | ||
292 | ) | ||
293 | this.notifier.error(msg) | 287 | this.notifier.error(msg) |
294 | 288 | ||
295 | return false | 289 | return false |
diff --git a/client/src/app/+videos/+video-edit/video-update.component.ts b/client/src/app/+videos/+video-edit/video-update.component.ts index abd08f05c..2e1d0f89d 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.ts +++ b/client/src/app/+videos/+video-edit/video-update.component.ts | |||
@@ -5,7 +5,6 @@ import { Notifier } from '@app/core' | |||
5 | import { FormReactive, FormValidatorService, SelectChannelItem } from '@app/shared/shared-forms' | 5 | import { FormReactive, FormValidatorService, SelectChannelItem } from '@app/shared/shared-forms' |
6 | import { VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main' | 6 | import { VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main' |
7 | import { LoadingBarService } from '@ngx-loading-bar/core' | 7 | import { LoadingBarService } from '@ngx-loading-bar/core' |
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { VideoPrivacy } from '@shared/models' | 8 | import { VideoPrivacy } from '@shared/models' |
10 | 9 | ||
11 | @Component({ | 10 | @Component({ |
@@ -31,9 +30,8 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
31 | private notifier: Notifier, | 30 | private notifier: Notifier, |
32 | private videoService: VideoService, | 31 | private videoService: VideoService, |
33 | private loadingBar: LoadingBarService, | 32 | private loadingBar: LoadingBarService, |
34 | private videoCaptionService: VideoCaptionService, | 33 | private videoCaptionService: VideoCaptionService |
35 | private i18n: I18n | 34 | ) { |
36 | ) { | ||
37 | super() | 35 | super() |
38 | } | 36 | } |
39 | 37 | ||
@@ -78,7 +76,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
78 | canDeactivate (): { canDeactivate: boolean, text?: string } { | 76 | canDeactivate (): { canDeactivate: boolean, text?: string } { |
79 | if (this.updateDone === true) return { canDeactivate: true } | 77 | if (this.updateDone === true) return { canDeactivate: true } |
80 | 78 | ||
81 | const text = this.i18n('You have unsaved changes! If you leave, your changes will be lost.') | 79 | const text = $localize`You have unsaved changes! If you leave, your changes will be lost.` |
82 | 80 | ||
83 | for (const caption of this.videoCaptions) { | 81 | for (const caption of this.videoCaptions) { |
84 | if (caption.action) return { canDeactivate: false, text } | 82 | if (caption.action) return { canDeactivate: false, text } |
@@ -115,7 +113,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
115 | this.updateDone = true | 113 | this.updateDone = true |
116 | this.isUpdatingVideo = false | 114 | this.isUpdatingVideo = false |
117 | this.loadingBar.useRef().complete() | 115 | this.loadingBar.useRef().complete() |
118 | this.notifier.success(this.i18n('Video updated.')) | 116 | this.notifier.success($localize`Video updated.`) |
119 | this.router.navigate([ '/videos/watch', this.video.uuid ]) | 117 | this.router.navigate([ '/videos/watch', this.video.uuid ]) |
120 | }, | 118 | }, |
121 | 119 | ||
diff --git a/client/src/app/+videos/+video-watch/comment/video-comment.component.ts b/client/src/app/+videos/+video-watch/comment/video-comment.component.ts index 36ec6e9f9..a84e91fd3 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comment.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comment.component.ts | |||
@@ -5,7 +5,6 @@ import { AuthService } from '@app/core/auth' | |||
5 | import { Account, Actor, DropdownAction, Video } from '@app/shared/shared-main' | 5 | import { Account, Actor, DropdownAction, Video } from '@app/shared/shared-main' |
6 | import { CommentReportComponent } from '@app/shared/shared-moderation/report-modals/comment-report.component' | 6 | import { CommentReportComponent } from '@app/shared/shared-moderation/report-modals/comment-report.component' |
7 | import { VideoComment, VideoCommentThreadTree } from '@app/shared/shared-video-comment' | 7 | import { VideoComment, VideoCommentThreadTree } from '@app/shared/shared-video-comment' |
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { User, UserRight } from '@shared/models' | 8 | import { User, UserRight } from '@shared/models' |
10 | 9 | ||
11 | @Component({ | 10 | @Component({ |
@@ -39,7 +38,6 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
39 | commentUser: User | 38 | commentUser: User |
40 | 39 | ||
41 | constructor ( | 40 | constructor ( |
42 | private i18n: I18n, | ||
43 | private markdownService: MarkdownService, | 41 | private markdownService: MarkdownService, |
44 | private authService: AuthService, | 42 | private authService: AuthService, |
45 | private userService: UserService, | 43 | private userService: UserService, |
@@ -138,7 +136,7 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
138 | if (this.isUserLoggedIn() && this.comment.isDeleted === false && this.authService.getUser().account.id !== this.comment.account.id) { | 136 | if (this.isUserLoggedIn() && this.comment.isDeleted === false && this.authService.getUser().account.id !== this.comment.account.id) { |
139 | this.prependModerationActions = [ | 137 | this.prependModerationActions = [ |
140 | { | 138 | { |
141 | label: this.i18n('Report comment'), | 139 | label: $localize`Report comment`, |
142 | handler: () => this.showReportModal() | 140 | handler: () => this.showReportModal() |
143 | } | 141 | } |
144 | ] | 142 | ] |
diff --git a/client/src/app/+videos/+video-watch/comment/video-comments.component.ts b/client/src/app/+videos/+video-watch/comment/video-comments.component.ts index 66494a20a..517844ab2 100644 --- a/client/src/app/+videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/+videos/+video-watch/comment/video-comments.component.ts | |||
@@ -5,7 +5,6 @@ import { AuthService, ComponentPagination, ConfirmService, hasMoreItems, Notifie | |||
5 | import { HooksService } from '@app/core/plugins/hooks.service' | 5 | import { HooksService } from '@app/core/plugins/hooks.service' |
6 | import { Syndication, VideoDetails } from '@app/shared/shared-main' | 6 | import { Syndication, VideoDetails } from '@app/shared/shared-main' |
7 | import { VideoComment, VideoCommentService, VideoCommentThreadTree } from '@app/shared/shared-video-comment' | 7 | import { VideoComment, VideoCommentService, VideoCommentThreadTree } from '@app/shared/shared-video-comment' |
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | 8 | ||
10 | @Component({ | 9 | @Component({ |
11 | selector: 'my-video-comments', | 10 | selector: 'my-video-comments', |
@@ -43,7 +42,6 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
43 | private confirmService: ConfirmService, | 42 | private confirmService: ConfirmService, |
44 | private videoCommentService: VideoCommentService, | 43 | private videoCommentService: VideoCommentService, |
45 | private activatedRoute: ActivatedRoute, | 44 | private activatedRoute: ActivatedRoute, |
46 | private i18n: I18n, | ||
47 | private hooks: HooksService | 45 | private hooks: HooksService |
48 | ) {} | 46 | ) {} |
49 | 47 | ||
@@ -162,12 +160,12 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
162 | let message = 'Do you really want to delete this comment?' | 160 | let message = 'Do you really want to delete this comment?' |
163 | 161 | ||
164 | if (commentToDelete.isLocal || this.video.isLocal) { | 162 | if (commentToDelete.isLocal || this.video.isLocal) { |
165 | message += this.i18n(' The deletion will be sent to remote instances so they can reflect the change.') | 163 | message += $localize` The deletion will be sent to remote instances so they can reflect the change.` |
166 | } else { | 164 | } else { |
167 | message += this.i18n(' It is a remote comment, so the deletion will only be effective on your instance.') | 165 | message += $localize` It is a remote comment, so the deletion will only be effective on your instance.` |
168 | } | 166 | } |
169 | 167 | ||
170 | const res = await this.confirmService.confirm(message, this.i18n('Delete')) | 168 | const res = await this.confirmService.confirm(message, $localize`Delete`) |
171 | if (res === false) return | 169 | if (res === false) return |
172 | 170 | ||
173 | this.videoCommentService.deleteVideoComment(commentToDelete.videoId, commentToDelete.id) | 171 | this.videoCommentService.deleteVideoComment(commentToDelete.videoId, commentToDelete.id) |
diff --git a/client/src/app/+videos/+video-watch/recommendations/recommended-videos.component.ts b/client/src/app/+videos/+video-watch/recommendations/recommended-videos.component.ts index d2372023f..a1c8e0661 100644 --- a/client/src/app/+videos/+video-watch/recommendations/recommended-videos.component.ts +++ b/client/src/app/+videos/+video-watch/recommendations/recommended-videos.component.ts | |||
@@ -4,10 +4,9 @@ import { AuthService, Notifier, SessionStorageService, User, UserService } from | |||
4 | import { Video } from '@app/shared/shared-main' | 4 | import { Video } from '@app/shared/shared-main' |
5 | import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature' | 5 | import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature' |
6 | import { VideoPlaylist } from '@app/shared/shared-video-playlist' | 6 | import { VideoPlaylist } from '@app/shared/shared-video-playlist' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | 7 | import { UserLocalStorageKeys } from '@root-helpers/users' |
8 | import { RecommendationInfo } from './recommendation-info.model' | 8 | import { RecommendationInfo } from './recommendation-info.model' |
9 | import { RecommendedVideosStore } from './recommended-videos.store' | 9 | import { RecommendedVideosStore } from './recommended-videos.store' |
10 | import { UserLocalStorageKeys } from '@root-helpers/users' | ||
11 | 10 | ||
12 | @Component({ | 11 | @Component({ |
13 | selector: 'my-recommended-videos', | 12 | selector: 'my-recommended-videos', |
@@ -38,7 +37,6 @@ export class RecommendedVideosComponent implements OnInit, OnChanges { | |||
38 | private userService: UserService, | 37 | private userService: UserService, |
39 | private authService: AuthService, | 38 | private authService: AuthService, |
40 | private notifier: Notifier, | 39 | private notifier: Notifier, |
41 | private i18n: I18n, | ||
42 | private store: RecommendedVideosStore, | 40 | private store: RecommendedVideosStore, |
43 | private sessionStorageService: SessionStorageService | 41 | private sessionStorageService: SessionStorageService |
44 | ) { | 42 | ) { |
@@ -58,7 +56,7 @@ export class RecommendedVideosComponent implements OnInit, OnChanges { | |||
58 | ) | 56 | ) |
59 | } | 57 | } |
60 | 58 | ||
61 | this.autoPlayNextVideoTooltip = this.i18n('When active, the next video is automatically played after the current one.') | 59 | this.autoPlayNextVideoTooltip = $localize`When active, the next video is automatically played after the current one.` |
62 | } | 60 | } |
63 | 61 | ||
64 | ngOnInit () { | 62 | ngOnInit () { |
diff --git a/client/src/app/+videos/+video-watch/video-duration-formatter.pipe.ts b/client/src/app/+videos/+video-watch/video-duration-formatter.pipe.ts index 4b6767415..19b34f984 100644 --- a/client/src/app/+videos/+video-watch/video-duration-formatter.pipe.ts +++ b/client/src/app/+videos/+video-watch/video-duration-formatter.pipe.ts | |||
@@ -1,28 +1,23 @@ | |||
1 | import { Pipe, PipeTransform } from '@angular/core' | 1 | import { Pipe, PipeTransform } from '@angular/core' |
2 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
3 | 2 | ||
4 | @Pipe({ | 3 | @Pipe({ |
5 | name: 'myVideoDurationFormatter' | 4 | name: 'myVideoDurationFormatter' |
6 | }) | 5 | }) |
7 | export class VideoDurationPipe implements PipeTransform { | 6 | export class VideoDurationPipe implements PipeTransform { |
8 | 7 | ||
9 | constructor (private i18n: I18n) { | ||
10 | |||
11 | } | ||
12 | |||
13 | transform (value: number): string { | 8 | transform (value: number): string { |
14 | const hours = Math.floor(value / 3600) | 9 | const hours = Math.floor(value / 3600) |
15 | const minutes = Math.floor((value % 3600) / 60) | 10 | const minutes = Math.floor((value % 3600) / 60) |
16 | const seconds = value % 60 | 11 | const seconds = value % 60 |
17 | 12 | ||
18 | if (hours > 0) { | 13 | if (hours > 0) { |
19 | return this.i18n('{{hours}} h {{minutes}} min {{seconds}} sec', { hours, minutes, seconds }) | 14 | return $localize`${hours} h ${minutes} min ${seconds} sec` |
20 | } | 15 | } |
21 | 16 | ||
22 | if (minutes > 0) { | 17 | if (minutes > 0) { |
23 | return this.i18n('{{minutes}} min {{seconds}} sec', { minutes, seconds }) | 18 | return $localize`${minutes} min ${seconds} sec` |
24 | } | 19 | } |
25 | 20 | ||
26 | return this.i18n('{{seconds}} sec', { seconds }) | 21 | return $localize`${seconds} sec` |
27 | } | 22 | } |
28 | } | 23 | } |
diff --git a/client/src/app/+videos/+video-watch/video-watch-playlist.component.ts b/client/src/app/+videos/+video-watch/video-watch-playlist.component.ts index 519ce2974..c60ca4671 100644 --- a/client/src/app/+videos/+video-watch/video-watch-playlist.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch-playlist.component.ts | |||
@@ -1,9 +1,8 @@ | |||
1 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { AuthService, ComponentPagination, LocalStorageService, Notifier, SessionStorageService, UserService } from '@app/core' | 3 | import { AuthService, ComponentPagination, LocalStorageService, Notifier, SessionStorageService, UserService } from '@app/core' |
4 | import { peertubeLocalStorage, peertubeSessionStorage } from '@root-helpers/peertube-web-storage' | ||
5 | import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist' | 4 | import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | 5 | import { peertubeLocalStorage, peertubeSessionStorage } from '@root-helpers/peertube-web-storage' |
7 | import { VideoDetails, VideoPlaylistPrivacy } from '@shared/models' | 6 | import { VideoDetails, VideoPlaylistPrivacy } from '@shared/models' |
8 | 7 | ||
9 | @Component({ | 8 | @Component({ |
@@ -36,7 +35,6 @@ export class VideoWatchPlaylistComponent { | |||
36 | private userService: UserService, | 35 | private userService: UserService, |
37 | private auth: AuthService, | 36 | private auth: AuthService, |
38 | private notifier: Notifier, | 37 | private notifier: Notifier, |
39 | private i18n: I18n, | ||
40 | private videoPlaylist: VideoPlaylistService, | 38 | private videoPlaylist: VideoPlaylistService, |
41 | private localStorageService: LocalStorageService, | 39 | private localStorageService: LocalStorageService, |
42 | private sessionStorageService: SessionStorageService, | 40 | private sessionStorageService: SessionStorageService, |
@@ -189,13 +187,13 @@ export class VideoWatchPlaylistComponent { | |||
189 | 187 | ||
190 | private setAutoPlayNextVideoPlaylistSwitchText () { | 188 | private setAutoPlayNextVideoPlaylistSwitchText () { |
191 | this.autoPlayNextVideoPlaylistSwitchText = this.autoPlayNextVideoPlaylist | 189 | this.autoPlayNextVideoPlaylistSwitchText = this.autoPlayNextVideoPlaylist |
192 | ? this.i18n('Stop autoplaying next video') | 190 | ? $localize`Stop autoplaying next video` |
193 | : this.i18n('Autoplay next video') | 191 | : $localize`Autoplay next video` |
194 | } | 192 | } |
195 | 193 | ||
196 | private setLoopPlaylistSwitchText () { | 194 | private setLoopPlaylistSwitchText () { |
197 | this.loopPlaylistSwitchText = this.loopPlaylist | 195 | this.loopPlaylistSwitchText = this.loopPlaylist |
198 | ? this.i18n('Stop looping playlist videos') | 196 | ? $localize`Stop looping playlist videos` |
199 | : this.i18n('Loop playlist videos') | 197 | : $localize`Loop playlist videos` |
200 | } | 198 | } |
201 | } | 199 | } |
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index a53af210a..fb89bf6cd 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -14,7 +14,6 @@ import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription' | |||
14 | import { VideoDownloadComponent } from '@app/shared/shared-video-miniature' | 14 | import { VideoDownloadComponent } from '@app/shared/shared-video-miniature' |
15 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' | 15 | import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist' |
16 | import { MetaService } from '@ngx-meta/core' | 16 | import { MetaService } from '@ngx-meta/core' |
17 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
18 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | 17 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
19 | import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models' | 18 | import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models' |
20 | import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage' | 19 | import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage' |
@@ -97,16 +96,15 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
97 | private zone: NgZone, | 96 | private zone: NgZone, |
98 | private redirectService: RedirectService, | 97 | private redirectService: RedirectService, |
99 | private videoCaptionService: VideoCaptionService, | 98 | private videoCaptionService: VideoCaptionService, |
100 | private i18n: I18n, | ||
101 | private hotkeysService: HotkeysService, | 99 | private hotkeysService: HotkeysService, |
102 | private hooks: HooksService, | 100 | private hooks: HooksService, |
103 | private location: PlatformLocation, | 101 | private location: PlatformLocation, |
104 | @Inject(LOCALE_ID) private localeId: string | 102 | @Inject(LOCALE_ID) private localeId: string |
105 | ) { | 103 | ) { |
106 | this.tooltipLike = this.i18n('Like this video') | 104 | this.tooltipLike = $localize`Like this video` |
107 | this.tooltipDislike = this.i18n('Dislike this video') | 105 | this.tooltipDislike = $localize`Dislike this video` |
108 | this.tooltipSupport = this.i18n('Support options for this video') | 106 | this.tooltipSupport = $localize`Support options for this video` |
109 | this.tooltipSaveToPlaylist = this.i18n('Save to playlist') | 107 | this.tooltipSaveToPlaylist = $localize`Save to playlist` |
110 | } | 108 | } |
111 | 109 | ||
112 | get user () { | 110 | get user () { |
@@ -188,7 +186,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
188 | getRatePopoverText () { | 186 | getRatePopoverText () { |
189 | if (this.isUserLoggedIn()) return undefined | 187 | if (this.isUserLoggedIn()) return undefined |
190 | 188 | ||
191 | return this.i18n('You need to be connected to rate this content.') | 189 | return $localize`You need to be connected to rate this content.` |
192 | } | 190 | } |
193 | 191 | ||
194 | showMoreDescription () { | 192 | showMoreDescription () { |
@@ -409,10 +407,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
409 | } | 407 | } |
410 | 408 | ||
411 | private setVideoLikesBarTooltipText () { | 409 | private setVideoLikesBarTooltipText () { |
412 | this.likesBarTooltipText = this.i18n('{{likesNumber}} likes / {{dislikesNumber}} dislikes', { | 410 | this.likesBarTooltipText = `${this.video.likes} likes / ${this.video.dislikes} dislikes` |
413 | likesNumber: this.video.likes, | ||
414 | dislikesNumber: this.video.dislikes | ||
415 | }) | ||
416 | } | 411 | } |
417 | 412 | ||
418 | private handleError (err: any) { | 413 | private handleError (err: any) { |
@@ -465,8 +460,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
465 | 460 | ||
466 | if (this.isVideoBlur(this.video)) { | 461 | if (this.isVideoBlur(this.video)) { |
467 | const res = await this.confirmService.confirm( | 462 | const res = await this.confirmService.confirm( |
468 | this.i18n('This video contains mature or explicit content. Are you sure you want to watch it?'), | 463 | $localize`This video contains mature or explicit content. Are you sure you want to watch it?`, |
469 | this.i18n('Mature or explicit content') | 464 | $localize`Mature or explicit content` |
470 | ) | 465 | ) |
471 | if (res === false) return this.location.back() | 466 | if (res === false) return this.location.back() |
472 | } | 467 | } |
@@ -515,9 +510,9 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
515 | */ | 510 | */ |
516 | this.player.upnext({ | 511 | this.player.upnext({ |
517 | timeout: 10000, // 10s | 512 | timeout: 10000, // 10s |
518 | headText: this.i18n('Up Next'), | 513 | headText: $localize`Up Next`, |
519 | cancelText: this.i18n('Cancel'), | 514 | cancelText: $localize`Cancel`, |
520 | suspendedText: this.i18n('Autoplay is suspended'), | 515 | suspendedText: $localize`Autoplay is suspended`, |
521 | getTitle: () => this.nextVideoTitle, | 516 | getTitle: () => this.nextVideoTitle, |
522 | next: () => this.zone.run(() => this.autoplayNext()), | 517 | next: () => this.zone.run(() => this.autoplayNext()), |
523 | condition: () => { | 518 | condition: () => { |
@@ -781,22 +776,22 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
781 | private initHotkeys () { | 776 | private initHotkeys () { |
782 | this.hotkeys = [ | 777 | this.hotkeys = [ |
783 | // These hotkeys are managed by the player | 778 | // These hotkeys are managed by the player |
784 | new Hotkey('f', e => e, undefined, this.i18n('Enter/exit fullscreen (requires player focus)')), | 779 | new Hotkey('f', e => e, undefined, $localize`Enter/exit fullscreen (requires player focus)`), |
785 | new Hotkey('space', e => e, undefined, this.i18n('Play/Pause the video (requires player focus)')), | 780 | new Hotkey('space', e => e, undefined, $localize`Play/Pause the video (requires player focus)`), |
786 | new Hotkey('m', e => e, undefined, this.i18n('Mute/unmute the video (requires player focus)')), | 781 | new Hotkey('m', e => e, undefined, $localize`Mute/unmute the video (requires player focus)`), |
787 | 782 | ||
788 | new Hotkey('0-9', e => e, undefined, this.i18n('Skip to a percentage of the video: 0 is 0% and 9 is 90% (requires player focus)')), | 783 | new Hotkey('0-9', e => e, undefined, $localize`Skip to a percentage of the video: 0 is 0% and 9 is 90% (requires player focus)`), |
789 | 784 | ||
790 | new Hotkey('up', e => e, undefined, this.i18n('Increase the volume (requires player focus)')), | 785 | new Hotkey('up', e => e, undefined, $localize`Increase the volume (requires player focus)`), |
791 | new Hotkey('down', e => e, undefined, this.i18n('Decrease the volume (requires player focus)')), | 786 | new Hotkey('down', e => e, undefined, $localize`Decrease the volume (requires player focus)`), |
792 | 787 | ||
793 | new Hotkey('right', e => e, undefined, this.i18n('Seek the video forward (requires player focus)')), | 788 | new Hotkey('right', e => e, undefined, $localize`Seek the video forward (requires player focus)`), |
794 | new Hotkey('left', e => e, undefined, this.i18n('Seek the video backward (requires player focus)')), | 789 | new Hotkey('left', e => e, undefined, $localize`Seek the video backward (requires player focus)`), |
795 | 790 | ||
796 | new Hotkey('>', e => e, undefined, this.i18n('Increase playback rate (requires player focus)')), | 791 | new Hotkey('>', e => e, undefined, $localize`Increase playback rate (requires player focus)`), |
797 | new Hotkey('<', e => e, undefined, this.i18n('Decrease playback rate (requires player focus)')), | 792 | new Hotkey('<', e => e, undefined, $localize`Decrease playback rate (requires player focus)`), |
798 | 793 | ||
799 | new Hotkey('.', e => e, undefined, this.i18n('Navigate in the video frame by frame (requires player focus)')) | 794 | new Hotkey('.', e => e, undefined, $localize`Navigate in the video frame by frame (requires player focus)`) |
800 | ] | 795 | ] |
801 | 796 | ||
802 | if (this.isUserLoggedIn()) { | 797 | if (this.isUserLoggedIn()) { |
@@ -804,17 +799,17 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
804 | new Hotkey('shift+l', () => { | 799 | new Hotkey('shift+l', () => { |
805 | this.setLike() | 800 | this.setLike() |
806 | return false | 801 | return false |
807 | }, undefined, this.i18n('Like the video')), | 802 | }, undefined, $localize`Like the video`), |
808 | 803 | ||
809 | new Hotkey('shift+d', () => { | 804 | new Hotkey('shift+d', () => { |
810 | this.setDislike() | 805 | this.setDislike() |
811 | return false | 806 | return false |
812 | }, undefined, this.i18n('Dislike the video')), | 807 | }, undefined, $localize`Dislike the video`), |
813 | 808 | ||
814 | new Hotkey('shift+s', () => { | 809 | new Hotkey('shift+s', () => { |
815 | this.subscribeButton.subscribed ? this.subscribeButton.unsubscribe() : this.subscribeButton.subscribe() | 810 | this.subscribeButton.subscribed ? this.subscribeButton.unsubscribe() : this.subscribeButton.subscribe() |
816 | return false | 811 | return false |
817 | }, undefined, this.i18n('Subscribe to the account')) | 812 | }, undefined, $localize`Subscribe to the account`) |
818 | ]) | 813 | ]) |
819 | } | 814 | } |
820 | 815 | ||
diff --git a/client/src/app/+videos/video-list/video-local.component.ts b/client/src/app/+videos/video-list/video-local.component.ts index b4c71ac49..07063d4d4 100644 --- a/client/src/app/+videos/video-list/video-local.component.ts +++ b/client/src/app/+videos/video-list/video-local.component.ts | |||
@@ -5,7 +5,6 @@ import { HooksService } from '@app/core/plugins/hooks.service' | |||
5 | import { immutableAssign } from '@app/helpers' | 5 | import { immutableAssign } from '@app/helpers' |
6 | import { VideoService } from '@app/shared/shared-main' | 6 | import { VideoService } from '@app/shared/shared-main' |
7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' | 7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' |
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { UserRight, VideoFilter, VideoSortField } from '@shared/models' | 8 | import { UserRight, VideoFilter, VideoSortField } from '@shared/models' |
10 | 9 | ||
11 | @Component({ | 10 | @Component({ |
@@ -21,7 +20,6 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On | |||
21 | useUserVideoPreferences = true | 20 | useUserVideoPreferences = true |
22 | 21 | ||
23 | constructor ( | 22 | constructor ( |
24 | protected i18n: I18n, | ||
25 | protected router: Router, | 23 | protected router: Router, |
26 | protected serverService: ServerService, | 24 | protected serverService: ServerService, |
27 | protected route: ActivatedRoute, | 25 | protected route: ActivatedRoute, |
@@ -35,7 +33,7 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, On | |||
35 | ) { | 33 | ) { |
36 | super() | 34 | super() |
37 | 35 | ||
38 | this.titlePage = i18n('Local videos') | 36 | this.titlePage = $localize`Local videos` |
39 | } | 37 | } |
40 | 38 | ||
41 | ngOnInit () { | 39 | ngOnInit () { |
diff --git a/client/src/app/+videos/video-list/video-most-liked.component.ts b/client/src/app/+videos/video-list/video-most-liked.component.ts index ca14851bb..e5f7bd152 100644 --- a/client/src/app/+videos/video-list/video-most-liked.component.ts +++ b/client/src/app/+videos/video-list/video-most-liked.component.ts | |||
@@ -5,7 +5,6 @@ import { HooksService } from '@app/core/plugins/hooks.service' | |||
5 | import { immutableAssign } from '@app/helpers' | 5 | import { immutableAssign } from '@app/helpers' |
6 | import { VideoService } from '@app/shared/shared-main' | 6 | import { VideoService } from '@app/shared/shared-main' |
7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' | 7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' |
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { VideoSortField } from '@shared/models' | 8 | import { VideoSortField } from '@shared/models' |
10 | 9 | ||
11 | @Component({ | 10 | @Component({ |
@@ -20,7 +19,6 @@ export class VideoMostLikedComponent extends AbstractVideoList implements OnInit | |||
20 | useUserVideoPreferences = true | 19 | useUserVideoPreferences = true |
21 | 20 | ||
22 | constructor ( | 21 | constructor ( |
23 | protected i18n: I18n, | ||
24 | protected router: Router, | 22 | protected router: Router, |
25 | protected serverService: ServerService, | 23 | protected serverService: ServerService, |
26 | protected route: ActivatedRoute, | 24 | protected route: ActivatedRoute, |
@@ -40,8 +38,8 @@ export class VideoMostLikedComponent extends AbstractVideoList implements OnInit | |||
40 | 38 | ||
41 | this.generateSyndicationList() | 39 | this.generateSyndicationList() |
42 | 40 | ||
43 | this.titlePage = this.i18n('Most liked videos') | 41 | this.titlePage = $localize`Most liked videos` |
44 | this.titleTooltip = this.i18n('Videos that have the higher number of likes.') | 42 | this.titleTooltip = $localize`Videos that have the higher number of likes.` |
45 | } | 43 | } |
46 | 44 | ||
47 | getVideosObservable (page: number) { | 45 | getVideosObservable (page: number) { |
diff --git a/client/src/app/+videos/video-list/video-recently-added.component.ts b/client/src/app/+videos/video-list/video-recently-added.component.ts index c9395133f..34db6aabd 100644 --- a/client/src/app/+videos/video-list/video-recently-added.component.ts +++ b/client/src/app/+videos/video-list/video-recently-added.component.ts | |||
@@ -5,7 +5,6 @@ import { HooksService } from '@app/core/plugins/hooks.service' | |||
5 | import { immutableAssign } from '@app/helpers' | 5 | import { immutableAssign } from '@app/helpers' |
6 | import { VideoService } from '@app/shared/shared-main' | 6 | import { VideoService } from '@app/shared/shared-main' |
7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' | 7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' |
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { VideoSortField } from '@shared/models' | 8 | import { VideoSortField } from '@shared/models' |
10 | 9 | ||
11 | @Component({ | 10 | @Component({ |
@@ -21,7 +20,6 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On | |||
21 | useUserVideoPreferences = true | 20 | useUserVideoPreferences = true |
22 | 21 | ||
23 | constructor ( | 22 | constructor ( |
24 | protected i18n: I18n, | ||
25 | protected route: ActivatedRoute, | 23 | protected route: ActivatedRoute, |
26 | protected serverService: ServerService, | 24 | protected serverService: ServerService, |
27 | protected router: Router, | 25 | protected router: Router, |
@@ -35,7 +33,7 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements On | |||
35 | ) { | 33 | ) { |
36 | super() | 34 | super() |
37 | 35 | ||
38 | this.titlePage = i18n('Recently added') | 36 | this.titlePage = $localize`Recently added` |
39 | } | 37 | } |
40 | 38 | ||
41 | ngOnInit () { | 39 | ngOnInit () { |
diff --git a/client/src/app/+videos/video-list/video-trending.component.ts b/client/src/app/+videos/video-list/video-trending.component.ts index 10eab18de..babcb9067 100644 --- a/client/src/app/+videos/video-list/video-trending.component.ts +++ b/client/src/app/+videos/video-list/video-trending.component.ts | |||
@@ -5,7 +5,6 @@ import { HooksService } from '@app/core/plugins/hooks.service' | |||
5 | import { immutableAssign } from '@app/helpers' | 5 | import { immutableAssign } from '@app/helpers' |
6 | import { VideoService } from '@app/shared/shared-main' | 6 | import { VideoService } from '@app/shared/shared-main' |
7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' | 7 | import { AbstractVideoList } from '@app/shared/shared-video-miniature' |
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { VideoSortField } from '@shared/models' | 8 | import { VideoSortField } from '@shared/models' |
10 | 9 | ||
11 | @Component({ | 10 | @Component({ |
@@ -20,7 +19,6 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, | |||
20 | useUserVideoPreferences = true | 19 | useUserVideoPreferences = true |
21 | 20 | ||
22 | constructor ( | 21 | constructor ( |
23 | protected i18n: I18n, | ||
24 | protected router: Router, | 22 | protected router: Router, |
25 | protected serverService: ServerService, | 23 | protected serverService: ServerService, |
26 | protected route: ActivatedRoute, | 24 | protected route: ActivatedRoute, |
@@ -45,14 +43,11 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit, | |||
45 | const trendingDays = config.trending.videos.intervalDays | 43 | const trendingDays = config.trending.videos.intervalDays |
46 | 44 | ||
47 | if (trendingDays === 1) { | 45 | if (trendingDays === 1) { |
48 | this.titlePage = this.i18n('Trending for the last 24 hours') | 46 | this.titlePage = $localize`Trending for the last 24 hours` |
49 | this.titleTooltip = this.i18n('Trending videos are those totalizing the greatest number of views during the last 24 hours') | 47 | this.titleTooltip = $localize`Trending videos are those totalizing the greatest number of views during the last 24 hours` |
50 | } else { | 48 | } else { |
51 | this.titlePage = this.i18n('Trending for the last {{days}} days', { days: trendingDays }) | 49 | this.titlePage = `Trending for the last ${trendingDays} days` |
52 | this.titleTooltip = this.i18n( | 50 | this.titleTooltip = `Trending videos are those totalizing the greatest number of views during the last ${trendingDays} days` |
53 | 'Trending videos are those totalizing the greatest number of views during the last {{days}} days', | ||
54 | { days: trendingDays } | ||
55 | ) | ||
56 | } | 51 | } |
57 | }) | 52 | }) |
58 | } | 53 | } |
diff --git a/client/src/app/+videos/video-list/video-user-subscriptions.component.ts b/client/src/app/+videos/video-list/video-user-subscriptions.component.ts index 41ad9b277..b02988169 100644 --- a/client/src/app/+videos/video-list/video-user-subscriptions.component.ts +++ b/client/src/app/+videos/video-list/video-user-subscriptions.component.ts | |||
@@ -3,10 +3,8 @@ import { ActivatedRoute, Router } from '@angular/router' | |||
3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' | 3 | import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core' |
4 | import { HooksService } from '@app/core/plugins/hooks.service' | 4 | import { HooksService } from '@app/core/plugins/hooks.service' |
5 | import { immutableAssign } from '@app/helpers' | 5 | import { immutableAssign } from '@app/helpers' |
6 | import { VideoService } from '@app/shared/shared-main' | ||
7 | import { UserSubscriptionService } from '@app/shared/shared-user-subscription' | 6 | import { UserSubscriptionService } from '@app/shared/shared-user-subscription' |
8 | import { AbstractVideoList, OwnerDisplayType } from '@app/shared/shared-video-miniature' | 7 | import { AbstractVideoList, OwnerDisplayType } from '@app/shared/shared-video-miniature' |
9 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
10 | import { VideoSortField } from '@shared/models' | 8 | import { VideoSortField } from '@shared/models' |
11 | 9 | ||
12 | @Component({ | 10 | @Component({ |
@@ -21,7 +19,6 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement | |||
21 | groupByDate = true | 19 | groupByDate = true |
22 | 20 | ||
23 | constructor ( | 21 | constructor ( |
24 | protected i18n: I18n, | ||
25 | protected router: Router, | 22 | protected router: Router, |
26 | protected serverService: ServerService, | 23 | protected serverService: ServerService, |
27 | protected route: ActivatedRoute, | 24 | protected route: ActivatedRoute, |
@@ -31,15 +28,14 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement | |||
31 | protected screenService: ScreenService, | 28 | protected screenService: ScreenService, |
32 | protected storageService: LocalStorageService, | 29 | protected storageService: LocalStorageService, |
33 | private userSubscription: UserSubscriptionService, | 30 | private userSubscription: UserSubscriptionService, |
34 | private videoService: VideoService, | ||
35 | private hooks: HooksService | 31 | private hooks: HooksService |
36 | ) { | 32 | ) { |
37 | super() | 33 | super() |
38 | 34 | ||
39 | this.titlePage = i18n('Videos from your subscriptions') | 35 | this.titlePage = $localize`Videos from your subscriptions` |
40 | this.actions.push({ | 36 | this.actions.push({ |
41 | routerLink: '/my-account/subscriptions', | 37 | routerLink: '/my-account/subscriptions', |
42 | label: i18n('Subscriptions'), | 38 | label: $localize`Subscriptions`, |
43 | iconName: 'cog' | 39 | iconName: 'cog' |
44 | }) | 40 | }) |
45 | } | 41 | } |