aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/users/user-edit
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-edit
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-edit')
-rw-r--r--client/src/app/+admin/users/user-edit/user-create.component.ts21
-rw-r--r--client/src/app/+admin/users/user-edit/user-edit.component.html20
-rw-r--r--client/src/app/+admin/users/user-edit/user-update.component.ts11
3 files changed, 27 insertions, 25 deletions
diff --git a/client/src/app/+admin/users/user-edit/user-create.component.ts b/client/src/app/+admin/users/user-edit/user-create.component.ts
index 2a9882cde..b91ffa115 100644
--- a/client/src/app/+admin/users/user-edit/user-create.component.ts
+++ b/client/src/app/+admin/users/user-edit/user-create.component.ts
@@ -1,20 +1,13 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { FormBuilder, FormGroup } from '@angular/forms' 2import { FormBuilder, FormGroup } from '@angular/forms'
3import { Router } from '@angular/router' 3import { Router } from '@angular/router'
4
5import { NotificationsService } from 'angular2-notifications' 4import { NotificationsService } from 'angular2-notifications'
6
7import { UserService } from '../shared' 5import { UserService } from '../shared'
8import { 6import { USER_EMAIL, USER_PASSWORD, USER_ROLE, USER_USERNAME, USER_VIDEO_QUOTA } from '../../../shared'
9 USER_USERNAME,
10 USER_EMAIL,
11 USER_PASSWORD,
12 USER_VIDEO_QUOTA,
13 USER_ROLE
14} from '../../../shared'
15import { ServerService } from '../../../core' 7import { ServerService } from '../../../core'
16import { UserCreate, UserRole } from '../../../../../../shared' 8import { UserCreate, UserRole } from '../../../../../../shared'
17import { UserEdit } from './user-edit' 9import { UserEdit } from './user-edit'
10import { I18n } from '@ngx-translate/i18n-polyfill'
18 11
19@Component({ 12@Component({
20 selector: 'my-user-create', 13 selector: 'my-user-create',
@@ -45,7 +38,8 @@ export class UserCreateComponent extends UserEdit implements OnInit {
45 private formBuilder: FormBuilder, 38 private formBuilder: FormBuilder,
46 private router: Router, 39 private router: Router,
47 private notificationsService: NotificationsService, 40 private notificationsService: NotificationsService,
48 private userService: UserService 41 private userService: UserService,
42 private i18n: I18n
49 ) { 43 ) {
50 super() 44 super()
51 } 45 }
@@ -76,7 +70,10 @@ export class UserCreateComponent extends UserEdit implements OnInit {
76 70
77 this.userService.addUser(userCreate).subscribe( 71 this.userService.addUser(userCreate).subscribe(
78 () => { 72 () => {
79 this.notificationsService.success('Success', `User ${userCreate.username} created.`) 73 this.notificationsService.success(
74 this.i18n('Success'),
75 this.i18n('User {{ username }} created.', { username: userCreate.username })
76 )
80 this.router.navigate([ '/admin/users/list' ]) 77 this.router.navigate([ '/admin/users/list' ])
81 }, 78 },
82 79
@@ -89,6 +86,6 @@ export class UserCreateComponent extends UserEdit implements OnInit {
89 } 86 }
90 87
91 getFormButtonTitle () { 88 getFormButtonTitle () {
92 return 'Create user' 89 return this.i18n('Create user')
93 } 90 }
94} 91}
diff --git a/client/src/app/+admin/users/user-edit/user-edit.component.html b/client/src/app/+admin/users/user-edit/user-edit.component.html
index a8c0ddadb..4626a40c9 100644
--- a/client/src/app/+admin/users/user-edit/user-edit.component.html
+++ b/client/src/app/+admin/users/user-edit/user-edit.component.html
@@ -1,13 +1,13 @@
1<div class="form-sub-title" *ngIf="isCreation() === true">Create user</div> 1<div i18n class="form-sub-title" *ngIf="isCreation() === true">Create user</div>
2<div class="form-sub-title" *ngIf="isCreation() === false">Edit user {{ username }}</div> 2<div i18n class="form-sub-title" *ngIf="isCreation() === false">Edit user {{ username }}</div>
3 3
4<div *ngIf="error" class="alert alert-danger">{{ error }}</div> 4<div *ngIf="error" class="alert alert-danger">{{ error }}</div>
5 5
6<form role="form" (ngSubmit)="formValidated()" [formGroup]="form"> 6<form role="form" (ngSubmit)="formValidated()" [formGroup]="form">
7 <div class="form-group" *ngIf="isCreation()"> 7 <div class="form-group" *ngIf="isCreation()">
8 <label for="username">Username</label> 8 <label i18n for="username">Username</label>
9 <input 9 <input
10 type="text" id="username" placeholder="john" 10 type="text" id="username" i18n-placeholder placeholder="john"
11 formControlName="username" [ngClass]="{ 'input-error': formErrors['username'] }" 11 formControlName="username" [ngClass]="{ 'input-error': formErrors['username'] }"
12 > 12 >
13 <div *ngIf="formErrors.username" class="form-error"> 13 <div *ngIf="formErrors.username" class="form-error">
@@ -16,9 +16,9 @@
16 </div> 16 </div>
17 17
18 <div class="form-group"> 18 <div class="form-group">
19 <label for="email">Email</label> 19 <label i18n for="email">Email</label>
20 <input 20 <input
21 type="text" id="email" placeholder="mail@example.com" 21 type="text" id="email" i18n-placeholder placeholder="mail@example.com"
22 formControlName="email" [ngClass]="{ 'input-error': formErrors['email'] }" 22 formControlName="email" [ngClass]="{ 'input-error': formErrors['email'] }"
23 > 23 >
24 <div *ngIf="formErrors.email" class="form-error"> 24 <div *ngIf="formErrors.email" class="form-error">
@@ -27,7 +27,7 @@
27 </div> 27 </div>
28 28
29 <div class="form-group" *ngIf="isCreation()"> 29 <div class="form-group" *ngIf="isCreation()">
30 <label for="password">Password</label> 30 <label i18n for="password">Password</label>
31 <input 31 <input
32 type="password" id="password" 32 type="password" id="password"
33 formControlName="password" [ngClass]="{ 'input-error': formErrors['password'] }" 33 formControlName="password" [ngClass]="{ 'input-error': formErrors['password'] }"
@@ -38,7 +38,7 @@
38 </div> 38 </div>
39 39
40 <div class="form-group"> 40 <div class="form-group">
41 <label for="role">Role</label> 41 <label i18n for="role">Role</label>
42 <div class="peertube-select-container"> 42 <div class="peertube-select-container">
43 <select id="role" formControlName="role"> 43 <select id="role" formControlName="role">
44 <option *ngFor="let role of roles" [value]="role.value"> 44 <option *ngFor="let role of roles" [value]="role.value">
@@ -53,7 +53,7 @@
53 </div> 53 </div>
54 54
55 <div class="form-group"> 55 <div class="form-group">
56 <label for="videoQuota">Video quota</label> 56 <label i18n for="videoQuota">Video quota</label>
57 <div class="peertube-select-container"> 57 <div class="peertube-select-container">
58 <select id="videoQuota" formControlName="videoQuota"> 58 <select id="videoQuota" formControlName="videoQuota">
59 <option *ngFor="let videoQuotaOption of videoQuotaOptions" [value]="videoQuotaOption.value"> 59 <option *ngFor="let videoQuotaOption of videoQuotaOptions" [value]="videoQuotaOption.value">
@@ -62,7 +62,7 @@
62 </select> 62 </select>
63 </div> 63 </div>
64 64
65 <div class="transcoding-information" *ngIf="isTranscodingInformationDisplayed()"> 65 <div i18n class="transcoding-information" *ngIf="isTranscodingInformationDisplayed()">
66 Transcoding is enabled on server. The video quota only take in account <strong>original</strong> video. <br /> 66 Transcoding is enabled on server. The video quota only take in account <strong>original</strong> video. <br />
67 At most, this user could use ~ {{ computeQuotaWithTranscoding() | bytes: 0 }}. 67 At most, this user could use ~ {{ computeQuotaWithTranscoding() | bytes: 0 }}.
68 </div> 68 </div>
diff --git a/client/src/app/+admin/users/user-edit/user-update.component.ts b/client/src/app/+admin/users/user-edit/user-update.component.ts
index 3cde07c65..dca555706 100644
--- a/client/src/app/+admin/users/user-edit/user-update.component.ts
+++ b/client/src/app/+admin/users/user-edit/user-update.component.ts
@@ -8,6 +8,7 @@ import { User, USER_EMAIL, USER_ROLE, USER_VIDEO_QUOTA } from '../../../shared'
8import { ServerService } from '../../../core' 8import { ServerService } from '../../../core'
9import { UserEdit } from './user-edit' 9import { UserEdit } from './user-edit'
10import { UserUpdate } from '../../../../../../shared' 10import { UserUpdate } from '../../../../../../shared'
11import { I18n } from '@ngx-translate/i18n-polyfill'
11 12
12@Component({ 13@Component({
13 selector: 'my-user-update', 14 selector: 'my-user-update',
@@ -39,7 +40,8 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
39 private router: Router, 40 private router: Router,
40 private notificationsService: NotificationsService, 41 private notificationsService: NotificationsService,
41 private formBuilder: FormBuilder, 42 private formBuilder: FormBuilder,
42 private userService: UserService 43 private userService: UserService,
44 private i18n: I18n
43 ) { 45 ) {
44 super() 46 super()
45 } 47 }
@@ -81,7 +83,10 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
81 83
82 this.userService.updateUser(this.userId, userUpdate).subscribe( 84 this.userService.updateUser(this.userId, userUpdate).subscribe(
83 () => { 85 () => {
84 this.notificationsService.success('Success', `User ${this.username} updated.`) 86 this.notificationsService.success(
87 this.i18n('Success'),
88 this.i18n('User {{ username }} updated.', { username: this.username })
89 )
85 this.router.navigate([ '/admin/users/list' ]) 90 this.router.navigate([ '/admin/users/list' ])
86 }, 91 },
87 92
@@ -94,7 +99,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy {
94 } 99 }
95 100
96 getFormButtonTitle () { 101 getFormButtonTitle () {
97 return 'Update user' 102 return this.i18n('Update user')
98 } 103 }
99 104
100 private onUserFetched (userJson: User) { 105 private onUserFetched (userJson: User) {