diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-05 15:01:45 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-05 15:02:27 +0200 |
commit | e309822b93d9b69f30cbe830ef3d09dfdb2c13b2 (patch) | |
tree | 41dbc3b3108ced7fdba4062974e568695c30e486 /client/src/app/+admin/config/edit-custom-config | |
parent | d4d5853e65e584ca51c718f8df590b987f981047 (diff) | |
download | PeerTube-e309822b93d9b69f30cbe830ef3d09dfdb2c13b2.tar.gz PeerTube-e309822b93d9b69f30cbe830ef3d09dfdb2c13b2.tar.zst PeerTube-e309822b93d9b69f30cbe830ef3d09dfdb2c13b2.zip |
Add form validator translations
Diffstat (limited to 'client/src/app/+admin/config/edit-custom-config')
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.html | 2 | ||||
-rw-r--r-- | client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | 38 |
2 files changed, 15 insertions, 25 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 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { FormBuilder, FormGroup } from '@angular/forms' | ||
3 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
4 | import { ConfigService } from '@app/+admin/config/shared/config.service' | 3 | import { ConfigService } from '@app/+admin/config/shared/config.service' |
5 | import { ConfirmService } from '@app/core' | 4 | import { ConfirmService } from '@app/core' |
6 | import { ServerService } from '@app/core/server/server.service' | 5 | import { ServerService } from '@app/core/server/server.service' |
7 | import { FormReactive, USER_VIDEO_QUOTA } from '@app/shared' | 6 | import { CustomConfigValidatorsService, FormReactive, UserValidatorsService } from '@app/shared' |
8 | import { | ||
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' | ||
17 | import { NotificationsService } from 'angular2-notifications' | 7 | import { NotificationsService } from 'angular2-notifications' |
18 | import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model' | 8 | import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model' |
19 | import { I18n } from '@ngx-translate/i18n-polyfill' | 9 | import { 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 |