aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-05 15:01:45 +0200
committerChocobozzz <me@florianbigard.com>2018-06-05 15:02:27 +0200
commite309822b93d9b69f30cbe830ef3d09dfdb2c13b2 (patch)
tree41dbc3b3108ced7fdba4062974e568695c30e486 /client/src/app/+admin
parentd4d5853e65e584ca51c718f8df590b987f981047 (diff)
downloadPeerTube-e309822b93d9b69f30cbe830ef3d09dfdb2c13b2.tar.gz
PeerTube-e309822b93d9b69f30cbe830ef3d09dfdb2c13b2.tar.zst
PeerTube-e309822b93d9b69f30cbe830ef3d09dfdb2c13b2.zip
Add form validator translations
Diffstat (limited to 'client/src/app/+admin')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html2
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts38
-rw-r--r--client/src/app/+admin/users/user-edit/user-create.component.ts13
-rw-r--r--client/src/app/+admin/users/user-edit/user-update.component.ts10
4 files changed, 28 insertions, 35 deletions
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
index 4263b7b5f..a0bd01e5e 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html
@@ -207,7 +207,7 @@ Check this checkbox, save the configuration and test with a video URL of your in
207 <div i18n class="inner-form-title">Cache</div> 207 <div i18n class="inner-form-title">Cache</div>
208 208
209 <div class="form-group"> 209 <div class="form-group">
210 <label i18n for="cachePreviewsSize">Preview cache size</label> 210 <label i18n for="cachePreviewsSize">Previews cache size</label>
211 <my-help 211 <my-help
212 helpType="custom" i18n-customHtml 212 helpType="custom" i18n-customHtml
213 customHtml="Previews are not federated. We fetch them directly from the origin instance and cache them." 213 customHtml="Previews are not federated. We fetch them directly from the origin instance and cache them."
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
index f2a3464cb..7b3e72803 100644
--- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
+++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
@@ -1,19 +1,9 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { FormBuilder, FormGroup } from '@angular/forms'
3import { Router } from '@angular/router' 2import { Router } from '@angular/router'
4import { ConfigService } from '@app/+admin/config/shared/config.service' 3import { ConfigService } from '@app/+admin/config/shared/config.service'
5import { ConfirmService } from '@app/core' 4import { ConfirmService } from '@app/core'
6import { ServerService } from '@app/core/server/server.service' 5import { ServerService } from '@app/core/server/server.service'
7import { FormReactive, USER_VIDEO_QUOTA } from '@app/shared' 6import { CustomConfigValidatorsService, FormReactive, UserValidatorsService } from '@app/shared'
8import {
9 ADMIN_EMAIL,
10 CACHE_PREVIEWS_SIZE,
11 INSTANCE_NAME,
12 INSTANCE_SHORT_DESCRIPTION,
13 SERVICES_TWITTER_USERNAME,
14 SIGNUP_LIMIT,
15 TRANSCODING_THREADS
16} from '@app/shared/forms/form-validators/custom-config'
17import { NotificationsService } from 'angular2-notifications' 7import { NotificationsService } from 'angular2-notifications'
18import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model' 8import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model'
19import { I18n } from '@ngx-translate/i18n-polyfill' 9import { I18n } from '@ngx-translate/i18n-polyfill'
@@ -50,6 +40,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
50 40
51 constructor ( 41 constructor (
52 protected formValidatorService: FormValidatorService, 42 protected formValidatorService: FormValidatorService,
43 private customConfigValidatorsService: CustomConfigValidatorsService,
44 private userValidatorsService: UserValidatorsService,
53 private router: Router, 45 private router: Router,
54 private notificationsService: NotificationsService, 46 private notificationsService: NotificationsService,
55 private configService: ConfigService, 47 private configService: ConfigService,
@@ -66,20 +58,20 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
66 58
67 ngOnInit () { 59 ngOnInit () {
68 const formGroupData = { 60 const formGroupData = {
69 instanceName: INSTANCE_NAME, 61 instanceName: this.customConfigValidatorsService.INSTANCE_NAME,
70 instanceShortDescription: INSTANCE_SHORT_DESCRIPTION, 62 instanceShortDescription: this.customConfigValidatorsService.INSTANCE_SHORT_DESCRIPTION,
71 instanceDescription: null, 63 instanceDescription: null,
72 instanceTerms: null, 64 instanceTerms: null,
73 instanceDefaultClientRoute: null, 65 instanceDefaultClientRoute: null,
74 instanceDefaultNSFWPolicy: null, 66 instanceDefaultNSFWPolicy: null,
75 servicesTwitterUsername: SERVICES_TWITTER_USERNAME, 67 servicesTwitterUsername: this.customConfigValidatorsService.SERVICES_TWITTER_USERNAME,
76 servicesTwitterWhitelisted: null, 68 servicesTwitterWhitelisted: null,
77 cachePreviewsSize: CACHE_PREVIEWS_SIZE, 69 cachePreviewsSize: this.customConfigValidatorsService.CACHE_PREVIEWS_SIZE,
78 signupEnabled: null, 70 signupEnabled: null,
79 signupLimit: SIGNUP_LIMIT, 71 signupLimit: this.customConfigValidatorsService.SIGNUP_LIMIT,
80 adminEmail: ADMIN_EMAIL, 72 adminEmail: this.customConfigValidatorsService.ADMIN_EMAIL,
81 userVideoQuota: USER_VIDEO_QUOTA, 73 userVideoQuota: this.userValidatorsService.USER_VIDEO_QUOTA,
82 transcodingThreads: TRANSCODING_THREADS, 74 transcodingThreads: this.customConfigValidatorsService.TRANSCODING_THREADS,
83 transcodingEnabled: null, 75 transcodingEnabled: null,
84 customizationJavascript: null, 76 customizationJavascript: null,
85 customizationCSS: null 77 customizationCSS: null
@@ -134,11 +126,9 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
134 const message = this.i18n('You set custom {{customizationsText}}. ', { customizationsText }) + 126 const message = this.i18n('You set custom {{customizationsText}}. ', { customizationsText }) +
135 this.i18n('This could lead to security issues or bugs if you do not understand it. ') + 127 this.i18n('This could lead to security issues or bugs if you do not understand it. ') +
136 this.i18n('Are you sure you want to update the configuration?') 128 this.i18n('Are you sure you want to update the configuration?')
137 const label = this.i18n( 129
138 'Please type "I understand the {{customizationsText}} I set" to confirm.', 130 const label = this.i18n('Please type') + ` "I understand the ${customizationsText} I set" ` + this.i18n('to confirm.')
139 { customizationsText } 131 const expectedInputValue = `I understand the ${customizationsText} I set`
140 )
141 const expectedInputValue = this.i18n('I understand the {{customizationsText}} I set', { customizationsText })
142 132
143 const confirmRes = await this.confirmService.confirmWithInput(message, label, expectedInputValue) 133 const confirmRes = await this.confirmService.confirmWithInput(message, label, expectedInputValue)
144 if (confirmRes === false) return 134 if (confirmRes === false) return
diff --git a/client/src/app/+admin/users/user-edit/user-create.component.ts b/client/src/app/+admin/users/user-edit/user-create.component.ts
index e5f0903b6..c15cfb267 100644
--- a/client/src/app/+admin/users/user-edit/user-create.component.ts
+++ b/client/src/app/+admin/users/user-edit/user-create.component.ts
@@ -2,12 +2,12 @@ import { Component, OnInit } from '@angular/core'
2import { Router } from '@angular/router' 2import { Router } from '@angular/router'
3import { NotificationsService } from 'angular2-notifications' 3import { NotificationsService } from 'angular2-notifications'
4import { UserService } from '../shared' 4import { UserService } from '../shared'
5import { USER_EMAIL, USER_PASSWORD, USER_ROLE, USER_USERNAME, USER_VIDEO_QUOTA } from '../../../shared'
6import { ServerService } from '../../../core' 5import { ServerService } from '../../../core'
7import { UserCreate, UserRole } from '../../../../../../shared' 6import { UserCreate, UserRole } from '../../../../../../shared'
8import { UserEdit } from './user-edit' 7import { UserEdit } from './user-edit'
9import { I18n } from '@ngx-translate/i18n-polyfill' 8import { I18n } from '@ngx-translate/i18n-polyfill'
10import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 9import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
10import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service'
11 11
12@Component({ 12@Component({
13 selector: 'my-user-create', 13 selector: 'my-user-create',
@@ -20,6 +20,7 @@ export class UserCreateComponent extends UserEdit implements OnInit {
20 constructor ( 20 constructor (
21 protected serverService: ServerService, 21 protected serverService: ServerService,
22 protected formValidatorService: FormValidatorService, 22 protected formValidatorService: FormValidatorService,
23 private userValidatorsService: UserValidatorsService,
23 private router: Router, 24 private router: Router,
24 private notificationsService: NotificationsService, 25 private notificationsService: NotificationsService,
25 private userService: UserService, 26 private userService: UserService,
@@ -35,11 +36,11 @@ export class UserCreateComponent extends UserEdit implements OnInit {
35 } 36 }
36 37
37 this.buildForm({ 38 this.buildForm({
38 username: USER_USERNAME, 39 username: this.userValidatorsService.USER_USERNAME,
39 email: USER_EMAIL, 40 email: this.userValidatorsService.USER_EMAIL,
40 password: USER_PASSWORD, 41 password: this.userValidatorsService.USER_PASSWORD,
41 role: USER_ROLE, 42 role: this.userValidatorsService.USER_ROLE,
42 videoQuota: USER_VIDEO_QUOTA 43 videoQuota: this.userValidatorsService.USER_VIDEO_QUOTA
43 }, defaultValues) 44 }, defaultValues)
44 } 45 }
45 46
diff --git a/client/src/app/+admin/users/user-edit/user-update.component.ts b/client/src/app/+admin/users/user-edit/user-update.component.ts
index f8073c928..3e60991d2 100644
--- a/client/src/app/+admin/users/user-edit/user-update.component.ts
+++ b/client/src/app/+admin/users/user-edit/user-update.component.ts
@@ -3,12 +3,13 @@ import { ActivatedRoute, Router } from '@angular/router'
3import { Subscription } from 'rxjs' 3import { Subscription } from 'rxjs'
4import { NotificationsService } from 'angular2-notifications' 4import { NotificationsService } from 'angular2-notifications'
5import { UserService } from '../shared' 5import { UserService } from '../shared'
6import { User, USER_EMAIL, USER_ROLE, USER_VIDEO_QUOTA } from '../../../shared' 6import { User } from '../../../shared'
7import { ServerService } from '../../../core' 7import { ServerService } from '../../../core'
8import { UserEdit } from './user-edit' 8import { UserEdit } from './user-edit'
9import { UserUpdate } from '../../../../../../shared' 9import { UserUpdate } from '../../../../../../shared'
10import { I18n } from '@ngx-translate/i18n-polyfill' 10import { I18n } from '@ngx-translate/i18n-polyfill'
11import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' 11import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
12import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service'
12 13
13@Component({ 14@Component({
14 selector: 'my-user-update', 15 selector: 'my-user-update',
@@ -25,6 +26,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
25 constructor ( 26 constructor (
26 protected formValidatorService: FormValidatorService, 27 protected formValidatorService: FormValidatorService,
27 protected serverService: ServerService, 28 protected serverService: ServerService,
29 private userValidatorsService: UserValidatorsService,
28 private route: ActivatedRoute, 30 private route: ActivatedRoute,
29 private router: Router, 31 private router: Router,
30 private notificationsService: NotificationsService, 32 private notificationsService: NotificationsService,
@@ -37,9 +39,9 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
37 ngOnInit () { 39 ngOnInit () {
38 const defaultValues = { videoQuota: '-1' } 40 const defaultValues = { videoQuota: '-1' }
39 this.buildForm({ 41 this.buildForm({
40 email: USER_EMAIL, 42 email: this.userValidatorsService.USER_EMAIL,
41 role: USER_ROLE, 43 role: this.userValidatorsService.USER_ROLE,
42 videoQuota: USER_VIDEO_QUOTA 44 videoQuota: this.userValidatorsService.USER_VIDEO_QUOTA
43 }, defaultValues) 45 }, defaultValues)
44 46
45 this.paramsSub = this.route.params.subscribe(routeParams => { 47 this.paramsSub = this.route.params.subscribe(routeParams => {