diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-05 15:01:45 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-05 15:02:27 +0200 |
commit | e309822b93d9b69f30cbe830ef3d09dfdb2c13b2 (patch) | |
tree | 41dbc3b3108ced7fdba4062974e568695c30e486 /client/src/app/shared/forms/form-validators/video-comment-validators.service.ts | |
parent | d4d5853e65e584ca51c718f8df590b987f981047 (diff) | |
download | PeerTube-e309822b93d9b69f30cbe830ef3d09dfdb2c13b2.tar.gz PeerTube-e309822b93d9b69f30cbe830ef3d09dfdb2c13b2.tar.zst PeerTube-e309822b93d9b69f30cbe830ef3d09dfdb2c13b2.zip |
Add form validator translations
Diffstat (limited to 'client/src/app/shared/forms/form-validators/video-comment-validators.service.ts')
-rw-r--r-- | client/src/app/shared/forms/form-validators/video-comment-validators.service.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/client/src/app/shared/forms/form-validators/video-comment-validators.service.ts b/client/src/app/shared/forms/form-validators/video-comment-validators.service.ts new file mode 100644 index 000000000..45c7081ef --- /dev/null +++ b/client/src/app/shared/forms/form-validators/video-comment-validators.service.ts | |||
@@ -0,0 +1,20 @@ | |||
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 VideoCommentValidatorsService { | ||
8 | readonly VIDEO_COMMENT_TEXT: BuildFormValidator | ||
9 | |||
10 | constructor (private i18n: I18n) { | ||
11 | this.VIDEO_COMMENT_TEXT = { | ||
12 | VALIDATORS: [ Validators.required, Validators.minLength(1), Validators.maxLength(3000) ], | ||
13 | MESSAGES: { | ||
14 | 'required': this.i18n('Comment is required.'), | ||
15 | 'minlength': this.i18n('Comment must be at least 2 characters long.'), | ||
16 | 'maxlength': this.i18n('Comment cannot be more than 3000 characters long.') | ||
17 | } | ||
18 | } | ||
19 | } | ||
20 | } | ||