From b1d40cff89f7cff565a98cdbcea9a624196a169a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 4 Jun 2018 16:21:17 +0200 Subject: Add i18n attributes --- .../+video-edit/shared/video-edit.component.html | 36 ++++++++++----------- .../+video-edit/shared/video-image.component.html | 2 +- .../videos/+video-edit/video-add.component.html | 14 ++++---- .../app/videos/+video-edit/video-add.component.ts | 37 ++++++++++++---------- .../videos/+video-edit/video-update.component.html | 4 +-- .../videos/+video-edit/video-update.component.ts | 10 +++--- 6 files changed, 55 insertions(+), 48 deletions(-) (limited to 'client/src/app/videos/+video-edit') diff --git a/client/src/app/videos/+video-edit/shared/video-edit.component.html b/client/src/app/videos/+video-edit/shared/video-edit.component.html index 7e1be4467..bd9f69362 100644 --- a/client/src/app/videos/+video-edit/shared/video-edit.component.html +++ b/client/src/app/videos/+video-edit/shared/video-edit.component.html @@ -4,7 +4,7 @@
- +
{{ formErrors.name }} @@ -12,7 +12,7 @@
- (press Enter to add) + (press Enter to add)
- - + +
@@ -32,7 +32,7 @@
- +
@@ -55,7 +55,7 @@
- +
@@ -83,7 +83,7 @@
- +
- - + +
- +
@@ -116,24 +116,24 @@
- - + +
{{ formErrors.support }} diff --git a/client/src/app/videos/+video-edit/shared/video-image.component.html b/client/src/app/videos/+video-edit/shared/video-image.component.html index 5d0624f8c..e319d7ee7 100644 --- a/client/src/app/videos/+video-edit/shared/video-image.component.html +++ b/client/src/app/videos/+video-edit/shared/video-image.component.html @@ -8,7 +8,7 @@ (change)="fileChange($event)" />
-
(extensions: {{ videoImageExtensions }}, max size: {{ maxVideoImageSize | bytes }})
+
(extensions: {{ videoImageExtensions }}, max size: {{ maxVideoImageSize | bytes }})
diff --git a/client/src/app/videos/+video-edit/video-add.component.html b/client/src/app/videos/+video-edit/video-add.component.html index 440556562..f00cfe016 100644 --- a/client/src/app/videos/+video-edit/video-add.component.html +++ b/client/src/app/videos/+video-edit/video-add.component.html @@ -1,7 +1,7 @@
- Upload your video - Upload {{ videoFileName }} + Upload your video + Upload {{ videoFileName }}
@@ -9,12 +9,12 @@
- Select the file to upload + Select the file to upload
- +
@@ -49,14 +49,14 @@ >
-
Publish will be available when upload is finished
+
Publish will be available when upload is finished
- +
diff --git a/client/src/app/videos/+video-edit/video-add.component.ts b/client/src/app/videos/+video-edit/video-add.component.ts index 997f033b7..a615fd92c 100644 --- a/client/src/app/videos/+video-edit/video-add.component.ts +++ b/client/src/app/videos/+video-edit/video-add.component.ts @@ -15,6 +15,7 @@ import { ValidatorMessage } from '../../shared/forms/form-validators/validator-m import { populateAsyncUserVideoChannels } from '../../shared/misc/utils' import { VideoEdit } from '../../shared/video/video-edit.model' import { VideoService } from '../../shared/video/video.service' +import { I18n } from '@ngx-translate/i18n-polyfill' @Component({ selector: 'my-videos-add', @@ -56,7 +57,8 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy private userService: UserService, private serverService: ServerService, private videoService: VideoService, - private loadingBar: LoadingBarService + private loadingBar: LoadingBarService, + private i18n: I18n ) { super() } @@ -99,10 +101,11 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy let text = '' if (this.videoUploaded === true) { - text = 'Your video was uploaded in your account and is private.' + - ' But associated data (tags, description...) will be lost, are you sure you want to leave this page?' + // FIXME: cannot concatenate strings inside i18n service :/ + text = this.i18n('Your video was uploaded in your account and is private.') + + this.i18n('But associated data (tags, description...) will be lost, are you sure you want to leave this page?') } else { - text = 'Your video is not uploaded yet, are you sure you want to leave this page?' + text = this.i18n('Your video is not uploaded yet, are you sure you want to leave this page?') } return { @@ -127,7 +130,7 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy this.isUploadingVideo = false this.videoUploadPercents = 0 this.videoUploadObservable = null - this.notificationsService.info('Info', 'Upload cancelled') + this.notificationsService.info(this.i18n('Info'), this.i18n('Upload cancelled')) } } @@ -137,7 +140,7 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy // Cannot upload videos > 4GB for now if (videofile.size > 4 * 1024 * 1024 * 1024) { - this.notificationsService.error('Error', 'We are sorry but PeerTube cannot handle videos > 4GB') + this.notificationsService.error(this.i18n('Error'), this.i18n('We are sorry but PeerTube cannot handle videos > 4GB')) return } @@ -145,11 +148,15 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy if (videoQuota !== -1 && (this.userVideoQuotaUsed + videofile.size) > videoQuota) { const bytePipes = new BytesPipe() - const msg = 'Your video quota is exceeded with this video ' + - `(video size: ${bytePipes.transform(videofile.size, 0)}, ` + - `used: ${bytePipes.transform(this.userVideoQuotaUsed, 0)}, ` + - `quota: ${bytePipes.transform(videoQuota, 0)})` - this.notificationsService.error('Error', msg) + const msg = this.i18n( + 'Your video quota is exceeded with this video (video size: {{ videoSize }}, used: {{ videoQuotaUsed }}, quota: {{ videoQuota }})', + { + videoSize: bytePipes.transform(videofile.size, 0), + videoQuotaUsed: bytePipes.transform(this.userVideoQuotaUsed, 0), + videoQuota: bytePipes.transform(videoQuota, 0) + } + ) + this.notificationsService.error(this.i18n('Error'), msg) return } @@ -192,8 +199,6 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy if (event.type === HttpEventType.UploadProgress) { this.videoUploadPercents = Math.round(100 * event.loaded / event.total) } else if (event instanceof HttpResponse) { - console.log('Video uploaded.') - this.videoUploaded = true this.videoUploadedIds = event.body.video @@ -207,7 +212,7 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy this.isUploadingVideo = false this.videoUploadPercents = 0 this.videoUploadObservable = null - this.notificationsService.error('Error', err.message) + this.notificationsService.error(this.i18n('Error'), err.message) } ) } @@ -231,13 +236,13 @@ export class VideoAddComponent extends FormReactive implements OnInit, OnDestroy this.isUploadingVideo = false this.loadingBar.complete() - this.notificationsService.success('Success', 'Video published.') + this.notificationsService.success(this.i18n('Success'), this.i18n('Video published.')) this.router.navigate([ '/videos/watch', video.uuid ]) }, err => { this.isUpdatingVideo = false - this.notificationsService.error('Error', err.message) + this.notificationsService.error(this.i18n('Error'), err.message) console.error(err) } ) diff --git a/client/src/app/videos/+video-edit/video-update.component.html b/client/src/app/videos/+video-edit/video-update.component.html index a1b4707be..73b2bc08f 100644 --- a/client/src/app/videos/+video-edit/video-update.component.html +++ b/client/src/app/videos/+video-edit/video-update.component.html @@ -1,5 +1,5 @@
-
+
Update {{ video?.name }}
@@ -13,7 +13,7 @@
- +
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 310285f92..e37dd526f 100644 --- a/client/src/app/videos/+video-edit/video-update.component.ts +++ b/client/src/app/videos/+video-edit/video-update.component.ts @@ -12,6 +12,7 @@ import { ValidatorMessage } from '../../shared/forms/form-validators/validator-m import { VideoEdit } from '../../shared/video/video-edit.model' import { VideoService } from '../../shared/video/video.service' import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' +import { I18n } from '@ngx-translate/i18n-polyfill' @Component({ selector: 'my-videos-update', @@ -37,7 +38,8 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { private videoService: VideoService, private authService: AuthService, private loadingBar: LoadingBarService, - private videoChannelService: VideoChannelService + private videoChannelService: VideoChannelService, + private i18n: I18n ) { super() } @@ -91,7 +93,7 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { err => { console.error(err) - this.notificationsService.error('Error', err.message) + this.notificationsService.error(this.i18n('Error'), err.message) } ) } @@ -116,13 +118,13 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { () => { this.isUpdatingVideo = false this.loadingBar.complete() - this.notificationsService.success('Success', 'Video updated.') + this.notificationsService.success(this.i18n('Success'), this.i18n('Video updated.')) this.router.navigate([ '/videos/watch', this.video.uuid ]) }, err => { this.isUpdatingVideo = false - this.notificationsService.error('Error', err.message) + this.notificationsService.error(this.i18n('Error'), err.message) console.error(err) } ) -- cgit v1.2.3