aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-04 16:21:17 +0200
committerChocobozzz <me@florianbigard.com>2018-06-05 08:43:01 +0200
commitb1d40cff89f7cff565a98cdbcea9a624196a169a (patch)
treed24746c1cc69f50471a9eba0dfb1c1bae06a1870 /client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts
parent989e526abf0c0dd7958deb630df009608561bb67 (diff)
downloadPeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.gz
PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.zst
PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.zip
Add i18n attributes
Diffstat (limited to 'client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts')
-rw-r--r--client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts28
1 files changed, 18 insertions, 10 deletions
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 a1e334a74..3f9205460 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
@@ -8,12 +8,15 @@ import { FormReactive, USER_VIDEO_QUOTA } from '@app/shared'
8import { 8import {
9 ADMIN_EMAIL, 9 ADMIN_EMAIL,
10 CACHE_PREVIEWS_SIZE, 10 CACHE_PREVIEWS_SIZE,
11 INSTANCE_NAME, INSTANCE_SHORT_DESCRIPTION, SERVICES_TWITTER_USERNAME, 11 INSTANCE_NAME,
12 INSTANCE_SHORT_DESCRIPTION,
13 SERVICES_TWITTER_USERNAME,
12 SIGNUP_LIMIT, 14 SIGNUP_LIMIT,
13 TRANSCODING_THREADS 15 TRANSCODING_THREADS
14} from '@app/shared/forms/form-validators/custom-config' 16} from '@app/shared/forms/form-validators/custom-config'
15import { NotificationsService } from 'angular2-notifications' 17import { NotificationsService } from 'angular2-notifications'
16import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model' 18import { CustomConfig } from '../../../../../../shared/models/server/custom-config.model'
19import { I18n } from '@ngx-translate/i18n-polyfill'
17 20
18@Component({ 21@Component({
19 selector: 'my-edit-custom-config', 22 selector: 'my-edit-custom-config',
@@ -77,7 +80,8 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
77 private notificationsService: NotificationsService, 80 private notificationsService: NotificationsService,
78 private configService: ConfigService, 81 private configService: ConfigService,
79 private serverService: ServerService, 82 private serverService: ServerService,
80 private confirmService: ConfirmService 83 private confirmService: ConfirmService,
84 private i18n: I18n
81 ) { 85 ) {
82 super() 86 super()
83 } 87 }
@@ -133,7 +137,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
133 this.forceCheck() 137 this.forceCheck()
134 }, 138 },
135 139
136 err => this.notificationsService.error('Error', err.message) 140 err => this.notificationsService.error(this.i18n('Error'), err.message)
137 ) 141 )
138 } 142 }
139 143
@@ -156,11 +160,15 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
156 if (customizations.length !== 0) { 160 if (customizations.length !== 0) {
157 const customizationsText = customizations.join('/') 161 const customizationsText = customizations.join('/')
158 162
159 const message = `You set custom ${customizationsText}. ` + 163 // FIXME: i18n service does not support string concatenation
160 'This could lead to security issues or bugs if you do not understand it. ' + 164 const message = this.i18n('You set custom {{ customizationsText }}. ', { customizationsText }) +
161 'Are you sure you want to update the configuration?' 165 this.i18n('This could lead to security issues or bugs if you do not understand it. ') +
162 const label = `Please type "I understand the ${customizationsText} I set" to confirm.` 166 this.i18n('Are you sure you want to update the configuration?')
163 const expectedInputValue = `I understand the ${customizationsText} I set` 167 const label = this.i18n(
168 'Please type "I understand the {{ customizationsText }} I set" to confirm.',
169 { customizationsText }
170 )
171 const expectedInputValue = this.i18n('I understand the {{ customizationsText }} I set', { customizationsText})
164 172
165 const confirmRes = await this.confirmService.confirmWithInput(message, label, expectedInputValue) 173 const confirmRes = await this.confirmService.confirmWithInput(message, label, expectedInputValue)
166 if (confirmRes === false) return 174 if (confirmRes === false) return
@@ -223,10 +231,10 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit {
223 231
224 this.updateForm() 232 this.updateForm()
225 233
226 this.notificationsService.success('Success', 'Configuration updated.') 234 this.notificationsService.success(this.i18n('Success'), this.i18n('Configuration updated.'))
227 }, 235 },
228 236
229 err => this.notificationsService.error('Error', err.message) 237 err => this.notificationsService.error(this.i18n('Error'), err.message)
230 ) 238 )
231 } 239 }
232 240