aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/follows/following-add
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/follows/following-add
parent989e526abf0c0dd7958deb630df009608561bb67 (diff)
downloadPeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.gz
PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.zst
PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.zip
Add i18n attributes
Diffstat (limited to 'client/src/app/+admin/follows/following-add')
-rw-r--r--client/src/app/+admin/follows/following-add/following-add.component.html6
-rw-r--r--client/src/app/+admin/follows/following-add/following-add.component.ts22
2 files changed, 14 insertions, 14 deletions
diff --git a/client/src/app/+admin/follows/following-add/following-add.component.html b/client/src/app/+admin/follows/following-add/following-add.component.html
index 25bab9d0d..72635048c 100644
--- a/client/src/app/+admin/follows/following-add/following-add.component.html
+++ b/client/src/app/+admin/follows/following-add/following-add.component.html
@@ -2,7 +2,7 @@
2 2
3<form (ngSubmit)="addFollowing()"> 3<form (ngSubmit)="addFollowing()">
4 <div class="form-group"> 4 <div class="form-group">
5 <label for="hosts">1 host (without "http://") per line</label> 5 <label i18n for="hosts">1 host (without "http://") per line</label>
6 6
7 <textarea 7 <textarea
8 type="text" class="form-control" placeholder="example.com" id="hosts" name="hosts" 8 type="text" class="form-control" placeholder="example.com" id="hosts" name="hosts"
@@ -14,9 +14,9 @@
14 </div> 14 </div>
15 </div> 15 </div>
16 16
17 <div *ngIf="httpEnabled() === false" class="alert alert-warning"> 17 <div i18n *ngIf="httpEnabled() === false" class="alert alert-warning">
18 It seems that you are not on a HTTPS server. Your webserver needs to have TLS activated in order to follow servers. 18 It seems that you are not on a HTTPS server. Your webserver needs to have TLS activated in order to follow servers.
19 </div> 19 </div>
20 20
21 <input type="submit" value="Add following" [disabled]="hostsError || !hostsString" class="btn btn-default"> 21 <input type="submit" i18n-value value="Add following" [disabled]="hostsError || !hostsString" class="btn btn-default">
22</form> 22</form>
diff --git a/client/src/app/+admin/follows/following-add/following-add.component.ts b/client/src/app/+admin/follows/following-add/following-add.component.ts
index c296c8852..f197c1fe9 100644
--- a/client/src/app/+admin/follows/following-add/following-add.component.ts
+++ b/client/src/app/+admin/follows/following-add/following-add.component.ts
@@ -4,6 +4,7 @@ import { NotificationsService } from 'angular2-notifications'
4import { ConfirmService } from '../../../core' 4import { ConfirmService } from '../../../core'
5import { validateHost } from '../../../shared' 5import { validateHost } from '../../../shared'
6import { FollowService } from '../shared' 6import { FollowService } from '../shared'
7import { I18n } from '@ngx-translate/i18n-polyfill'
7 8
8@Component({ 9@Component({
9 selector: 'my-following-add', 10 selector: 'my-following-add',
@@ -19,7 +20,8 @@ export class FollowingAddComponent {
19 private router: Router, 20 private router: Router,
20 private notificationsService: NotificationsService, 21 private notificationsService: NotificationsService,
21 private confirmService: ConfirmService, 22 private confirmService: ConfirmService,
22 private followService: FollowService 23 private followService: FollowService,
24 private i18n: I18n
23 ) {} 25 ) {}
24 26
25 httpEnabled () { 27 httpEnabled () {
@@ -34,7 +36,7 @@ export class FollowingAddComponent {
34 36
35 for (const host of hosts) { 37 for (const host of hosts) {
36 if (validateHost(host) === false) { 38 if (validateHost(host) === false) {
37 newHostsErrors.push(`${host} is not valid`) 39 newHostsErrors.push(this.i18n('{{ host }} is not valid', { host }))
38 } 40 }
39 } 41 }
40 42
@@ -48,26 +50,26 @@ export class FollowingAddComponent {
48 50
49 const hosts = this.getNotEmptyHosts() 51 const hosts = this.getNotEmptyHosts()
50 if (hosts.length === 0) { 52 if (hosts.length === 0) {
51 this.error = 'You need to specify hosts to follow.' 53 this.error = this.i18n('You need to specify hosts to follow.')
52 } 54 }
53 55
54 if (!this.isHostsUnique(hosts)) { 56 if (!this.isHostsUnique(hosts)) {
55 this.error = 'Hosts need to be unique.' 57 this.error = this.i18n('Hosts need to be unique.')
56 return 58 return
57 } 59 }
58 60
59 const confirmMessage = 'If you confirm, you will send a follow request to:<br /> - ' + hosts.join('<br /> - ') 61 const confirmMessage = this.i18n('If you confirm, you will send a follow request to:<br /> - ') + hosts.join('<br /> - ')
60 const res = await this.confirmService.confirm(confirmMessage, 'Follow new server(s)') 62 const res = await this.confirmService.confirm(confirmMessage, this.i18n('Follow new server(s)'))
61 if (res === false) return 63 if (res === false) return
62 64
63 this.followService.follow(hosts).subscribe( 65 this.followService.follow(hosts).subscribe(
64 () => { 66 () => {
65 this.notificationsService.success('Success', 'Follow request(s) sent!') 67 this.notificationsService.success(this.i18n('Success'), this.i18n('Follow request(s) sent!'))
66 68
67 setTimeout(() => this.router.navigate([ '/admin/follows/following-list' ]), 500) 69 setTimeout(() => this.router.navigate([ '/admin/follows/following-list' ]), 500)
68 }, 70 },
69 71
70 err => this.notificationsService.error('Error', err.message) 72 err => this.notificationsService.error(this.i18n('Error'), err.message)
71 ) 73 )
72 } 74 }
73 75
@@ -76,10 +78,8 @@ export class FollowingAddComponent {
76 } 78 }
77 79
78 private getNotEmptyHosts () { 80 private getNotEmptyHosts () {
79 const hosts = this.hostsString 81 return this.hostsString
80 .split('\n') 82 .split('\n')
81 .filter(host => host && host.length !== 0) // Eject empty hosts 83 .filter(host => host && host.length !== 0) // Eject empty hosts
82
83 return hosts
84 } 84 }
85} 85}