aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts')
-rw-r--r--client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts48
1 files changed, 21 insertions, 27 deletions
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'
7import { FormValidatorService } from '@app/shared/shared-forms' 7import { FormValidatorService } from '@app/shared/shared-forms'
8import { BytesPipe, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' 8import { BytesPipe, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
9import { LoadingBarService } from '@ngx-loading-bar/core' 9import { LoadingBarService } from '@ngx-loading-bar/core'
10import { I18n } from '@ngx-translate/i18n-polyfill'
11import { VideoPrivacy } from '@shared/models' 10import { VideoPrivacy } from '@shared/models'
12import { VideoSend } from './video-send' 11import { 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) 266video 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) 286video 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