diff options
Diffstat (limited to 'client/src/app/shared/shared-user-settings')
-rw-r--r-- | client/src/app/shared/shared-user-settings/user-interface-settings.component.ts | 8 | ||||
-rw-r--r-- | client/src/app/shared/shared-user-settings/user-video-settings.component.ts | 24 |
2 files changed, 10 insertions, 22 deletions
diff --git a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts index 875ffa3f1..80b88c129 100644 --- a/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts +++ b/client/src/app/shared/shared-user-settings/user-interface-settings.component.ts | |||
@@ -2,7 +2,6 @@ import { Subject, Subscription } from 'rxjs' | |||
2 | import { Component, Input, OnDestroy, OnInit } from '@angular/core' | 2 | import { Component, Input, OnDestroy, OnInit } from '@angular/core' |
3 | import { AuthService, Notifier, ServerService, UserService } from '@app/core' | 3 | import { AuthService, Notifier, ServerService, UserService } from '@app/core' |
4 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 4 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | import { ServerConfig, User, UserUpdateMe } from '@shared/models' | 5 | import { ServerConfig, User, UserUpdateMe } from '@shared/models' |
7 | 6 | ||
8 | @Component({ | 7 | @Component({ |
@@ -25,8 +24,7 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn | |||
25 | private authService: AuthService, | 24 | private authService: AuthService, |
26 | private notifier: Notifier, | 25 | private notifier: Notifier, |
27 | private userService: UserService, | 26 | private userService: UserService, |
28 | private serverService: ServerService, | 27 | private serverService: ServerService |
29 | private i18n: I18n | ||
30 | ) { | 28 | ) { |
31 | super() | 29 | super() |
32 | } | 30 | } |
@@ -73,14 +71,14 @@ export class UserInterfaceSettingsComponent extends FormReactive implements OnIn | |||
73 | () => { | 71 | () => { |
74 | this.authService.refreshUserInformation() | 72 | this.authService.refreshUserInformation() |
75 | 73 | ||
76 | if (this.notifyOnUpdate) this.notifier.success(this.i18n('Interface settings updated.')) | 74 | if (this.notifyOnUpdate) this.notifier.success($localize`Interface settings updated.`) |
77 | }, | 75 | }, |
78 | 76 | ||
79 | err => this.notifier.error(err.message) | 77 | err => this.notifier.error(err.message) |
80 | ) | 78 | ) |
81 | } else { | 79 | } else { |
82 | this.userService.updateMyAnonymousProfile(details) | 80 | this.userService.updateMyAnonymousProfile(details) |
83 | if (this.notifyOnUpdate) this.notifier.success(this.i18n('Interface settings updated.')) | 81 | if (this.notifyOnUpdate) this.notifier.success($localize`Interface settings updated.`) |
84 | } | 82 | } |
85 | } | 83 | } |
86 | } | 84 | } |
diff --git a/client/src/app/shared/shared-user-settings/user-video-settings.component.ts b/client/src/app/shared/shared-user-settings/user-video-settings.component.ts index eb340e24d..ab77f6f9c 100644 --- a/client/src/app/shared/shared-user-settings/user-video-settings.component.ts +++ b/client/src/app/shared/shared-user-settings/user-video-settings.component.ts | |||
@@ -4,7 +4,6 @@ import { first } from 'rxjs/operators' | |||
4 | import { Component, Input, OnDestroy, OnInit } from '@angular/core' | 4 | import { Component, Input, OnDestroy, OnInit } from '@angular/core' |
5 | import { AuthService, Notifier, ServerService, User, UserService } from '@app/core' | 5 | import { AuthService, Notifier, ServerService, User, UserService } from '@app/core' |
6 | import { FormReactive, FormValidatorService, ItemSelectCheckboxValue, SelectOptionsItem } from '@app/shared/shared-forms' | 6 | import { FormReactive, FormValidatorService, ItemSelectCheckboxValue, SelectOptionsItem } from '@app/shared/shared-forms' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
8 | import { UserUpdateMe } from '@shared/models' | 7 | import { UserUpdateMe } from '@shared/models' |
9 | import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type' | 8 | import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type' |
10 | 9 | ||
@@ -30,14 +29,13 @@ export class UserVideoSettingsComponent extends FormReactive implements OnInit, | |||
30 | private authService: AuthService, | 29 | private authService: AuthService, |
31 | private notifier: Notifier, | 30 | private notifier: Notifier, |
32 | private userService: UserService, | 31 | private userService: UserService, |
33 | private serverService: ServerService, | 32 | private serverService: ServerService |
34 | private i18n: I18n | ||
35 | ) { | 33 | ) { |
36 | super() | 34 | super() |
37 | } | 35 | } |
38 | 36 | ||
39 | ngOnInit () { | 37 | ngOnInit () { |
40 | this.allLanguagesGroup = this.i18n('All languages') | 38 | this.allLanguagesGroup = $localize`All languages` |
41 | 39 | ||
42 | let oldForm: any | 40 | let oldForm: any |
43 | 41 | ||
@@ -56,7 +54,7 @@ export class UserVideoSettingsComponent extends FormReactive implements OnInit, | |||
56 | ]).subscribe(([ languages, config ]) => { | 54 | ]).subscribe(([ languages, config ]) => { |
57 | const group = this.allLanguagesGroup | 55 | const group = this.allLanguagesGroup |
58 | 56 | ||
59 | this.languageItems = [ { label: this.i18n('Unknown language'), id: '_unknown', group } ] | 57 | this.languageItems = [ { label: $localize`Unknown language`, id: '_unknown', group } ] |
60 | this.languageItems = this.languageItems | 58 | this.languageItems = this.languageItems |
61 | .concat(languages.map(l => ({ label: l.label, id: l.id, group }))) | 59 | .concat(languages.map(l => ({ label: l.label, id: l.id, group }))) |
62 | 60 | ||
@@ -101,12 +99,12 @@ export class UserVideoSettingsComponent extends FormReactive implements OnInit, | |||
101 | 99 | ||
102 | if (Array.isArray(videoLanguages)) { | 100 | if (Array.isArray(videoLanguages)) { |
103 | if (videoLanguages.length > 20) { | 101 | if (videoLanguages.length > 20) { |
104 | this.notifier.error(this.i18n('Too many languages are enabled. Please enable them all or stay below 20 enabled languages.')) | 102 | this.notifier.error($localize`Too many languages are enabled. Please enable them all or stay below 20 enabled languages.`) |
105 | return | 103 | return |
106 | } | 104 | } |
107 | 105 | ||
108 | if (videoLanguages.length === 0) { | 106 | if (videoLanguages.length === 0) { |
109 | this.notifier.error(this.i18n('You need to enable at least 1 video language.')) | 107 | this.notifier.error($localize`You need to enable at least 1 video language.`) |
110 | return | 108 | return |
111 | } | 109 | } |
112 | 110 | ||
@@ -133,22 +131,14 @@ export class UserVideoSettingsComponent extends FormReactive implements OnInit, | |||
133 | () => { | 131 | () => { |
134 | this.authService.refreshUserInformation() | 132 | this.authService.refreshUserInformation() |
135 | 133 | ||
136 | if (this.notifyOnUpdate) this.notifier.success(this.i18n('Video settings updated.')) | 134 | if (this.notifyOnUpdate) this.notifier.success($localize`Video settings updated.`) |
137 | }, | 135 | }, |
138 | 136 | ||
139 | err => this.notifier.error(err.message) | 137 | err => this.notifier.error(err.message) |
140 | ) | 138 | ) |
141 | } else { | 139 | } else { |
142 | this.userService.updateMyAnonymousProfile(details) | 140 | this.userService.updateMyAnonymousProfile(details) |
143 | if (this.notifyOnUpdate) this.notifier.success(this.i18n('Display/Video settings updated.')) | 141 | if (this.notifyOnUpdate) this.notifier.success($localize`Display/Video settings updated.`) |
144 | } | 142 | } |
145 | } | 143 | } |
146 | |||
147 | getDefaultVideoLanguageLabel () { | ||
148 | return this.i18n('No language') | ||
149 | } | ||
150 | |||
151 | getSelectedVideoLanguageLabel () { | ||
152 | return this.i18n('{{\'{0} languages selected') | ||
153 | } | ||
154 | } | 144 | } |