diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-04 16:21:17 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-05 08:43:01 +0200 |
commit | b1d40cff89f7cff565a98cdbcea9a624196a169a (patch) | |
tree | d24746c1cc69f50471a9eba0dfb1c1bae06a1870 /client/src/app/+my-account/my-account-settings | |
parent | 989e526abf0c0dd7958deb630df009608561bb67 (diff) | |
download | PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.gz PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.zst PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.zip |
Add i18n attributes
Diffstat (limited to 'client/src/app/+my-account/my-account-settings')
8 files changed, 44 insertions, 33 deletions
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html index b0e3cada4..767ef0336 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html | |||
@@ -2,9 +2,9 @@ | |||
2 | 2 | ||
3 | <form role="form" (ngSubmit)="changePassword()" [formGroup]="form"> | 3 | <form role="form" (ngSubmit)="changePassword()" [formGroup]="form"> |
4 | 4 | ||
5 | <label for="new-password">Change password</label> | 5 | <label i18n for="new-password">Change password</label> |
6 | <input | 6 | <input |
7 | type="password" id="new-password" placeholder="New password" | 7 | type="password" id="new-password" i18n-placeholder placeholder="New password" |
8 | formControlName="new-password" [ngClass]="{ 'input-error': formErrors['new-password'] }" | 8 | formControlName="new-password" [ngClass]="{ 'input-error': formErrors['new-password'] }" |
9 | > | 9 | > |
10 | <div *ngIf="formErrors['new-password']" class="form-error"> | 10 | <div *ngIf="formErrors['new-password']" class="form-error"> |
@@ -12,9 +12,9 @@ | |||
12 | </div> | 12 | </div> |
13 | 13 | ||
14 | <input | 14 | <input |
15 | type="password" id="new-confirmed-password" placeholder="Confirm new password" | 15 | type="password" id="new-confirmed-password" i18n-placeholder placeholder="Confirm new password" |
16 | formControlName="new-confirmed-password" | 16 | formControlName="new-confirmed-password" |
17 | > | 17 | > |
18 | 18 | ||
19 | <input type="submit" value="Change password" [disabled]="!form.valid"> | 19 | <input type="submit" i18n-value value="Change password" [disabled]="!form.valid"> |
20 | </form> | 20 | </form> |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts index 80af668f9..1a88aa82e 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.ts | |||
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core' | |||
2 | import { FormBuilder, FormGroup } from '@angular/forms' | 2 | import { FormBuilder, FormGroup } from '@angular/forms' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { FormReactive, USER_PASSWORD, UserService } from '../../../shared' | 4 | import { FormReactive, USER_PASSWORD, UserService } from '../../../shared' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
5 | 6 | ||
6 | @Component({ | 7 | @Component({ |
7 | selector: 'my-account-change-password', | 8 | selector: 'my-account-change-password', |
@@ -24,7 +25,8 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On | |||
24 | constructor ( | 25 | constructor ( |
25 | private formBuilder: FormBuilder, | 26 | private formBuilder: FormBuilder, |
26 | private notificationsService: NotificationsService, | 27 | private notificationsService: NotificationsService, |
27 | private userService: UserService | 28 | private userService: UserService, |
29 | private i18n: I18n | ||
28 | ) { | 30 | ) { |
29 | super() | 31 | super() |
30 | } | 32 | } |
@@ -49,12 +51,12 @@ export class MyAccountChangePasswordComponent extends FormReactive implements On | |||
49 | this.error = null | 51 | this.error = null |
50 | 52 | ||
51 | if (newPassword !== newConfirmedPassword) { | 53 | if (newPassword !== newConfirmedPassword) { |
52 | this.error = 'The new password and the confirmed password do not correspond.' | 54 | this.error = this.i18n('The new password and the confirmed password do not correspond.') |
53 | return | 55 | return |
54 | } | 56 | } |
55 | 57 | ||
56 | this.userService.changePassword(newPassword).subscribe( | 58 | this.userService.changePassword(newPassword).subscribe( |
57 | () => this.notificationsService.success('Success', 'Password updated.'), | 59 | () => this.notificationsService.success(this.i18n('Success'), this.i18n('Password updated.')), |
58 | 60 | ||
59 | err => this.error = err.message | 61 | err => this.error = err.message |
60 | ) | 62 | ) |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.html b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.html index 306f3a12c..bbdce5b02 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.html | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | <form role="form" (ngSubmit)="updateMyProfile()" [formGroup]="form"> | 3 | <form role="form" (ngSubmit)="updateMyProfile()" [formGroup]="form"> |
4 | 4 | ||
5 | <label for="display-name">Display name</label> | 5 | <label i18n for="display-name">Display name</label> |
6 | <input | 6 | <input |
7 | type="text" id="display-name" | 7 | type="text" id="display-name" |
8 | formControlName="display-name" [ngClass]="{ 'input-error': formErrors['display-name'] }" | 8 | formControlName="display-name" [ngClass]="{ 'input-error': formErrors['display-name'] }" |
@@ -11,7 +11,7 @@ | |||
11 | {{ formErrors['display-name'] }} | 11 | {{ formErrors['display-name'] }} |
12 | </div> | 12 | </div> |
13 | 13 | ||
14 | <label for="description">Description</label> | 14 | <label i18n for="description">Description</label> |
15 | <textarea | 15 | <textarea |
16 | id="description" formControlName="description" | 16 | id="description" formControlName="description" |
17 | [ngClass]="{ 'input-error': formErrors['description'] }" | 17 | [ngClass]="{ 'input-error': formErrors['description'] }" |
@@ -20,5 +20,5 @@ | |||
20 | {{ formErrors.description }} | 20 | {{ formErrors.description }} |
21 | </div> | 21 | </div> |
22 | 22 | ||
23 | <input type="submit" value="Update my profile" [disabled]="!form.valid"> | 23 | <input type="submit" i18n-value value="Update my profile" [disabled]="!form.valid"> |
24 | </form> | 24 | </form> |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts index 468be022c..35843ecd9 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-profile/my-account-profile.component.ts | |||
@@ -3,6 +3,7 @@ import { FormBuilder, FormGroup } from '@angular/forms' | |||
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { FormReactive, USER_DESCRIPTION, USER_DISPLAY_NAME, UserService } from '../../../shared' | 4 | import { FormReactive, USER_DESCRIPTION, USER_DISPLAY_NAME, UserService } from '../../../shared' |
5 | import { User } from '@app/shared' | 5 | import { User } from '@app/shared' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
8 | selector: 'my-account-profile', | 9 | selector: 'my-account-profile', |
@@ -27,7 +28,8 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit { | |||
27 | constructor ( | 28 | constructor ( |
28 | private formBuilder: FormBuilder, | 29 | private formBuilder: FormBuilder, |
29 | private notificationsService: NotificationsService, | 30 | private notificationsService: NotificationsService, |
30 | private userService: UserService | 31 | private userService: UserService, |
32 | private i18n: I18n | ||
31 | ) { | 33 | ) { |
32 | super() | 34 | super() |
33 | } | 35 | } |
@@ -56,7 +58,7 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit { | |||
56 | this.user.account.displayName = displayName | 58 | this.user.account.displayName = displayName |
57 | this.user.account.description = description | 59 | this.user.account.description = description |
58 | 60 | ||
59 | this.notificationsService.success('Success', 'Profile updated.') | 61 | this.notificationsService.success(this.i18n('Success'), this.i18n('Profile updated.')) |
60 | }, | 62 | }, |
61 | 63 | ||
62 | err => this.error = err.message | 64 | err => this.error = err.message |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.html b/client/src/app/+my-account/my-account-settings/my-account-settings.component.html index 0fcc7782e..056c2a7d7 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.html | |||
@@ -6,27 +6,27 @@ | |||
6 | <div class="user-info-display-name">{{ user.account.displayName }}</div> | 6 | <div class="user-info-display-name">{{ user.account.displayName }}</div> |
7 | <div class="user-info-username">{{ user.username }}</div> | 7 | <div class="user-info-username">{{ user.username }}</div> |
8 | </div> | 8 | </div> |
9 | <div class="user-info-followers">{{ user.account?.followersCount }} subscribers</div> | 9 | <div i18n class="user-info-followers">{{ user.account?.followersCount }} subscribers</div> |
10 | </div> | 10 | </div> |
11 | </div> | 11 | </div> |
12 | 12 | ||
13 | <div class="button-file"> | 13 | <div class="button-file"> |
14 | <span>Change your avatar</span> | 14 | <span i18n>Change your avatar</span> |
15 | <input #avatarfileInput type="file" name="avatarfile" id="avatarfile" [accept]="avatarExtensions" (change)="changeAvatar()" /> | 15 | <input #avatarfileInput type="file" name="avatarfile" id="avatarfile" [accept]="avatarExtensions" (change)="changeAvatar()" /> |
16 | </div> | 16 | </div> |
17 | <div class="file-max-size">(extensions: {{ avatarExtensions }}, max size: {{ maxAvatarSize | bytes }})</div> | 17 | <div i18n class="file-max-size">(extensions: {{ avatarExtensions }}, max size: {{ maxAvatarSize | bytes }})</div> |
18 | 18 | ||
19 | <div class="user-quota"> | 19 | <div class="user-quota"> |
20 | <span class="user-quota-label">Video quota:</span> {{ userVideoQuotaUsed | bytes: 0 }} / {{ userVideoQuota }} | 20 | <span i18n class="user-quota-label">Video quota:</span> {{ userVideoQuotaUsed | bytes: 0 }} / {{ userVideoQuota }} |
21 | </div> | 21 | </div> |
22 | 22 | ||
23 | <ng-template [ngIf]="user && user.account"> | 23 | <ng-template [ngIf]="user && user.account"> |
24 | <div class="account-title">Profile</div> | 24 | <div i18n class="account-title">Profile</div> |
25 | <my-account-profile [user]="user"></my-account-profile> | 25 | <my-account-profile [user]="user"></my-account-profile> |
26 | </ng-template> | 26 | </ng-template> |
27 | 27 | ||
28 | <div class="account-title">Password</div> | 28 | <div i18n class="account-title">Password</div> |
29 | <my-account-change-password></my-account-change-password> | 29 | <my-account-change-password></my-account-change-password> |
30 | 30 | ||
31 | <div class="account-title">Video settings</div> | 31 | <div i18n class="account-title">Video settings</div> |
32 | <my-account-video-settings [user]="user"></my-account-video-settings> | 32 | <my-account-video-settings [user]="user"></my-account-video-settings> |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts index 06d1138e7..44eddaa7c 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts | |||
@@ -5,6 +5,7 @@ import { AuthService } from '../../core' | |||
5 | import { ServerService } from '../../core/server' | 5 | import { ServerService } from '../../core/server' |
6 | import { User } from '../../shared' | 6 | import { User } from '../../shared' |
7 | import { UserService } from '../../shared/users' | 7 | import { UserService } from '../../shared/users' |
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
8 | 9 | ||
9 | @Component({ | 10 | @Component({ |
10 | selector: 'my-account-settings', | 11 | selector: 'my-account-settings', |
@@ -22,7 +23,8 @@ export class MyAccountSettingsComponent implements OnInit { | |||
22 | private userService: UserService, | 23 | private userService: UserService, |
23 | private authService: AuthService, | 24 | private authService: AuthService, |
24 | private serverService: ServerService, | 25 | private serverService: ServerService, |
25 | private notificationsService: NotificationsService | 26 | private notificationsService: NotificationsService, |
27 | private i18n: I18n | ||
26 | ) {} | 28 | ) {} |
27 | 29 | ||
28 | ngOnInit () { | 30 | ngOnInit () { |
@@ -33,7 +35,7 @@ export class MyAccountSettingsComponent implements OnInit { | |||
33 | if (this.user.videoQuota !== -1) { | 35 | if (this.user.videoQuota !== -1) { |
34 | this.userVideoQuota = new BytesPipe().transform(this.user.videoQuota, 0).toString() | 36 | this.userVideoQuota = new BytesPipe().transform(this.user.videoQuota, 0).toString() |
35 | } else { | 37 | } else { |
36 | this.userVideoQuota = 'Unlimited' | 38 | this.userVideoQuota = this.i18n('Unlimited') |
37 | } | 39 | } |
38 | } | 40 | } |
39 | ) | 41 | ) |
@@ -51,12 +53,12 @@ export class MyAccountSettingsComponent implements OnInit { | |||
51 | this.userService.changeAvatar(formData) | 53 | this.userService.changeAvatar(formData) |
52 | .subscribe( | 54 | .subscribe( |
53 | data => { | 55 | data => { |
54 | this.notificationsService.success('Success', 'Avatar changed.') | 56 | this.notificationsService.success(this.i18n('Success'), this.i18n('Avatar changed.')) |
55 | 57 | ||
56 | this.user.account.avatar = data.avatar | 58 | this.user.account.avatar = data.avatar |
57 | }, | 59 | }, |
58 | 60 | ||
59 | err => this.notificationsService.error('Error', err.message) | 61 | err => this.notificationsService.error(this.i18n('Error'), err.message) |
60 | ) | 62 | ) |
61 | } | 63 | } |
62 | 64 | ||
diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html index 0e8598e9e..98587eb18 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html +++ b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.html | |||
@@ -1,13 +1,16 @@ | |||
1 | <form role="form" (ngSubmit)="updateDetails()" [formGroup]="form"> | 1 | <form role="form" (ngSubmit)="updateDetails()" [formGroup]="form"> |
2 | <div class="form-group"> | 2 | <div class="form-group"> |
3 | <label for="nsfwPolicy">Default policy on videos containing sensitive content</label> | 3 | <label i18n for="nsfwPolicy">Default policy on videos containing sensitive content</label> |
4 | <my-help helpType="custom" customHtml="With <strong>Do not list</strong> or <strong>Blur thumbnails</strong>, a confirmation will be requested to watch the video."></my-help> | 4 | <my-help |
5 | helpType="custom" i18n-customHtml | ||
6 | customHtml="With <strong>Do not list</strong> or <strong>Blur thumbnails</strong>, a confirmation will be requested to watch the video." | ||
7 | ></my-help> | ||
5 | 8 | ||
6 | <div class="peertube-select-container"> | 9 | <div class="peertube-select-container"> |
7 | <select id="nsfwPolicy" formControlName="nsfwPolicy"> | 10 | <select id="nsfwPolicy" formControlName="nsfwPolicy"> |
8 | <option value="do_not_list">Do not list</option> | 11 | <option i18n value="do_not_list">Do not list</option> |
9 | <option value="blur">Blur thumbnails</option> | 12 | <option i18n value="blur">Blur thumbnails</option> |
10 | <option value="display">Display</option> | 13 | <option i18n value="display">Display</option> |
11 | </select> | 14 | </select> |
12 | </div> | 15 | </div> |
13 | </div> | 16 | </div> |
@@ -18,8 +21,8 @@ | |||
18 | formControlName="autoPlayVideo" | 21 | formControlName="autoPlayVideo" |
19 | > | 22 | > |
20 | <label for="autoPlayVideo"></label> | 23 | <label for="autoPlayVideo"></label> |
21 | <label for="autoPlayVideo">Automatically plays video</label> | 24 | <label i18n for="autoPlayVideo">Automatically plays video</label> |
22 | </div> | 25 | </div> |
23 | 26 | ||
24 | <input type="submit" value="Save" [disabled]="!form.valid"> | 27 | <input type="submit" i18n-value value="Save" [disabled]="!form.valid"> |
25 | </form> | 28 | </form> |
diff --git a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts index acc70c14d..4588f73db 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-video-settings/my-account-video-settings.component.ts | |||
@@ -4,6 +4,7 @@ import { NotificationsService } from 'angular2-notifications' | |||
4 | import { UserUpdateMe } from '../../../../../../shared' | 4 | import { UserUpdateMe } from '../../../../../../shared' |
5 | import { AuthService } from '../../../core' | 5 | import { AuthService } from '../../../core' |
6 | import { FormReactive, User, UserService } from '../../../shared' | 6 | import { FormReactive, User, UserService } from '../../../shared' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
7 | 8 | ||
8 | @Component({ | 9 | @Component({ |
9 | selector: 'my-account-video-settings', | 10 | selector: 'my-account-video-settings', |
@@ -21,7 +22,8 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI | |||
21 | private authService: AuthService, | 22 | private authService: AuthService, |
22 | private formBuilder: FormBuilder, | 23 | private formBuilder: FormBuilder, |
23 | private notificationsService: NotificationsService, | 24 | private notificationsService: NotificationsService, |
24 | private userService: UserService | 25 | private userService: UserService, |
26 | private i18n: I18n | ||
25 | ) { | 27 | ) { |
26 | super() | 28 | super() |
27 | } | 29 | } |
@@ -49,12 +51,12 @@ export class MyAccountVideoSettingsComponent extends FormReactive implements OnI | |||
49 | 51 | ||
50 | this.userService.updateMyProfile(details).subscribe( | 52 | this.userService.updateMyProfile(details).subscribe( |
51 | () => { | 53 | () => { |
52 | this.notificationsService.success('Success', 'Information updated.') | 54 | this.notificationsService.success(this.i18n('Success'), this.i18n('Information updated.')) |
53 | 55 | ||
54 | this.authService.refreshUserInformation() | 56 | this.authService.refreshUserInformation() |
55 | }, | 57 | }, |
56 | 58 | ||
57 | err => this.notificationsService.error('Error', err.message) | 59 | err => this.notificationsService.error(this.i18n('Error'), err.message) |
58 | ) | 60 | ) |
59 | } | 61 | } |
60 | } | 62 | } |