diff options
author | Chocobozzz <me@florianbigard.com> | 2018-07-12 19:02:00 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-07-16 11:50:08 +0200 |
commit | 40e87e9ecc54e3513fb586928330a7855eb192c6 (patch) | |
tree | af1111ecba85f9cd8286811ff332a67cf21be2f6 /client/src/app/shared/forms/form-validators | |
parent | d4557fd3ecc8d4ed4fb0e5c868929bc36c959ed2 (diff) | |
download | PeerTube-40e87e9ecc54e3513fb586928330a7855eb192c6.tar.gz PeerTube-40e87e9ecc54e3513fb586928330a7855eb192c6.tar.zst PeerTube-40e87e9ecc54e3513fb586928330a7855eb192c6.zip |
Implement captions/subtitles
Diffstat (limited to 'client/src/app/shared/forms/form-validators')
3 files changed, 38 insertions, 0 deletions
diff --git a/client/src/app/shared/forms/form-validators/custom-config-validators.service.ts b/client/src/app/shared/forms/form-validators/custom-config-validators.service.ts index 1b36bbc6b..0c2489a9d 100644 --- a/client/src/app/shared/forms/form-validators/custom-config-validators.service.ts +++ b/client/src/app/shared/forms/form-validators/custom-config-validators.service.ts | |||
@@ -9,6 +9,7 @@ export class CustomConfigValidatorsService { | |||
9 | readonly INSTANCE_SHORT_DESCRIPTION: BuildFormValidator | 9 | readonly INSTANCE_SHORT_DESCRIPTION: BuildFormValidator |
10 | readonly SERVICES_TWITTER_USERNAME: BuildFormValidator | 10 | readonly SERVICES_TWITTER_USERNAME: BuildFormValidator |
11 | readonly CACHE_PREVIEWS_SIZE: BuildFormValidator | 11 | readonly CACHE_PREVIEWS_SIZE: BuildFormValidator |
12 | readonly CACHE_CAPTIONS_SIZE: BuildFormValidator | ||
12 | readonly SIGNUP_LIMIT: BuildFormValidator | 13 | readonly SIGNUP_LIMIT: BuildFormValidator |
13 | readonly ADMIN_EMAIL: BuildFormValidator | 14 | readonly ADMIN_EMAIL: BuildFormValidator |
14 | readonly TRANSCODING_THREADS: BuildFormValidator | 15 | readonly TRANSCODING_THREADS: BuildFormValidator |
@@ -44,6 +45,15 @@ export class CustomConfigValidatorsService { | |||
44 | } | 45 | } |
45 | } | 46 | } |
46 | 47 | ||
48 | this.CACHE_CAPTIONS_SIZE = { | ||
49 | VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ], | ||
50 | MESSAGES: { | ||
51 | 'required': this.i18n('Captions cache size is required.'), | ||
52 | 'min': this.i18n('Captions cache size must be greater than 1.'), | ||
53 | 'pattern': this.i18n('Captions cache size must be a number.') | ||
54 | } | ||
55 | } | ||
56 | |||
47 | this.SIGNUP_LIMIT = { | 57 | this.SIGNUP_LIMIT = { |
48 | VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ], | 58 | VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ], |
49 | MESSAGES: { | 59 | MESSAGES: { |
diff --git a/client/src/app/shared/forms/form-validators/index.ts b/client/src/app/shared/forms/form-validators/index.ts index 487683088..60d735ef7 100644 --- a/client/src/app/shared/forms/form-validators/index.ts +++ b/client/src/app/shared/forms/form-validators/index.ts | |||
@@ -8,3 +8,4 @@ export * from './video-abuse-validators.service' | |||
8 | export * from './video-channel-validators.service' | 8 | export * from './video-channel-validators.service' |
9 | export * from './video-comment-validators.service' | 9 | export * from './video-comment-validators.service' |
10 | export * from './video-validators.service' | 10 | export * from './video-validators.service' |
11 | export * from './video-captions-validators.service' | ||
diff --git a/client/src/app/shared/forms/form-validators/video-captions-validators.service.ts b/client/src/app/shared/forms/form-validators/video-captions-validators.service.ts new file mode 100644 index 000000000..d1b4667bb --- /dev/null +++ b/client/src/app/shared/forms/form-validators/video-captions-validators.service.ts | |||
@@ -0,0 +1,27 @@ | |||
1 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
2 | import { Validators } from '@angular/forms' | ||
3 | import { Injectable } from '@angular/core' | ||
4 | import { BuildFormValidator } from '@app/shared' | ||
5 | |||
6 | @Injectable() | ||
7 | export class VideoCaptionsValidatorsService { | ||
8 | readonly VIDEO_CAPTION_LANGUAGE: BuildFormValidator | ||
9 | readonly VIDEO_CAPTION_FILE: BuildFormValidator | ||
10 | |||
11 | constructor (private i18n: I18n) { | ||
12 | |||
13 | this.VIDEO_CAPTION_LANGUAGE = { | ||
14 | VALIDATORS: [ Validators.required ], | ||
15 | MESSAGES: { | ||
16 | 'required': this.i18n('Video caption language is required.') | ||
17 | } | ||
18 | } | ||
19 | |||
20 | this.VIDEO_CAPTION_FILE = { | ||
21 | VALIDATORS: [ Validators.required ], | ||
22 | MESSAGES: { | ||
23 | 'required': this.i18n('Video caption file is required.') | ||
24 | } | ||
25 | } | ||
26 | } | ||
27 | } | ||