]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-forms/form-validators/video-channel-validators.service.ts
Migrate to $localize
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-forms / form-validators / video-channel-validators.service.ts
index bb650b149eedec8e5232519068913a3de80f7bcf..3e74441967785a37e87c1923bd2f26bcd05f470b 100644 (file)
@@ -1,6 +1,5 @@
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { Validators } from '@angular/forms'
 import { Injectable } from '@angular/core'
+import { Validators } from '@angular/forms'
 import { BuildFormValidator } from './form-validator.service'
 
 @Injectable()
@@ -10,7 +9,7 @@ export class VideoChannelValidatorsService {
   readonly VIDEO_CHANNEL_DESCRIPTION: BuildFormValidator
   readonly VIDEO_CHANNEL_SUPPORT: BuildFormValidator
 
-  constructor (private i18n: I18n) {
+  constructor () {
     this.VIDEO_CHANNEL_NAME = {
       VALIDATORS: [
         Validators.required,
@@ -19,10 +18,10 @@ export class VideoChannelValidatorsService {
         Validators.pattern(/^[a-z0-9][a-z0-9._]*$/)
       ],
       MESSAGES: {
-        'required': this.i18n('Name is required.'),
-        'minlength': this.i18n('Name must be at least 1 character long.'),
-        'maxlength': this.i18n('Name cannot be more than 50 characters long.'),
-        'pattern': this.i18n('Name should be lowercase alphanumeric; dots and underscores are allowed.')
+        'required': $localize`Name is required.`,
+        'minlength': $localize`Name must be at least 1 character long.`,
+        'maxlength': $localize`Name cannot be more than 50 characters long.`,
+        'pattern': $localize`Name should be lowercase alphanumeric; dots and underscores are allowed.`
       }
     }
 
@@ -33,9 +32,9 @@ export class VideoChannelValidatorsService {
         Validators.maxLength(50)
       ],
       MESSAGES: {
-        'required': i18n('Display name is required.'),
-        'minlength': i18n('Display name must be at least 1 character long.'),
-        'maxlength': i18n('Display name cannot be more than 50 characters long.')
+        'required': $localize`Display name is required.`,
+        'minlength': $localize`Display name must be at least 1 character long.`,
+        'maxlength': $localize`Display name cannot be more than 50 characters long.`
       }
     }
 
@@ -45,8 +44,8 @@ export class VideoChannelValidatorsService {
         Validators.maxLength(1000)
       ],
       MESSAGES: {
-        'minlength': i18n('Description must be at least 3 characters long.'),
-        'maxlength': i18n('Description cannot be more than 1000 characters long.')
+        'minlength': $localize`Description must be at least 3 characters long.`,
+        'maxlength': $localize`Description cannot be more than 1000 characters long.`
       }
     }
 
@@ -56,8 +55,8 @@ export class VideoChannelValidatorsService {
         Validators.maxLength(1000)
       ],
       MESSAGES: {
-        'minlength': i18n('Support text must be at least 3 characters long.'),
-        'maxlength': i18n('Support text cannot be more than 1000 characters long.')
+        'minlength': $localize`Support text must be at least 3 characters long.`,
+        'maxlength': $localize`Support text cannot be more than 1000 characters long`
       }
     }
   }