]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-user-settings/user-video-settings.component.ts
Migrate to $localize
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-user-settings / user-video-settings.component.ts
index eb340e24dfcb904638723f12079a9ccaf96b4631..ab77f6f9c3c9ba0eabd519d2e34d4e1113996830 100644 (file)
@@ -4,7 +4,6 @@ import { first } from 'rxjs/operators'
 import { Component, Input, OnDestroy, OnInit } from '@angular/core'
 import { AuthService, Notifier, ServerService, User, UserService } from '@app/core'
 import { FormReactive, FormValidatorService, ItemSelectCheckboxValue, SelectOptionsItem } from '@app/shared/shared-forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
 import { UserUpdateMe } from '@shared/models'
 import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type'
 
@@ -30,14 +29,13 @@ export class UserVideoSettingsComponent extends FormReactive implements OnInit,
     private authService: AuthService,
     private notifier: Notifier,
     private userService: UserService,
-    private serverService: ServerService,
-    private i18n: I18n
+    private serverService: ServerService
   ) {
     super()
   }
 
   ngOnInit () {
-    this.allLanguagesGroup = this.i18n('All languages')
+    this.allLanguagesGroup = $localize`All languages`
 
     let oldForm: any
 
@@ -56,7 +54,7 @@ export class UserVideoSettingsComponent extends FormReactive implements OnInit,
     ]).subscribe(([ languages, config ]) => {
       const group = this.allLanguagesGroup
 
-      this.languageItems = [ { label: this.i18n('Unknown language'), id: '_unknown', group } ]
+      this.languageItems = [ { label: $localize`Unknown language`, id: '_unknown', group } ]
       this.languageItems = this.languageItems
                                .concat(languages.map(l => ({ label: l.label, id: l.id, group })))
 
@@ -101,12 +99,12 @@ export class UserVideoSettingsComponent extends FormReactive implements OnInit,
 
     if (Array.isArray(videoLanguages)) {
       if (videoLanguages.length > 20) {
-        this.notifier.error(this.i18n('Too many languages are enabled. Please enable them all or stay below 20 enabled languages.'))
+        this.notifier.error($localize`Too many languages are enabled. Please enable them all or stay below 20 enabled languages.`)
         return
       }
 
       if (videoLanguages.length === 0) {
-        this.notifier.error(this.i18n('You need to enable at least 1 video language.'))
+        this.notifier.error($localize`You need to enable at least 1 video language.`)
         return
       }
 
@@ -133,22 +131,14 @@ export class UserVideoSettingsComponent extends FormReactive implements OnInit,
         () => {
           this.authService.refreshUserInformation()
 
-          if (this.notifyOnUpdate) this.notifier.success(this.i18n('Video settings updated.'))
+          if (this.notifyOnUpdate) this.notifier.success($localize`Video settings updated.`)
         },
 
         err => this.notifier.error(err.message)
       )
     } else {
       this.userService.updateMyAnonymousProfile(details)
-      if (this.notifyOnUpdate) this.notifier.success(this.i18n('Display/Video settings updated.'))
+      if (this.notifyOnUpdate) this.notifier.success($localize`Display/Video settings updated.`)
     }
   }
-
-  getDefaultVideoLanguageLabel () {
-    return this.i18n('No language')
-  }
-
-  getSelectedVideoLanguageLabel () {
-    return this.i18n('{{\'{0} languages selected')
-  }
 }