aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/follows
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
parent989e526abf0c0dd7958deb630df009608561bb67 (diff)
downloadPeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.gz
PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.zst
PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.zip
Add i18n attributes
Diffstat (limited to 'client/src/app/+admin/follows')
-rw-r--r--client/src/app/+admin/follows/followers-list/followers-list.component.html12
-rw-r--r--client/src/app/+admin/follows/followers-list/followers-list.component.ts6
-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
-rw-r--r--client/src/app/+admin/follows/following-list/following-list.component.html8
-rw-r--r--client/src/app/+admin/follows/following-list/following-list.component.ts18
-rw-r--r--client/src/app/+admin/follows/follows.component.html2
7 files changed, 42 insertions, 32 deletions
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.html b/client/src/app/+admin/follows/followers-list/followers-list.component.html
index 85d2a2cf6..1a6ed616a 100644
--- a/client/src/app/+admin/follows/followers-list/followers-list.component.html
+++ b/client/src/app/+admin/follows/followers-list/followers-list.component.html
@@ -4,12 +4,12 @@
4> 4>
5 <ng-template pTemplate="header"> 5 <ng-template pTemplate="header">
6 <tr> 6 <tr>
7 <th style="width: 60px">ID</th> 7 <th i18n style="width: 60px">ID</th>
8 <th>Score</th> 8 <th i18n>Score</th>
9 <th>Name</th> 9 <th i18n>Name</th>
10 <th>Host</th> 10 <th i18n>Host</th>
11 <th>State</th> 11 <th i18n>State</th>
12 <th pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> 12 <th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
13 </tr> 13 </tr>
14 </ng-template> 14 </ng-template>
15 15
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts
index 69b3e5e58..96fb67588 100644
--- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts
+++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts
@@ -5,6 +5,7 @@ import { SortMeta } from 'primeng/primeng'
5import { AccountFollow } from '../../../../../../shared/models/actors/follow.model' 5import { AccountFollow } from '../../../../../../shared/models/actors/follow.model'
6import { RestPagination, RestTable } from '../../../shared' 6import { RestPagination, RestTable } from '../../../shared'
7import { FollowService } from '../shared' 7import { FollowService } from '../shared'
8import { I18n } from '@ngx-translate/i18n-polyfill'
8 9
9@Component({ 10@Component({
10 selector: 'my-followers-list', 11 selector: 'my-followers-list',
@@ -20,7 +21,8 @@ export class FollowersListComponent extends RestTable implements OnInit {
20 21
21 constructor ( 22 constructor (
22 private notificationsService: NotificationsService, 23 private notificationsService: NotificationsService,
23 private followService: FollowService 24 private followService: FollowService,
25 private i18n: I18n
24 ) { 26 ) {
25 super() 27 super()
26 } 28 }
@@ -37,7 +39,7 @@ export class FollowersListComponent extends RestTable implements OnInit {
37 this.totalRecords = resultList.total 39 this.totalRecords = resultList.total
38 }, 40 },
39 41
40 err => this.notificationsService.error('Error', err.message) 42 err => this.notificationsService.error(this.i18n('Error'), err.message)
41 ) 43 )
42 } 44 }
43} 45}
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}
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.html b/client/src/app/+admin/follows/following-list/following-list.component.html
index 24981d3e9..e4a45e88c 100644
--- a/client/src/app/+admin/follows/following-list/following-list.component.html
+++ b/client/src/app/+admin/follows/following-list/following-list.component.html
@@ -4,10 +4,10 @@
4> 4>
5 <ng-template pTemplate="header"> 5 <ng-template pTemplate="header">
6 <tr> 6 <tr>
7 <th style="width: 60px">ID</th> 7 <th i18n style="width: 60px">ID</th>
8 <th>Host</th> 8 <th i18n>Host</th>
9 <th>State</th> 9 <th i18n>State</th>
10 <th pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> 10 <th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
11 <th></th> 11 <th></th>
12 </tr> 12 </tr>
13 </ng-template> 13 </ng-template>
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts
index 873a5d965..2fb818c90 100644
--- a/client/src/app/+admin/follows/following-list/following-list.component.ts
+++ b/client/src/app/+admin/follows/following-list/following-list.component.ts
@@ -5,6 +5,7 @@ import { AccountFollow } from '../../../../../../shared/models/actors/follow.mod
5import { ConfirmService } from '../../../core/confirm/confirm.service' 5import { ConfirmService } from '../../../core/confirm/confirm.service'
6import { RestPagination, RestTable } from '../../../shared' 6import { RestPagination, RestTable } from '../../../shared'
7import { FollowService } from '../shared' 7import { FollowService } from '../shared'
8import { I18n } from '@ngx-translate/i18n-polyfill'
8 9
9@Component({ 10@Component({
10 selector: 'my-followers-list', 11 selector: 'my-followers-list',
@@ -20,7 +21,8 @@ export class FollowingListComponent extends RestTable implements OnInit {
20 constructor ( 21 constructor (
21 private notificationsService: NotificationsService, 22 private notificationsService: NotificationsService,
22 private confirmService: ConfirmService, 23 private confirmService: ConfirmService,
23 private followService: FollowService 24 private followService: FollowService,
25 private i18n: I18n
24 ) { 26 ) {
25 super() 27 super()
26 } 28 }
@@ -30,16 +32,22 @@ export class FollowingListComponent extends RestTable implements OnInit {
30 } 32 }
31 33
32 async removeFollowing (follow: AccountFollow) { 34 async removeFollowing (follow: AccountFollow) {
33 const res = await this.confirmService.confirm(`Do you really want to unfollow ${follow.following.host}?`, 'Unfollow') 35 const res = await this.confirmService.confirm(
36 this.i18n('Do you really want to unfollow {{ host }}?', { host: follow.following.host }),
37 this.i18n('Unfollow')
38 )
34 if (res === false) return 39 if (res === false) return
35 40
36 this.followService.unfollow(follow).subscribe( 41 this.followService.unfollow(follow).subscribe(
37 () => { 42 () => {
38 this.notificationsService.success('Success', `You are not following ${follow.following.host} anymore.`) 43 this.notificationsService.success(
44 this.i18n('Success'),
45 this.i18n('You are not following {{ host }} anymore.', { host: follow.following.host })
46 )
39 this.loadData() 47 this.loadData()
40 }, 48 },
41 49
42 err => this.notificationsService.error('Error', err.message) 50 err => this.notificationsService.error(this.i18n('Error'), err.message)
43 ) 51 )
44 } 52 }
45 53
@@ -51,7 +59,7 @@ export class FollowingListComponent extends RestTable implements OnInit {
51 this.totalRecords = resultList.total 59 this.totalRecords = resultList.total
52 }, 60 },
53 61
54 err => this.notificationsService.error('Error', err.message) 62 err => this.notificationsService.error(this.i18n('Error'), err.message)
55 ) 63 )
56 } 64 }
57} 65}
diff --git a/client/src/app/+admin/follows/follows.component.html b/client/src/app/+admin/follows/follows.component.html
index 71e82059c..a8258bf70 100644
--- a/client/src/app/+admin/follows/follows.component.html
+++ b/client/src/app/+admin/follows/follows.component.html
@@ -1,5 +1,5 @@
1<div class="admin-sub-header"> 1<div class="admin-sub-header">
2 <div class="form-sub-title">Manage follows</div> 2 <div i18n class="form-sub-title">Manage follows</div>
3 3
4 <tabset #followsMenuTabs> 4 <tabset #followsMenuTabs>
5 <tab *ngFor="let link of links"> 5 <tab *ngFor="let link of links">