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/shared/shared-forms/form-validators/video-comment-validators.service.ts | |
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/shared/shared-forms/form-validators/video-comment-validators.service.ts')
-rw-r--r-- | client/src/app/shared/shared-forms/form-validators/video-comment-validators.service.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/client/src/app/shared/shared-forms/form-validators/video-comment-validators.service.ts b/client/src/app/shared/shared-forms/form-validators/video-comment-validators.service.ts index 97c8e967e..18e7ae264 100644 --- a/client/src/app/shared/shared-forms/form-validators/video-comment-validators.service.ts +++ b/client/src/app/shared/shared-forms/form-validators/video-comment-validators.service.ts | |||
@@ -1,19 +1,18 @@ | |||
1 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
2 | import { Validators } from '@angular/forms' | ||
3 | import { Injectable } from '@angular/core' | 1 | import { Injectable } from '@angular/core' |
2 | import { Validators } from '@angular/forms' | ||
4 | import { BuildFormValidator } from './form-validator.service' | 3 | import { BuildFormValidator } from './form-validator.service' |
5 | 4 | ||
6 | @Injectable() | 5 | @Injectable() |
7 | export class VideoCommentValidatorsService { | 6 | export class VideoCommentValidatorsService { |
8 | readonly VIDEO_COMMENT_TEXT: BuildFormValidator | 7 | readonly VIDEO_COMMENT_TEXT: BuildFormValidator |
9 | 8 | ||
10 | constructor (private i18n: I18n) { | 9 | constructor () { |
11 | this.VIDEO_COMMENT_TEXT = { | 10 | this.VIDEO_COMMENT_TEXT = { |
12 | VALIDATORS: [ Validators.required, Validators.minLength(1), Validators.maxLength(3000) ], | 11 | VALIDATORS: [ Validators.required, Validators.minLength(1), Validators.maxLength(3000) ], |
13 | MESSAGES: { | 12 | MESSAGES: { |
14 | 'required': this.i18n('Comment is required.'), | 13 | 'required': $localize`Comment is required.`, |
15 | 'minlength': this.i18n('Comment must be at least 2 characters long.'), | 14 | 'minlength': $localize`Comment must be at least 2 characters long.`, |
16 | 'maxlength': this.i18n('Comment cannot be more than 3000 characters long.') | 15 | 'maxlength': $localize`Comment cannot be more than 3000 characters long.` |
17 | } | 16 | } |
18 | } | 17 | } |
19 | } | 18 | } |