aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/users/user-list
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/users/user-list
parent989e526abf0c0dd7958deb630df009608561bb67 (diff)
downloadPeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.gz
PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.zst
PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.zip
Add i18n attributes
Diffstat (limited to 'client/src/app/+admin/users/user-list')
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.html14
-rw-r--r--client/src/app/+admin/users/user-list/user-list.component.ts19
2 files changed, 18 insertions, 15 deletions
diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html
index 09a4ac1e7..166fafef0 100644
--- a/client/src/app/+admin/users/user-list/user-list.component.html
+++ b/client/src/app/+admin/users/user-list/user-list.component.html
@@ -1,9 +1,9 @@
1<div class="admin-sub-header"> 1<div class="admin-sub-header">
2 <div class="form-sub-title">Users list</div> 2 <div i18n class="form-sub-title">Users list</div>
3 3
4 <a class="add-button" routerLink="/admin/users/create"> 4 <a class="add-button" routerLink="/admin/users/create">
5 <span class="icon icon-add"></span> 5 <span class="icon icon-add"></span>
6 Create user 6 <ng-container i18n>Create user</ng-container>
7 </a> 7 </a>
8</div> 8</div>
9 9
@@ -13,11 +13,11 @@
13> 13>
14 <ng-template pTemplate="header"> 14 <ng-template pTemplate="header">
15 <tr> 15 <tr>
16 <th pSortableColumn="username">Username <p-sortIcon field="username"></p-sortIcon></th> 16 <th i18n pSortableColumn="username">Username <p-sortIcon field="username"></p-sortIcon></th>
17 <th>Email</th> 17 <th i18n>Email</th>
18 <th>Video quota</th> 18 <th i18n>Video quota</th>
19 <th>Role</th> 19 <th i18n>Role</th>
20 <th pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> 20 <th i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
21 <th></th> 21 <th></th>
22 </tr> 22 </tr>
23 </ng-template> 23 </ng-template>
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts
index 2cc4d4349..b644fcf71 100644
--- a/client/src/app/+admin/users/user-list/user-list.component.ts
+++ b/client/src/app/+admin/users/user-list/user-list.component.ts
@@ -1,11 +1,10 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2
3import { NotificationsService } from 'angular2-notifications' 2import { NotificationsService } from 'angular2-notifications'
4import { SortMeta } from 'primeng/components/common/sortmeta' 3import { SortMeta } from 'primeng/components/common/sortmeta'
5
6import { ConfirmService } from '../../../core' 4import { ConfirmService } from '../../../core'
7import { RestPagination, RestTable, User } from '../../../shared' 5import { RestPagination, RestTable, User } from '../../../shared'
8import { UserService } from '../shared' 6import { UserService } from '../shared'
7import { I18n } from '@ngx-translate/i18n-polyfill'
9 8
10@Component({ 9@Component({
11 selector: 'my-user-list', 10 selector: 'my-user-list',
@@ -22,7 +21,8 @@ export class UserListComponent extends RestTable implements OnInit {
22 constructor ( 21 constructor (
23 private notificationsService: NotificationsService, 22 private notificationsService: NotificationsService,
24 private confirmService: ConfirmService, 23 private confirmService: ConfirmService,
25 private userService: UserService 24 private userService: UserService,
25 private i18n: I18n
26 ) { 26 ) {
27 super() 27 super()
28 } 28 }
@@ -33,20 +33,23 @@ export class UserListComponent extends RestTable implements OnInit {
33 33
34 async removeUser (user: User) { 34 async removeUser (user: User) {
35 if (user.username === 'root') { 35 if (user.username === 'root') {
36 this.notificationsService.error('Error', 'You cannot delete root.') 36 this.notificationsService.error(this.i18n('Error'), this.i18n('You cannot delete root.'))
37 return 37 return
38 } 38 }
39 39
40 const res = await this.confirmService.confirm('Do you really want to delete this user?', 'Delete') 40 const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this user?'), this.i18n('Delete'))
41 if (res === false) return 41 if (res === false) return
42 42
43 this.userService.removeUser(user).subscribe( 43 this.userService.removeUser(user).subscribe(
44 () => { 44 () => {
45 this.notificationsService.success('Success', `User ${user.username} deleted.`) 45 this.notificationsService.success(
46 this.i18n('Success'),
47 this.i18n('User {{ username }} deleted.', { username: user.username })
48 )
46 this.loadData() 49 this.loadData()
47 }, 50 },
48 51
49 err => this.notificationsService.error('Error', err.message) 52 err => this.notificationsService.error(this.i18n('Error'), err.message)
50 ) 53 )
51 } 54 }
52 55
@@ -62,7 +65,7 @@ export class UserListComponent extends RestTable implements OnInit {
62 this.totalRecords = resultList.total 65 this.totalRecords = resultList.total
63 }, 66 },
64 67
65 err => this.notificationsService.error('Error', err.message) 68 err => this.notificationsService.error(this.i18n('Error'), err.message)
66 ) 69 )
67 } 70 }
68} 71}