diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-12 10:40:04 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-14 10:28:30 +0200 |
commit | 66357162f8e1227495f09bd4f68446aad7071c6d (patch) | |
tree | 7d4429506deb512b2fe1d0267f38a28cda20af55 /client/src/app/+admin | |
parent | 8c360747995e17eb5520e22fc3d7bd4c3d26eeee (diff) | |
download | PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.tar.gz PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.tar.zst PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.zip |
Migrate to $localize
* Remove i18n polyfill to translate things in components
* Reduce bundle sizes
* Improve runtime perf
* Reduce a lot the time to make a full client build
* Reduce client build complexity
* We don't need a service to translate things anymore (so we will be able to translate title pages etc)
Unfortunately we may loose some translations in the migration process.
I'll put a message on weblate to notify translators
Diffstat (limited to 'client/src/app/+admin')
18 files changed, 146 insertions, 193 deletions
diff --git a/client/src/app/+admin/admin.component.ts b/client/src/app/+admin/admin.component.ts index 66e068c4c..b661a5517 100644 --- a/client/src/app/+admin/admin.component.ts +++ b/client/src/app/+admin/admin.component.ts | |||
@@ -1,9 +1,8 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { AuthService, ScreenService } from '@app/core' | 2 | import { AuthService, ScreenService } from '@app/core' |
3 | import { ListOverflowItem } from '@app/shared/shared-main' | 3 | import { ListOverflowItem } from '@app/shared/shared-main' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
5 | import { UserRight } from '@shared/models' | ||
6 | import { TopMenuDropdownParam } from '@app/shared/shared-main/misc/top-menu-dropdown.component' | 4 | import { TopMenuDropdownParam } from '@app/shared/shared-main/misc/top-menu-dropdown.component' |
5 | import { UserRight } from '@shared/models' | ||
7 | 6 | ||
8 | @Component({ | 7 | @Component({ |
9 | templateUrl: './admin.component.html', | 8 | templateUrl: './admin.component.html', |
@@ -15,8 +14,7 @@ export class AdminComponent implements OnInit { | |||
15 | 14 | ||
16 | constructor ( | 15 | constructor ( |
17 | private auth: AuthService, | 16 | private auth: AuthService, |
18 | private screen: ScreenService, | 17 | private screen: ScreenService |
19 | private i18n: I18n | ||
20 | ) { } | 18 | ) { } |
21 | 19 | ||
22 | get isBroadcastMessageDisplayed () { | 20 | get isBroadcastMessageDisplayed () { |
@@ -25,20 +23,20 @@ export class AdminComponent implements OnInit { | |||
25 | 23 | ||
26 | ngOnInit () { | 24 | ngOnInit () { |
27 | const federationItems: TopMenuDropdownParam = { | 25 | const federationItems: TopMenuDropdownParam = { |
28 | label: this.i18n('Federation'), | 26 | label: $localize`Federation`, |
29 | children: [ | 27 | children: [ |
30 | { | 28 | { |
31 | label: this.i18n('Instances you follow'), | 29 | label: $localize`Instances you follow`, |
32 | routerLink: '/admin/follows/following-list', | 30 | routerLink: '/admin/follows/following-list', |
33 | iconName: 'following' | 31 | iconName: 'following' |
34 | }, | 32 | }, |
35 | { | 33 | { |
36 | label: this.i18n('Instances following you'), | 34 | label: $localize`Instances following you`, |
37 | routerLink: '/admin/follows/followers-list', | 35 | routerLink: '/admin/follows/followers-list', |
38 | iconName: 'follower' | 36 | iconName: 'follower' |
39 | }, | 37 | }, |
40 | { | 38 | { |
41 | label: this.i18n('Video redundancies'), | 39 | label: $localize`Video redundancies`, |
42 | routerLink: '/admin/follows/video-redundancies-list', | 40 | routerLink: '/admin/follows/video-redundancies-list', |
43 | iconName: 'videos' | 41 | iconName: 'videos' |
44 | } | 42 | } |
@@ -46,56 +44,56 @@ export class AdminComponent implements OnInit { | |||
46 | } | 44 | } |
47 | 45 | ||
48 | const moderationItems: TopMenuDropdownParam = { | 46 | const moderationItems: TopMenuDropdownParam = { |
49 | label: this.i18n('Moderation'), | 47 | label: $localize`Moderation`, |
50 | children: [] | 48 | children: [] |
51 | } | 49 | } |
52 | 50 | ||
53 | if (this.hasAbusesRight()) { | 51 | if (this.hasAbusesRight()) { |
54 | moderationItems.children.push({ | 52 | moderationItems.children.push({ |
55 | label: this.i18n('Reports'), | 53 | label: $localize`Reports`, |
56 | routerLink: '/admin/moderation/abuses/list', | 54 | routerLink: '/admin/moderation/abuses/list', |
57 | iconName: 'flag' | 55 | iconName: 'flag' |
58 | }) | 56 | }) |
59 | } | 57 | } |
60 | if (this.hasVideoBlocklistRight()) { | 58 | if (this.hasVideoBlocklistRight()) { |
61 | moderationItems.children.push({ | 59 | moderationItems.children.push({ |
62 | label: this.i18n('Video blocks'), | 60 | label: $localize`Video blocks`, |
63 | routerLink: '/admin/moderation/video-blocks/list', | 61 | routerLink: '/admin/moderation/video-blocks/list', |
64 | iconName: 'cross' | 62 | iconName: 'cross' |
65 | }) | 63 | }) |
66 | } | 64 | } |
67 | if (this.hasAccountsBlocklistRight()) { | 65 | if (this.hasAccountsBlocklistRight()) { |
68 | moderationItems.children.push({ | 66 | moderationItems.children.push({ |
69 | label: this.i18n('Muted accounts'), | 67 | label: $localize`Muted accounts`, |
70 | routerLink: '/admin/moderation/blocklist/accounts', | 68 | routerLink: '/admin/moderation/blocklist/accounts', |
71 | iconName: 'user-x' | 69 | iconName: 'user-x' |
72 | }) | 70 | }) |
73 | } | 71 | } |
74 | if (this.hasServersBlocklistRight()) { | 72 | if (this.hasServersBlocklistRight()) { |
75 | moderationItems.children.push({ | 73 | moderationItems.children.push({ |
76 | label: this.i18n('Muted servers'), | 74 | label: $localize`Muted servers`, |
77 | routerLink: '/admin/moderation/blocklist/servers', | 75 | routerLink: '/admin/moderation/blocklist/servers', |
78 | iconName: 'peertube-x' | 76 | iconName: 'peertube-x' |
79 | }) | 77 | }) |
80 | } | 78 | } |
81 | 79 | ||
82 | if (this.hasUsersRight()) { | 80 | if (this.hasUsersRight()) { |
83 | this.menuEntries.push({ label: this.i18n('Users'), routerLink: '/admin/users' }) | 81 | this.menuEntries.push({ label: $localize`Users`, routerLink: '/admin/users' }) |
84 | } | 82 | } |
85 | 83 | ||
86 | if (this.hasServerFollowRight()) this.menuEntries.push(federationItems) | 84 | if (this.hasServerFollowRight()) this.menuEntries.push(federationItems) |
87 | if (this.hasAbusesRight() || this.hasVideoBlocklistRight()) this.menuEntries.push(moderationItems) | 85 | if (this.hasAbusesRight() || this.hasVideoBlocklistRight()) this.menuEntries.push(moderationItems) |
88 | 86 | ||
89 | if (this.hasConfigRight()) { | 87 | if (this.hasConfigRight()) { |
90 | this.menuEntries.push({ label: this.i18n('Configuration'), routerLink: '/admin/config' }) | 88 | this.menuEntries.push({ label: $localize`Configuration`, routerLink: '/admin/config' }) |
91 | } | 89 | } |
92 | 90 | ||
93 | if (this.hasPluginsRight()) { | 91 | if (this.hasPluginsRight()) { |
94 | this.menuEntries.push({ label: this.i18n('Plugins/Themes'), routerLink: '/admin/plugins' }) | 92 | this.menuEntries.push({ label: $localize`Plugins/Themes`, routerLink: '/admin/plugins' }) |
95 | } | 93 | } |
96 | 94 | ||
97 | if (this.hasJobsRight() || this.hasLogsRight() || this.hasDebugRight()) { | 95 | if (this.hasJobsRight() || this.hasLogsRight() || this.hasDebugRight()) { |
98 | this.menuEntries.push({ label: this.i18n('System'), routerLink: '/admin/system' }) | 96 | this.menuEntries.push({ label: $localize`System`, routerLink: '/admin/system' }) |
99 | } | 97 | } |
100 | } | 98 | } |
101 | 99 | ||
diff --git a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts index 00a0bfad2..3a60b144f 100644 --- a/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts +++ b/client/src/app/+admin/config/edit-custom-config/edit-custom-config.component.ts | |||
@@ -12,7 +12,6 @@ import { | |||
12 | UserValidatorsService | 12 | UserValidatorsService |
13 | } from '@app/shared/shared-forms' | 13 | } from '@app/shared/shared-forms' |
14 | import { NgbNav } from '@ng-bootstrap/ng-bootstrap' | 14 | import { NgbNav } from '@ng-bootstrap/ng-bootstrap' |
15 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
16 | import { CustomConfig, ServerConfig } from '@shared/models' | 15 | import { CustomConfig, ServerConfig } from '@shared/models' |
17 | 16 | ||
18 | @Component({ | 17 | @Component({ |
@@ -42,45 +41,44 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
42 | private userValidatorsService: UserValidatorsService, | 41 | private userValidatorsService: UserValidatorsService, |
43 | private notifier: Notifier, | 42 | private notifier: Notifier, |
44 | private configService: ConfigService, | 43 | private configService: ConfigService, |
45 | private serverService: ServerService, | 44 | private serverService: ServerService |
46 | private i18n: I18n | ||
47 | ) { | 45 | ) { |
48 | super() | 46 | super() |
49 | 47 | ||
50 | this.resolutions = [ | 48 | this.resolutions = [ |
51 | { | 49 | { |
52 | id: '0p', | 50 | id: '0p', |
53 | label: this.i18n('Audio-only'), | 51 | label: $localize`Audio-only`, |
54 | description: this.i18n('A <code>.mp4</code> that keeps the original audio track, with no video') | 52 | description: $localize`A <code>.mp4</code> that keeps the original audio track, with no video` |
55 | }, | 53 | }, |
56 | { | 54 | { |
57 | id: '240p', | 55 | id: '240p', |
58 | label: this.i18n('240p') | 56 | label: $localize`240p` |
59 | }, | 57 | }, |
60 | { | 58 | { |
61 | id: '360p', | 59 | id: '360p', |
62 | label: this.i18n('360p') | 60 | label: $localize`360p` |
63 | }, | 61 | }, |
64 | { | 62 | { |
65 | id: '480p', | 63 | id: '480p', |
66 | label: this.i18n('480p') | 64 | label: $localize`480p` |
67 | }, | 65 | }, |
68 | { | 66 | { |
69 | id: '720p', | 67 | id: '720p', |
70 | label: this.i18n('720p') | 68 | label: $localize`720p` |
71 | }, | 69 | }, |
72 | { | 70 | { |
73 | id: '1080p', | 71 | id: '1080p', |
74 | label: this.i18n('1080p') | 72 | label: $localize`1080p` |
75 | }, | 73 | }, |
76 | { | 74 | { |
77 | id: '2160p', | 75 | id: '2160p', |
78 | label: this.i18n('2160p') | 76 | label: $localize`2160p` |
79 | } | 77 | } |
80 | ] | 78 | ] |
81 | 79 | ||
82 | this.transcodingThreadOptions = [ | 80 | this.transcodingThreadOptions = [ |
83 | { value: 0, label: this.i18n('Auto (via ffmpeg)') }, | 81 | { value: 0, label: $localize`Auto (via ffmpeg)` }, |
84 | { value: 1, label: '1' }, | 82 | { value: 1, label: '1' }, |
85 | { value: 2, label: '2' }, | 83 | { value: 2, label: '2' }, |
86 | { value: 4, label: '4' }, | 84 | { value: 4, label: '4' }, |
@@ -288,7 +286,7 @@ export class EditCustomConfigComponent extends FormReactive implements OnInit, A | |||
288 | 286 | ||
289 | this.updateForm() | 287 | this.updateForm() |
290 | 288 | ||
291 | this.notifier.success(this.i18n('Configuration updated.')) | 289 | this.notifier.success($localize`Configuration updated.`) |
292 | }, | 290 | }, |
293 | 291 | ||
294 | err => this.notifier.error(err.message) | 292 | err => this.notifier.error(err.message) |
diff --git a/client/src/app/+admin/config/shared/config.service.ts b/client/src/app/+admin/config/shared/config.service.ts index f182946b8..5f98aa545 100644 --- a/client/src/app/+admin/config/shared/config.service.ts +++ b/client/src/app/+admin/config/shared/config.service.ts | |||
@@ -2,7 +2,6 @@ import { catchError } from 'rxjs/operators' | |||
2 | import { HttpClient } from '@angular/common/http' | 2 | import { HttpClient } from '@angular/common/http' |
3 | import { Injectable } from '@angular/core' | 3 | import { Injectable } from '@angular/core' |
4 | import { RestExtractor } from '@app/core' | 4 | import { RestExtractor } from '@app/core' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | import { CustomConfig } from '@shared/models' | 5 | import { CustomConfig } from '@shared/models' |
7 | import { environment } from '../../../../environments/environment' | 6 | import { environment } from '../../../../environments/environment' |
8 | 7 | ||
@@ -15,33 +14,32 @@ export class ConfigService { | |||
15 | 14 | ||
16 | constructor ( | 15 | constructor ( |
17 | private authHttp: HttpClient, | 16 | private authHttp: HttpClient, |
18 | private restExtractor: RestExtractor, | 17 | private restExtractor: RestExtractor |
19 | private i18n: I18n | 18 | ) { |
20 | ) { | ||
21 | this.videoQuotaOptions = [ | 19 | this.videoQuotaOptions = [ |
22 | { value: undefined, label: 'Default quota', disabled: true }, | 20 | { value: undefined, label: 'Default quota', disabled: true }, |
23 | { value: -1, label: this.i18n('Unlimited') }, | 21 | { value: -1, label: $localize`Unlimited` }, |
24 | { value: undefined, label: '─────', disabled: true }, | 22 | { value: undefined, label: '─────', disabled: true }, |
25 | { value: 0, label: this.i18n('None - no upload possible') }, | 23 | { value: 0, label: $localize`None - no upload possible` }, |
26 | { value: 100 * 1024 * 1024, label: this.i18n('100MB') }, | 24 | { value: 100 * 1024 * 1024, label: $localize`100MB` }, |
27 | { value: 500 * 1024 * 1024, label: this.i18n('500MB') }, | 25 | { value: 500 * 1024 * 1024, label: $localize`500MB` }, |
28 | { value: 1024 * 1024 * 1024, label: this.i18n('1GB') }, | 26 | { value: 1024 * 1024 * 1024, label: $localize`1GB` }, |
29 | { value: 5 * 1024 * 1024 * 1024, label: this.i18n('5GB') }, | 27 | { value: 5 * 1024 * 1024 * 1024, label: $localize`5GB` }, |
30 | { value: 20 * 1024 * 1024 * 1024, label: this.i18n('20GB') }, | 28 | { value: 20 * 1024 * 1024 * 1024, label: $localize`20GB` }, |
31 | { value: 50 * 1024 * 1024 * 1024, label: this.i18n('50GB') } | 29 | { value: 50 * 1024 * 1024 * 1024, label: $localize`50GB` } |
32 | ] | 30 | ] |
33 | 31 | ||
34 | this.videoQuotaDailyOptions = [ | 32 | this.videoQuotaDailyOptions = [ |
35 | { value: undefined, label: 'Default daily upload limit', disabled: true }, | 33 | { value: undefined, label: 'Default daily upload limit', disabled: true }, |
36 | { value: -1, label: this.i18n('Unlimited') }, | 34 | { value: -1, label: $localize`Unlimited` }, |
37 | { value: undefined, label: '─────', disabled: true }, | 35 | { value: undefined, label: '─────', disabled: true }, |
38 | { value: 0, label: this.i18n('None - no upload possible') }, | 36 | { value: 0, label: $localize`None - no upload possible` }, |
39 | { value: 10 * 1024 * 1024, label: this.i18n('10MB') }, | 37 | { value: 10 * 1024 * 1024, label: $localize`10MB` }, |
40 | { value: 50 * 1024 * 1024, label: this.i18n('50MB') }, | 38 | { value: 50 * 1024 * 1024, label: $localize`50MB` }, |
41 | { value: 100 * 1024 * 1024, label: this.i18n('100MB') }, | 39 | { value: 100 * 1024 * 1024, label: $localize`100MB` }, |
42 | { value: 500 * 1024 * 1024, label: this.i18n('500MB') }, | 40 | { value: 500 * 1024 * 1024, label: $localize`500MB` }, |
43 | { value: 2 * 1024 * 1024 * 1024, label: this.i18n('2GB') }, | 41 | { value: 2 * 1024 * 1024 * 1024, label: $localize`2GB` }, |
44 | { value: 5 * 1024 * 1024 * 1024, label: this.i18n('5GB') } | 42 | { value: 5 * 1024 * 1024 * 1024, label: $localize`5GB` } |
45 | ] | 43 | ] |
46 | } | 44 | } |
47 | 45 | ||
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 63135f898..904e3c338 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 | |||
@@ -2,7 +2,6 @@ import { SortMeta } from 'primeng/api' | |||
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' | 3 | import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' |
4 | import { InstanceFollowService } from '@app/shared/shared-instance' | 4 | import { InstanceFollowService } from '@app/shared/shared-instance' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | import { ActorFollow } from '@shared/models' | 5 | import { ActorFollow } from '@shared/models' |
7 | 6 | ||
8 | @Component({ | 7 | @Component({ |
@@ -19,7 +18,6 @@ export class FollowersListComponent extends RestTable implements OnInit { | |||
19 | constructor ( | 18 | constructor ( |
20 | private confirmService: ConfirmService, | 19 | private confirmService: ConfirmService, |
21 | private notifier: Notifier, | 20 | private notifier: Notifier, |
22 | private i18n: I18n, | ||
23 | private followService: InstanceFollowService | 21 | private followService: InstanceFollowService |
24 | ) { | 22 | ) { |
25 | super() | 23 | super() |
@@ -40,7 +38,7 @@ export class FollowersListComponent extends RestTable implements OnInit { | |||
40 | .subscribe( | 38 | .subscribe( |
41 | () => { | 39 | () => { |
42 | const handle = follow.follower.name + '@' + follow.follower.host | 40 | const handle = follow.follower.name + '@' + follow.follower.host |
43 | this.notifier.success(this.i18n('{{handle}} accepted in instance followers', { handle })) | 41 | this.notifier.success($localize`${handle} accepted in instance followers`) |
44 | }, | 42 | }, |
45 | 43 | ||
46 | err => { | 44 | err => { |
@@ -51,15 +49,15 @@ export class FollowersListComponent extends RestTable implements OnInit { | |||
51 | } | 49 | } |
52 | 50 | ||
53 | async rejectFollower (follow: ActorFollow) { | 51 | async rejectFollower (follow: ActorFollow) { |
54 | const message = this.i18n('Do you really want to reject this follower?') | 52 | const message = $localize`Do you really want to reject this follower?` |
55 | const res = await this.confirmService.confirm(message, this.i18n('Reject')) | 53 | const res = await this.confirmService.confirm(message, $localize`Reject`) |
56 | if (res === false) return | 54 | if (res === false) return |
57 | 55 | ||
58 | this.followService.rejectFollower(follow) | 56 | this.followService.rejectFollower(follow) |
59 | .subscribe( | 57 | .subscribe( |
60 | () => { | 58 | () => { |
61 | const handle = follow.follower.name + '@' + follow.follower.host | 59 | const handle = follow.follower.name + '@' + follow.follower.host |
62 | this.notifier.success(this.i18n('{{handle}} rejected from instance followers', { handle })) | 60 | this.notifier.success($localize`${handle} rejected from instance followers`) |
63 | 61 | ||
64 | this.loadData() | 62 | this.loadData() |
65 | }, | 63 | }, |
@@ -72,15 +70,15 @@ export class FollowersListComponent extends RestTable implements OnInit { | |||
72 | } | 70 | } |
73 | 71 | ||
74 | async deleteFollower (follow: ActorFollow) { | 72 | async deleteFollower (follow: ActorFollow) { |
75 | const message = this.i18n('Do you really want to delete this follower?') | 73 | const message = $localize`Do you really want to delete this follower?` |
76 | const res = await this.confirmService.confirm(message, this.i18n('Delete')) | 74 | const res = await this.confirmService.confirm(message, $localize`Delete`) |
77 | if (res === false) return | 75 | if (res === false) return |
78 | 76 | ||
79 | this.followService.removeFollower(follow) | 77 | this.followService.removeFollower(follow) |
80 | .subscribe( | 78 | .subscribe( |
81 | () => { | 79 | () => { |
82 | const handle = follow.follower.name + '@' + follow.follower.host | 80 | const handle = follow.follower.name + '@' + follow.follower.host |
83 | this.notifier.success(this.i18n('{{handle}} removed from instance followers', { handle })) | 81 | this.notifier.success($localize`${handle} removed from instance followers`) |
84 | 82 | ||
85 | this.loadData() | 83 | this.loadData() |
86 | }, | 84 | }, |
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 dae8923b5..5f71f1238 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 | |||
@@ -3,7 +3,6 @@ import { Component, OnInit, ViewChild } from '@angular/core' | |||
3 | import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' | 3 | import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' |
4 | import { InstanceFollowService } from '@app/shared/shared-instance' | 4 | import { InstanceFollowService } from '@app/shared/shared-instance' |
5 | import { BatchDomainsModalComponent } from '@app/shared/shared-moderation' | 5 | import { BatchDomainsModalComponent } from '@app/shared/shared-moderation' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
7 | import { ActorFollow } from '@shared/models' | 6 | import { ActorFollow } from '@shared/models' |
8 | 7 | ||
9 | @Component({ | 8 | @Component({ |
@@ -22,9 +21,8 @@ export class FollowingListComponent extends RestTable implements OnInit { | |||
22 | constructor ( | 21 | constructor ( |
23 | private notifier: Notifier, | 22 | private notifier: Notifier, |
24 | private confirmService: ConfirmService, | 23 | private confirmService: ConfirmService, |
25 | private followService: InstanceFollowService, | 24 | private followService: InstanceFollowService |
26 | private i18n: I18n | 25 | ) { |
27 | ) { | ||
28 | super() | 26 | super() |
29 | } | 27 | } |
30 | 28 | ||
@@ -47,7 +45,7 @@ export class FollowingListComponent extends RestTable implements OnInit { | |||
47 | async addFollowing (hosts: string[]) { | 45 | async addFollowing (hosts: string[]) { |
48 | this.followService.follow(hosts).subscribe( | 46 | this.followService.follow(hosts).subscribe( |
49 | () => { | 47 | () => { |
50 | this.notifier.success(this.i18n('Follow request(s) sent!')) | 48 | this.notifier.success($localize`Follow request(s) sent!`) |
51 | this.loadData() | 49 | this.loadData() |
52 | }, | 50 | }, |
53 | 51 | ||
@@ -57,14 +55,14 @@ export class FollowingListComponent extends RestTable implements OnInit { | |||
57 | 55 | ||
58 | async removeFollowing (follow: ActorFollow) { | 56 | async removeFollowing (follow: ActorFollow) { |
59 | const res = await this.confirmService.confirm( | 57 | const res = await this.confirmService.confirm( |
60 | this.i18n('Do you really want to unfollow {{host}}?', { host: follow.following.host }), | 58 | $localize`Do you really want to unfollow ${follow.following.host}?`, |
61 | this.i18n('Unfollow') | 59 | $localize`Unfollow` |
62 | ) | 60 | ) |
63 | if (res === false) return | 61 | if (res === false) return |
64 | 62 | ||
65 | this.followService.unfollow(follow).subscribe( | 63 | this.followService.unfollow(follow).subscribe( |
66 | () => { | 64 | () => { |
67 | this.notifier.success(this.i18n('You are not following {{host}} anymore.', { host: follow.following.host })) | 65 | this.notifier.success($localize`You are not following ${follow.following.host} anymore.`) |
68 | this.loadData() | 66 | this.loadData() |
69 | }, | 67 | }, |
70 | 68 | ||
diff --git a/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts b/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts index 662143abc..729b7f599 100644 --- a/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts +++ b/client/src/app/+admin/follows/shared/redundancy-checkbox.component.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input } from '@angular/core' |
2 | import { Notifier } from '@app/core' | 2 | import { Notifier } from '@app/core' |
3 | import { RedundancyService } from '@app/shared/shared-main' | 3 | import { RedundancyService } from '@app/shared/shared-main' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
5 | 4 | ||
6 | @Component({ | 5 | @Component({ |
7 | selector: 'my-redundancy-checkbox', | 6 | selector: 'my-redundancy-checkbox', |
@@ -14,17 +13,16 @@ export class RedundancyCheckboxComponent { | |||
14 | 13 | ||
15 | constructor ( | 14 | constructor ( |
16 | private notifier: Notifier, | 15 | private notifier: Notifier, |
17 | private redundancyService: RedundancyService, | 16 | private redundancyService: RedundancyService |
18 | private i18n: I18n | 17 | ) { } |
19 | ) { } | ||
20 | 18 | ||
21 | updateRedundancyState () { | 19 | updateRedundancyState () { |
22 | this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed) | 20 | this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed) |
23 | .subscribe( | 21 | .subscribe( |
24 | () => { | 22 | () => { |
25 | const stateLabel = this.redundancyAllowed ? this.i18n('enabled') : this.i18n('disabled') | 23 | const stateLabel = this.redundancyAllowed ? $localize`enabled` : $localize`disabled` |
26 | 24 | ||
27 | this.notifier.success(this.i18n('Redundancy for {{host}} is {{stateLabel}}', { host: this.host, stateLabel })) | 25 | this.notifier.success($localize`Redundancy for ${this.host} is ${stateLabel}`) |
28 | }, | 26 | }, |
29 | 27 | ||
30 | err => this.notifier.error(err.message) | 28 | err => this.notifier.error(err.message) |
diff --git a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts index 07e2e0ff3..d6fd1a1ab 100644 --- a/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts +++ b/client/src/app/+admin/follows/video-redundancies-list/video-redundancies-list.component.ts | |||
@@ -2,7 +2,6 @@ import { SortMeta } from 'primeng/api' | |||
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { ConfirmService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' | 3 | import { ConfirmService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' |
4 | import { BytesPipe, RedundancyService } from '@app/shared/shared-main' | 4 | import { BytesPipe, RedundancyService } from '@app/shared/shared-main' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | 5 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
7 | import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' | 6 | import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models' |
8 | import { VideosRedundancyStats } from '@shared/models/server' | 7 | import { VideosRedundancyStats } from '@shared/models/server' |
@@ -32,9 +31,8 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit | |||
32 | private notifier: Notifier, | 31 | private notifier: Notifier, |
33 | private confirmService: ConfirmService, | 32 | private confirmService: ConfirmService, |
34 | private redundancyService: RedundancyService, | 33 | private redundancyService: RedundancyService, |
35 | private serverService: ServerService, | 34 | private serverService: ServerService |
36 | private i18n: I18n | 35 | ) { |
37 | ) { | ||
38 | super() | 36 | super() |
39 | 37 | ||
40 | this.bytesPipe = new BytesPipe() | 38 | this.bytesPipe = new BytesPipe() |
@@ -100,7 +98,7 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit | |||
100 | this.redundanciesGraphsData.push({ | 98 | this.redundanciesGraphsData.push({ |
101 | stats, | 99 | stats, |
102 | graphData: { | 100 | graphData: { |
103 | labels: [ this.i18n('Used'), this.i18n('Available') ], | 101 | labels: [ $localize`Used`, $localize`Available` ], |
104 | datasets: [ | 102 | datasets: [ |
105 | { | 103 | { |
106 | data: [ stats.totalUsed, totalSize ], | 104 | data: [ stats.totalUsed, totalSize ], |
@@ -139,14 +137,14 @@ export class VideoRedundanciesListComponent extends RestTable implements OnInit | |||
139 | } | 137 | } |
140 | 138 | ||
141 | async removeRedundancy (redundancy: VideoRedundancy) { | 139 | async removeRedundancy (redundancy: VideoRedundancy) { |
142 | const message = this.i18n('Do you really want to remove this video redundancy?') | 140 | const message = $localize`Do you really want to remove this video redundancy?` |
143 | const res = await this.confirmService.confirm(message, this.i18n('Remove redundancy')) | 141 | const res = await this.confirmService.confirm(message, $localize`Remove redundancy`) |
144 | if (res === false) return | 142 | if (res === false) return |
145 | 143 | ||
146 | this.redundancyService.removeVideoRedundancies(redundancy) | 144 | this.redundancyService.removeVideoRedundancies(redundancy) |
147 | .subscribe( | 145 | .subscribe( |
148 | () => { | 146 | () => { |
149 | this.notifier.success(this.i18n('Video redundancies removed!')) | 147 | this.notifier.success($localize`Video redundancies removed!`) |
150 | this.loadData() | 148 | this.loadData() |
151 | }, | 149 | }, |
152 | 150 | ||
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts index 422d873c0..2b1ef663c 100644 --- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts +++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts | |||
@@ -1,15 +1,14 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { filter, switchMap } from 'rxjs/operators' | 2 | import { filter, switchMap } from 'rxjs/operators' |
3 | import { buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/utils' | ||
4 | import { environment } from 'src/environments/environment' | ||
3 | import { AfterViewInit, Component, OnInit } from '@angular/core' | 5 | import { AfterViewInit, Component, OnInit } from '@angular/core' |
6 | import { DomSanitizer } from '@angular/platform-browser' | ||
4 | import { ActivatedRoute, Params, Router } from '@angular/router' | 7 | import { ActivatedRoute, Params, Router } from '@angular/router' |
5 | import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' | 8 | import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core' |
6 | import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' | 9 | import { DropdownAction, Video, VideoService } from '@app/shared/shared-main' |
7 | import { VideoBlockService } from '@app/shared/shared-moderation' | 10 | import { VideoBlockService } from '@app/shared/shared-moderation' |
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { VideoBlacklist, VideoBlacklistType } from '@shared/models' | 11 | import { VideoBlacklist, VideoBlacklistType } from '@shared/models' |
10 | import { buildVideoOrPlaylistEmbed, buildVideoLink } from 'src/assets/player/utils' | ||
11 | import { environment } from 'src/environments/environment' | ||
12 | import { DomSanitizer } from '@angular/platform-browser' | ||
13 | 12 | ||
14 | @Component({ | 13 | @Component({ |
15 | selector: 'my-video-block-list', | 14 | selector: 'my-video-block-list', |
@@ -34,26 +33,25 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
34 | private sanitizer: DomSanitizer, | 33 | private sanitizer: DomSanitizer, |
35 | private videoService: VideoService, | 34 | private videoService: VideoService, |
36 | private route: ActivatedRoute, | 35 | private route: ActivatedRoute, |
37 | private router: Router, | 36 | private router: Router |
38 | private i18n: I18n | 37 | ) { |
39 | ) { | ||
40 | super() | 38 | super() |
41 | 39 | ||
42 | this.videoBlocklistActions = [ | 40 | this.videoBlocklistActions = [ |
43 | [ | 41 | [ |
44 | { | 42 | { |
45 | label: this.i18n('Internal actions'), | 43 | label: $localize`Internal actions`, |
46 | isHeader: true, | 44 | isHeader: true, |
47 | isDisplayed: videoBlock => videoBlock.type === VideoBlacklistType.AUTO_BEFORE_PUBLISHED | 45 | isDisplayed: videoBlock => videoBlock.type === VideoBlacklistType.AUTO_BEFORE_PUBLISHED |
48 | }, | 46 | }, |
49 | { | 47 | { |
50 | label: this.i18n('Switch video block to manual'), | 48 | label: $localize`Switch video block to manual`, |
51 | handler: videoBlock => { | 49 | handler: videoBlock => { |
52 | this.videoBlocklistService.unblockVideo(videoBlock.video.id).pipe( | 50 | this.videoBlocklistService.unblockVideo(videoBlock.video.id).pipe( |
53 | switchMap(_ => this.videoBlocklistService.blockVideo(videoBlock.video.id, undefined, true)) | 51 | switchMap(_ => this.videoBlocklistService.blockVideo(videoBlock.video.id, undefined, true)) |
54 | ).subscribe( | 52 | ).subscribe( |
55 | () => { | 53 | () => { |
56 | this.notifier.success(this.i18n('Video {{name}} switched to manual block.', { name: videoBlock.video.name })) | 54 | this.notifier.success($localize`Video ${videoBlock.video.name} switched to manual block.`) |
57 | this.loadData() | 55 | this.loadData() |
58 | }, | 56 | }, |
59 | 57 | ||
@@ -65,27 +63,27 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
65 | ], | 63 | ], |
66 | [ | 64 | [ |
67 | { | 65 | { |
68 | label: this.i18n('Actions for the video'), | 66 | label: $localize`Actions for the video`, |
69 | isHeader: true | 67 | isHeader: true |
70 | }, | 68 | }, |
71 | { | 69 | { |
72 | label: this.i18n('Unblock'), | 70 | label: $localize`Unblock`, |
73 | handler: videoBlock => this.unblockVideo(videoBlock) | 71 | handler: videoBlock => this.unblockVideo(videoBlock) |
74 | }, | 72 | }, |
75 | 73 | ||
76 | { | 74 | { |
77 | label: this.i18n('Delete'), | 75 | label: $localize`Delete`, |
78 | handler: async videoBlock => { | 76 | handler: async videoBlock => { |
79 | const res = await this.confirmService.confirm( | 77 | const res = await this.confirmService.confirm( |
80 | this.i18n('Do you really want to delete this video?'), | 78 | $localize`Do you really want to delete this video?`, |
81 | this.i18n('Delete') | 79 | $localize`Delete` |
82 | ) | 80 | ) |
83 | if (res === false) return | 81 | if (res === false) return |
84 | 82 | ||
85 | this.videoService.removeVideo(videoBlock.video.id) | 83 | this.videoService.removeVideo(videoBlock.video.id) |
86 | .subscribe( | 84 | .subscribe( |
87 | () => { | 85 | () => { |
88 | this.notifier.success(this.i18n('Video deleted.')) | 86 | this.notifier.success($localize`Video deleted.`) |
89 | }, | 87 | }, |
90 | 88 | ||
91 | err => this.notifier.error(err.message) | 89 | err => this.notifier.error(err.message) |
@@ -148,9 +146,9 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
148 | } | 146 | } |
149 | 147 | ||
150 | booleanToText (value: boolean) { | 148 | booleanToText (value: boolean) { |
151 | if (value === true) return this.i18n('yes') | 149 | if (value === true) return $localize`yes` |
152 | 150 | ||
153 | return this.i18n('no') | 151 | return $localize`no` |
154 | } | 152 | } |
155 | 153 | ||
156 | toHtml (text: string) { | 154 | toHtml (text: string) { |
@@ -158,16 +156,14 @@ export class VideoBlockListComponent extends RestTable implements OnInit, AfterV | |||
158 | } | 156 | } |
159 | 157 | ||
160 | async unblockVideo (entry: VideoBlacklist) { | 158 | async unblockVideo (entry: VideoBlacklist) { |
161 | const confirmMessage = this.i18n( | 159 | const confirmMessage = $localize`Do you really want to unblock this video? It will be available again in the videos list.` |
162 | 'Do you really want to unblock this video? It will be available again in the videos list.' | ||
163 | ) | ||
164 | 160 | ||
165 | const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblock')) | 161 | const res = await this.confirmService.confirm(confirmMessage, $localize`Unblock`) |
166 | if (res === false) return | 162 | if (res === false) return |
167 | 163 | ||
168 | this.videoBlocklistService.unblockVideo(entry.video.id).subscribe( | 164 | this.videoBlocklistService.unblockVideo(entry.video.id).subscribe( |
169 | () => { | 165 | () => { |
170 | this.notifier.success(this.i18n('Video {{name}} unblocked.', { name: entry.video.name })) | 166 | this.notifier.success($localize`Video ${entry.video.name} unblocked.`) |
171 | this.loadData() | 167 | this.loadData() |
172 | }, | 168 | }, |
173 | 169 | ||
diff --git a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts index af31f1144..1ffd001c6 100644 --- a/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts +++ b/client/src/app/+admin/plugins/plugin-list-installed/plugin-list-installed.component.ts | |||
@@ -4,7 +4,6 @@ import { ActivatedRoute, Router } from '@angular/router' | |||
4 | import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service' | 4 | import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service' |
5 | import { ComponentPagination, ConfirmService, hasMoreItems, Notifier } from '@app/core' | 5 | import { ComponentPagination, ConfirmService, hasMoreItems, Notifier } from '@app/core' |
6 | import { PluginService } from '@app/core/plugins/plugin.service' | 6 | import { PluginService } from '@app/core/plugins/plugin.service' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
8 | import { compareSemVer } from '@shared/core-utils/miscs/miscs' | 7 | import { compareSemVer } from '@shared/core-utils/miscs/miscs' |
9 | import { PeerTubePlugin } from '@shared/models/plugins/peertube-plugin.model' | 8 | import { PeerTubePlugin } from '@shared/models/plugins/peertube-plugin.model' |
10 | import { PluginType } from '@shared/models/plugins/plugin.type' | 9 | import { PluginType } from '@shared/models/plugins/plugin.type' |
@@ -37,7 +36,6 @@ export class PluginListInstalledComponent implements OnInit { | |||
37 | onDataSubject = new Subject<any[]>() | 36 | onDataSubject = new Subject<any[]>() |
38 | 37 | ||
39 | constructor ( | 38 | constructor ( |
40 | private i18n: I18n, | ||
41 | private pluginService: PluginService, | 39 | private pluginService: PluginService, |
42 | private pluginApiService: PluginApiService, | 40 | private pluginApiService: PluginApiService, |
43 | private notifier: Notifier, | 41 | private notifier: Notifier, |
@@ -88,10 +86,10 @@ export class PluginListInstalledComponent implements OnInit { | |||
88 | 86 | ||
89 | getNoResultMessage () { | 87 | getNoResultMessage () { |
90 | if (this.pluginType === PluginType.PLUGIN) { | 88 | if (this.pluginType === PluginType.PLUGIN) { |
91 | return this.i18n("You don't have plugins installed yet.") | 89 | return $localize`You don't have plugins installed yet.` |
92 | } | 90 | } |
93 | 91 | ||
94 | return this.i18n("You don't have themes installed yet.") | 92 | return $localize`You don't have themes installed yet.` |
95 | } | 93 | } |
96 | 94 | ||
97 | isUpdateAvailable (plugin: PeerTubePlugin) { | 95 | isUpdateAvailable (plugin: PeerTubePlugin) { |
@@ -99,7 +97,7 @@ export class PluginListInstalledComponent implements OnInit { | |||
99 | } | 97 | } |
100 | 98 | ||
101 | getUpdateLabel (plugin: PeerTubePlugin) { | 99 | getUpdateLabel (plugin: PeerTubePlugin) { |
102 | return this.i18n('Update to {{version}}', { version: plugin.latestVersion }) | 100 | return $localize`Update to ${plugin.latestVersion}` |
103 | } | 101 | } |
104 | 102 | ||
105 | isUpdating (plugin: PeerTubePlugin) { | 103 | isUpdating (plugin: PeerTubePlugin) { |
@@ -108,15 +106,15 @@ export class PluginListInstalledComponent implements OnInit { | |||
108 | 106 | ||
109 | async uninstall (plugin: PeerTubePlugin) { | 107 | async uninstall (plugin: PeerTubePlugin) { |
110 | const res = await this.confirmService.confirm( | 108 | const res = await this.confirmService.confirm( |
111 | this.i18n('Do you really want to uninstall {{pluginName}}?', { pluginName: plugin.name }), | 109 | $localize`Do you really want to uninstall ${plugin.name}?`, |
112 | this.i18n('Uninstall') | 110 | $localize`Uninstall` |
113 | ) | 111 | ) |
114 | if (res === false) return | 112 | if (res === false) return |
115 | 113 | ||
116 | this.pluginApiService.uninstall(plugin.name, plugin.type) | 114 | this.pluginApiService.uninstall(plugin.name, plugin.type) |
117 | .subscribe( | 115 | .subscribe( |
118 | () => { | 116 | () => { |
119 | this.notifier.success(this.i18n('{{pluginName}} uninstalled.', { pluginName: plugin.name })) | 117 | this.notifier.success($localize`${plugin.name} uninstalled.`) |
120 | 118 | ||
121 | this.plugins = this.plugins.filter(p => p.name !== plugin.name) | 119 | this.plugins = this.plugins.filter(p => p.name !== plugin.name) |
122 | this.pagination.totalItems-- | 120 | this.pagination.totalItems-- |
@@ -138,7 +136,7 @@ export class PluginListInstalledComponent implements OnInit { | |||
138 | res => { | 136 | res => { |
139 | this.updating[updatingKey] = false | 137 | this.updating[updatingKey] = false |
140 | 138 | ||
141 | this.notifier.success(this.i18n('{{pluginName}} updated.', { pluginName: plugin.name })) | 139 | this.notifier.success($localize`${plugin.name} updated.`) |
142 | 140 | ||
143 | Object.assign(plugin, res) | 141 | Object.assign(plugin, res) |
144 | }, | 142 | }, |
diff --git a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts index ccf9f1ed5..1a6b4eba3 100644 --- a/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts +++ b/client/src/app/+admin/plugins/plugin-search/plugin-search.component.ts | |||
@@ -3,8 +3,7 @@ import { debounceTime, distinctUntilChanged } from 'rxjs/operators' | |||
3 | import { Component, OnInit } from '@angular/core' | 3 | import { Component, OnInit } from '@angular/core' |
4 | import { ActivatedRoute, Router } from '@angular/router' | 4 | import { ActivatedRoute, Router } from '@angular/router' |
5 | import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service' | 5 | import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service' |
6 | import { ComponentPagination, ConfirmService, hasMoreItems, Notifier, ServerService } from '@app/core' | 6 | import { ComponentPagination, ConfirmService, hasMoreItems, Notifier } from '@app/core' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
8 | import { PeerTubePluginIndex } from '@shared/models/plugins/peertube-plugin-index.model' | 7 | import { PeerTubePluginIndex } from '@shared/models/plugins/peertube-plugin-index.model' |
9 | import { PluginType } from '@shared/models/plugins/plugin.type' | 8 | import { PluginType } from '@shared/models/plugins/plugin.type' |
10 | 9 | ||
@@ -40,8 +39,6 @@ export class PluginSearchComponent implements OnInit { | |||
40 | private searchSubject = new Subject<string>() | 39 | private searchSubject = new Subject<string>() |
41 | 40 | ||
42 | constructor ( | 41 | constructor ( |
43 | private server: ServerService, | ||
44 | private i18n: I18n, | ||
45 | private pluginService: PluginApiService, | 42 | private pluginService: PluginApiService, |
46 | private notifier: Notifier, | 43 | private notifier: Notifier, |
47 | private confirmService: ConfirmService, | 44 | private confirmService: ConfirmService, |
@@ -100,7 +97,7 @@ export class PluginSearchComponent implements OnInit { | |||
100 | err => { | 97 | err => { |
101 | console.error(err) | 98 | console.error(err) |
102 | 99 | ||
103 | const message = this.i18n('The plugin index is not available. Please retry later.') | 100 | const message = $localize`The plugin index is not available. Please retry later.` |
104 | this.notifier.error(message) | 101 | this.notifier.error(message) |
105 | } | 102 | } |
106 | ) | 103 | ) |
@@ -122,8 +119,8 @@ export class PluginSearchComponent implements OnInit { | |||
122 | if (this.installing[plugin.npmName]) return | 119 | if (this.installing[plugin.npmName]) return |
123 | 120 | ||
124 | const res = await this.confirmService.confirm( | 121 | const res = await this.confirmService.confirm( |
125 | this.i18n('Please only install plugins or themes you trust, since they can execute any code on your instance.'), | 122 | $localize`Please only install plugins or themes you trust, since they can execute any code on your instance.`, |
126 | this.i18n('Install {{pluginName}}?', { pluginName: plugin.name }) | 123 | $localize`Install ${plugin.name}?` |
127 | ) | 124 | ) |
128 | if (res === false) return | 125 | if (res === false) return |
129 | 126 | ||
@@ -135,7 +132,7 @@ export class PluginSearchComponent implements OnInit { | |||
135 | this.installing[plugin.npmName] = false | 132 | this.installing[plugin.npmName] = false |
136 | this.pluginInstalled = true | 133 | this.pluginInstalled = true |
137 | 134 | ||
138 | this.notifier.success(this.i18n('{{pluginName}} installed.', { pluginName: plugin.name })) | 135 | this.notifier.success($localize`${plugin.name} installed.`) |
139 | 136 | ||
140 | plugin.installed = true | 137 | plugin.installed = true |
141 | }, | 138 | }, |
diff --git a/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts b/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts index dde03f1da..a33f01691 100644 --- a/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts +++ b/client/src/app/+admin/plugins/plugin-show-installed/plugin-show-installed.component.ts | |||
@@ -4,7 +4,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core' | |||
4 | import { ActivatedRoute } from '@angular/router' | 4 | import { ActivatedRoute } from '@angular/router' |
5 | import { Notifier } from '@app/core' | 5 | import { Notifier } from '@app/core' |
6 | import { BuildFormArgument, FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 6 | import { BuildFormArgument, FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
8 | import { PeerTubePlugin, RegisterServerSettingOptions } from '@shared/models' | 7 | import { PeerTubePlugin, RegisterServerSettingOptions } from '@shared/models' |
9 | import { PluginApiService } from '../shared/plugin-api.service' | 8 | import { PluginApiService } from '../shared/plugin-api.service' |
10 | 9 | ||
@@ -22,7 +21,6 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit | |||
22 | 21 | ||
23 | constructor ( | 22 | constructor ( |
24 | protected formValidatorService: FormValidatorService, | 23 | protected formValidatorService: FormValidatorService, |
25 | private i18n: I18n, | ||
26 | private pluginService: PluginApiService, | 24 | private pluginService: PluginApiService, |
27 | private notifier: Notifier, | 25 | private notifier: Notifier, |
28 | private route: ActivatedRoute | 26 | private route: ActivatedRoute |
@@ -50,7 +48,7 @@ export class PluginShowInstalledComponent extends FormReactive implements OnInit | |||
50 | this.pluginService.updatePluginSettings(this.plugin.name, this.plugin.type, settings) | 48 | this.pluginService.updatePluginSettings(this.plugin.name, this.plugin.type, settings) |
51 | .subscribe( | 49 | .subscribe( |
52 | () => { | 50 | () => { |
53 | this.notifier.success(this.i18n('Settings updated.')) | 51 | this.notifier.success($localize`Settings updated.`) |
54 | }, | 52 | }, |
55 | 53 | ||
56 | err => this.notifier.error(err.message) | 54 | err => this.notifier.error(err.message) |
diff --git a/client/src/app/+admin/plugins/shared/plugin-api.service.ts b/client/src/app/+admin/plugins/shared/plugin-api.service.ts index 1fb827832..b28d46df4 100644 --- a/client/src/app/+admin/plugins/shared/plugin-api.service.ts +++ b/client/src/app/+admin/plugins/shared/plugin-api.service.ts | |||
@@ -4,7 +4,6 @@ import { HttpClient, HttpParams } from '@angular/common/http' | |||
4 | import { Injectable } from '@angular/core' | 4 | import { Injectable } from '@angular/core' |
5 | import { ComponentPagination, RestExtractor, RestService } from '@app/core' | 5 | import { ComponentPagination, RestExtractor, RestService } from '@app/core' |
6 | import { PluginService } from '@app/core/plugins/plugin.service' | 6 | import { PluginService } from '@app/core/plugins/plugin.service' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
8 | import { peertubeTranslate } from '@shared/core-utils/i18n' | 7 | import { peertubeTranslate } from '@shared/core-utils/i18n' |
9 | import { | 8 | import { |
10 | InstallOrUpdatePlugin, | 9 | InstallOrUpdatePlugin, |
@@ -25,18 +24,17 @@ export class PluginApiService { | |||
25 | private authHttp: HttpClient, | 24 | private authHttp: HttpClient, |
26 | private restExtractor: RestExtractor, | 25 | private restExtractor: RestExtractor, |
27 | private restService: RestService, | 26 | private restService: RestService, |
28 | private i18n: I18n, | ||
29 | private pluginService: PluginService | 27 | private pluginService: PluginService |
30 | ) { } | 28 | ) { } |
31 | 29 | ||
32 | getPluginTypeOptions () { | 30 | getPluginTypeOptions () { |
33 | return [ | 31 | return [ |
34 | { | 32 | { |
35 | label: this.i18n('Plugins'), | 33 | label: $localize`Plugins`, |
36 | value: PluginType.PLUGIN | 34 | value: PluginType.PLUGIN |
37 | }, | 35 | }, |
38 | { | 36 | { |
39 | label: this.i18n('Themes'), | 37 | label: $localize`Themes`, |
40 | value: PluginType.THEME | 38 | value: PluginType.THEME |
41 | } | 39 | } |
42 | ] | 40 | ] |
@@ -44,10 +42,10 @@ export class PluginApiService { | |||
44 | 42 | ||
45 | getPluginTypeLabel (type: PluginType) { | 43 | getPluginTypeLabel (type: PluginType) { |
46 | if (type === PluginType.PLUGIN) { | 44 | if (type === PluginType.PLUGIN) { |
47 | return this.i18n('plugin') | 45 | return $localize`plugin` |
48 | } | 46 | } |
49 | 47 | ||
50 | return this.i18n('theme') | 48 | return $localize`theme` |
51 | } | 49 | } |
52 | 50 | ||
53 | getPlugins ( | 51 | getPlugins ( |
diff --git a/client/src/app/+admin/system/jobs/jobs.component.ts b/client/src/app/+admin/system/jobs/jobs.component.ts index ceb848976..96e0f25b0 100644 --- a/client/src/app/+admin/system/jobs/jobs.component.ts +++ b/client/src/app/+admin/system/jobs/jobs.component.ts | |||
@@ -2,7 +2,6 @@ import { SortMeta } from 'primeng/api' | |||
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { Notifier, RestPagination, RestTable } from '@app/core' | 3 | import { Notifier, RestPagination, RestTable } from '@app/core' |
4 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | 4 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | import { Job, JobState, JobType } from '@shared/models' | 5 | import { Job, JobState, JobType } from '@shared/models' |
7 | import { JobStateClient } from '../../../../types/job-state-client.type' | 6 | import { JobStateClient } from '../../../../types/job-state-client.type' |
8 | import { JobTypeClient } from '../../../../types/job-type-client.type' | 7 | import { JobTypeClient } from '../../../../types/job-type-client.type' |
@@ -43,9 +42,8 @@ export class JobsComponent extends RestTable implements OnInit { | |||
43 | 42 | ||
44 | constructor ( | 43 | constructor ( |
45 | private notifier: Notifier, | 44 | private notifier: Notifier, |
46 | private jobsService: JobService, | 45 | private jobsService: JobService |
47 | private i18n: I18n | 46 | ) { |
48 | ) { | ||
49 | super() | 47 | super() |
50 | } | 48 | } |
51 | 49 | ||
diff --git a/client/src/app/+admin/system/logs/logs.component.ts b/client/src/app/+admin/system/logs/logs.component.ts index 51f047188..c9c9dc3d1 100644 --- a/client/src/app/+admin/system/logs/logs.component.ts +++ b/client/src/app/+admin/system/logs/logs.component.ts | |||
@@ -1,6 +1,5 @@ | |||
1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' | 1 | import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' |
2 | import { Notifier } from '@app/core' | 2 | import { Notifier } from '@app/core' |
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
4 | import { LogLevel } from '@shared/models' | 3 | import { LogLevel } from '@shared/models' |
5 | import { LogRow } from './log-row.model' | 4 | import { LogRow } from './log-row.model' |
6 | import { LogsService } from './logs.service' | 5 | import { LogsService } from './logs.service' |
@@ -25,9 +24,8 @@ export class LogsComponent implements OnInit { | |||
25 | 24 | ||
26 | constructor ( | 25 | constructor ( |
27 | private logsService: LogsService, | 26 | private logsService: LogsService, |
28 | private notifier: Notifier, | 27 | private notifier: Notifier |
29 | private i18n: I18n | 28 | ) { } |
30 | ) { } | ||
31 | 29 | ||
32 | ngOnInit (): void { | 30 | ngOnInit (): void { |
33 | this.buildTimeChoices() | 31 | this.buildTimeChoices() |
@@ -78,15 +76,15 @@ export class LogsComponent implements OnInit { | |||
78 | this.timeChoices = [ | 76 | this.timeChoices = [ |
79 | { | 77 | { |
80 | id: lastWeek.toISOString(), | 78 | id: lastWeek.toISOString(), |
81 | label: this.i18n('Last week') | 79 | label: $localize`Last week` |
82 | }, | 80 | }, |
83 | { | 81 | { |
84 | id: lastDay.toISOString(), | 82 | id: lastDay.toISOString(), |
85 | label: this.i18n('Last day') | 83 | label: $localize`Last day` |
86 | }, | 84 | }, |
87 | { | 85 | { |
88 | id: lastHour.toISOString(), | 86 | id: lastHour.toISOString(), |
89 | label: this.i18n('Last hour') | 87 | label: $localize`Last hour` |
90 | } | 88 | } |
91 | ] | 89 | ] |
92 | 90 | ||
@@ -97,19 +95,19 @@ export class LogsComponent implements OnInit { | |||
97 | this.levelChoices = [ | 95 | this.levelChoices = [ |
98 | { | 96 | { |
99 | id: 'debug', | 97 | id: 'debug', |
100 | label: this.i18n('Debug') | 98 | label: $localize`Debug` |
101 | }, | 99 | }, |
102 | { | 100 | { |
103 | id: 'info', | 101 | id: 'info', |
104 | label: this.i18n('Info') | 102 | label: $localize`Info` |
105 | }, | 103 | }, |
106 | { | 104 | { |
107 | id: 'warn', | 105 | id: 'warn', |
108 | label: this.i18n('Warning') | 106 | label: $localize`Warning` |
109 | }, | 107 | }, |
110 | { | 108 | { |
111 | id: 'error', | 109 | id: 'error', |
112 | label: this.i18n('Error') | 110 | label: $localize`Error` |
113 | } | 111 | } |
114 | ] | 112 | ] |
115 | 113 | ||
@@ -120,11 +118,11 @@ export class LogsComponent implements OnInit { | |||
120 | this.logTypeChoices = [ | 118 | this.logTypeChoices = [ |
121 | { | 119 | { |
122 | id: 'standard', | 120 | id: 'standard', |
123 | label: this.i18n('Standard logs') | 121 | label: $localize`Standard logs` |
124 | }, | 122 | }, |
125 | { | 123 | { |
126 | id: 'audit', | 124 | id: 'audit', |
127 | label: this.i18n('Audit logs') | 125 | label: $localize`Audit logs` |
128 | } | 126 | } |
129 | ] | 127 | ] |
130 | 128 | ||
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 3fddb9c09..36d71a927 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 | |||
@@ -3,7 +3,6 @@ import { ActivatedRoute, Router } from '@angular/router' | |||
3 | import { ConfigService } from '@app/+admin/config/shared/config.service' | 3 | import { ConfigService } from '@app/+admin/config/shared/config.service' |
4 | import { AuthService, Notifier, ScreenService, ServerService, UserService } from '@app/core' | 4 | import { AuthService, Notifier, ScreenService, ServerService, UserService } from '@app/core' |
5 | import { FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' | 5 | import { FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
7 | import { UserCreate, UserRole } from '@shared/models' | 6 | import { UserCreate, UserRole } from '@shared/models' |
8 | import { UserEdit } from './user-edit' | 7 | import { UserEdit } from './user-edit' |
9 | 8 | ||
@@ -25,9 +24,8 @@ export class UserCreateComponent extends UserEdit implements OnInit { | |||
25 | private route: ActivatedRoute, | 24 | private route: ActivatedRoute, |
26 | private router: Router, | 25 | private router: Router, |
27 | private notifier: Notifier, | 26 | private notifier: Notifier, |
28 | private userService: UserService, | 27 | private userService: UserService |
29 | private i18n: I18n | 28 | ) { |
30 | ) { | ||
31 | super() | 29 | super() |
32 | 30 | ||
33 | this.buildQuotaOptions() | 31 | this.buildQuotaOptions() |
@@ -67,7 +65,7 @@ export class UserCreateComponent extends UserEdit implements OnInit { | |||
67 | 65 | ||
68 | this.userService.addUser(userCreate).subscribe( | 66 | this.userService.addUser(userCreate).subscribe( |
69 | () => { | 67 | () => { |
70 | this.notifier.success(this.i18n('User {{username}} created.', { username: userCreate.username })) | 68 | this.notifier.success($localize`User ${userCreate.username} created.`) |
71 | this.router.navigate([ '/admin/users/list' ]) | 69 | this.router.navigate([ '/admin/users/list' ]) |
72 | }, | 70 | }, |
73 | 71 | ||
@@ -85,6 +83,6 @@ export class UserCreateComponent extends UserEdit implements OnInit { | |||
85 | } | 83 | } |
86 | 84 | ||
87 | getFormButtonTitle () { | 85 | getFormButtonTitle () { |
88 | return this.i18n('Create user') | 86 | return $localize`Create user` |
89 | } | 87 | } |
90 | } | 88 | } |
diff --git a/client/src/app/+admin/users/user-edit/user-password.component.ts b/client/src/app/+admin/users/user-edit/user-password.component.ts index 33c7de31f..25f13495a 100644 --- a/client/src/app/+admin/users/user-edit/user-password.component.ts +++ b/client/src/app/+admin/users/user-edit/user-password.component.ts | |||
@@ -1,7 +1,6 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { Notifier, UserService } from '@app/core' | 2 | import { Notifier, UserService } from '@app/core' |
3 | import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' | 3 | import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' |
4 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
5 | import { UserUpdate } from '@shared/models' | 4 | import { UserUpdate } from '@shared/models' |
6 | 5 | ||
7 | @Component({ | 6 | @Component({ |
@@ -20,9 +19,8 @@ export class UserPasswordComponent extends FormReactive implements OnInit { | |||
20 | protected formValidatorService: FormValidatorService, | 19 | protected formValidatorService: FormValidatorService, |
21 | private userValidatorsService: UserValidatorsService, | 20 | private userValidatorsService: UserValidatorsService, |
22 | private notifier: Notifier, | 21 | private notifier: Notifier, |
23 | private userService: UserService, | 22 | private userService: UserService |
24 | private i18n: I18n | 23 | ) { |
25 | ) { | ||
26 | super() | 24 | super() |
27 | } | 25 | } |
28 | 26 | ||
@@ -39,9 +37,7 @@ export class UserPasswordComponent extends FormReactive implements OnInit { | |||
39 | 37 | ||
40 | this.userService.updateUser(this.userId, userUpdate).subscribe( | 38 | this.userService.updateUser(this.userId, userUpdate).subscribe( |
41 | () => { | 39 | () => { |
42 | this.notifier.success( | 40 | this.notifier.success($localize`Password changed for user ${this.username}.`) |
43 | this.i18n('Password changed for user {{username}}.', { username: this.username }) | ||
44 | ) | ||
45 | }, | 41 | }, |
46 | 42 | ||
47 | err => this.error = err.message | 43 | err => this.error = err.message |
@@ -53,6 +49,6 @@ export class UserPasswordComponent extends FormReactive implements OnInit { | |||
53 | } | 49 | } |
54 | 50 | ||
55 | getFormButtonTitle () { | 51 | getFormButtonTitle () { |
56 | return this.i18n('Update user password') | 52 | return $localize`Update user password` |
57 | } | 53 | } |
58 | } | 54 | } |
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 870880fee..55bc7290e 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 | |||
@@ -4,7 +4,6 @@ import { ActivatedRoute, Router } from '@angular/router' | |||
4 | import { ConfigService } from '@app/+admin/config/shared/config.service' | 4 | import { ConfigService } from '@app/+admin/config/shared/config.service' |
5 | import { AuthService, Notifier, ScreenService, ServerService, User, UserService } from '@app/core' | 5 | import { AuthService, Notifier, ScreenService, ServerService, User, UserService } from '@app/core' |
6 | import { FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' | 6 | import { FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
8 | import { User as UserType, UserAdminFlag, UserRole, UserUpdate } from '@shared/models' | 7 | import { User as UserType, UserAdminFlag, UserRole, UserUpdate } from '@shared/models' |
9 | import { UserEdit } from './user-edit' | 8 | import { UserEdit } from './user-edit' |
10 | 9 | ||
@@ -28,9 +27,8 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { | |||
28 | private route: ActivatedRoute, | 27 | private route: ActivatedRoute, |
29 | private router: Router, | 28 | private router: Router, |
30 | private notifier: Notifier, | 29 | private notifier: Notifier, |
31 | private userService: UserService, | 30 | private userService: UserService |
32 | private i18n: I18n | 31 | ) { |
33 | ) { | ||
34 | super() | 32 | super() |
35 | 33 | ||
36 | this.buildQuotaOptions() | 34 | this.buildQuotaOptions() |
@@ -79,7 +77,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { | |||
79 | 77 | ||
80 | this.userService.updateUser(this.user.id, userUpdate).subscribe( | 78 | this.userService.updateUser(this.user.id, userUpdate).subscribe( |
81 | () => { | 79 | () => { |
82 | this.notifier.success(this.i18n('User {{username}} updated.', { username: this.user.username })) | 80 | this.notifier.success($localize`User ${this.user.username} updated.`) |
83 | this.router.navigate([ '/admin/users/list' ]) | 81 | this.router.navigate([ '/admin/users/list' ]) |
84 | }, | 82 | }, |
85 | 83 | ||
@@ -96,15 +94,13 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { | |||
96 | } | 94 | } |
97 | 95 | ||
98 | getFormButtonTitle () { | 96 | getFormButtonTitle () { |
99 | return this.i18n('Update user') | 97 | return $localize`Update user` |
100 | } | 98 | } |
101 | 99 | ||
102 | resetPassword () { | 100 | resetPassword () { |
103 | this.userService.askResetPassword(this.user.email).subscribe( | 101 | this.userService.askResetPassword(this.user.email).subscribe( |
104 | () => { | 102 | () => { |
105 | this.notifier.success( | 103 | this.notifier.success($localize`An email asking for password reset has been sent to ${this.user.username}.`) |
106 | this.i18n('An email asking for password reset has been sent to {{username}}.', { username: this.user.username }) | ||
107 | ) | ||
108 | }, | 104 | }, |
109 | 105 | ||
110 | err => this.error = err.message | 106 | err => this.error = err.message |
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 69d4e917d..86812f73d 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 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { Component, OnInit, ViewChild } from '@angular/core' | 2 | import { Component, OnInit, ViewChild } from '@angular/core' |
3 | import { ActivatedRoute, Params, Router } from '@angular/router' | ||
3 | import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService, UserService } from '@app/core' | 4 | import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService, UserService } from '@app/core' |
4 | import { Actor, DropdownAction } from '@app/shared/shared-main' | 5 | import { Actor, DropdownAction } from '@app/shared/shared-main' |
5 | import { UserBanModalComponent } from '@app/shared/shared-moderation' | 6 | import { UserBanModalComponent } from '@app/shared/shared-moderation' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
7 | import { ServerConfig, User, UserRole } from '@shared/models' | 7 | import { ServerConfig, User, UserRole } from '@shared/models' |
8 | import { Params, Router, ActivatedRoute } from '@angular/router' | ||
9 | 8 | ||
10 | type UserForList = User & { | 9 | type UserForList = User & { |
11 | rawVideoQuota: number | 10 | rawVideoQuota: number |
@@ -42,9 +41,8 @@ export class UserListComponent extends RestTable implements OnInit { | |||
42 | private userService: UserService, | 41 | private userService: UserService, |
43 | private auth: AuthService, | 42 | private auth: AuthService, |
44 | private route: ActivatedRoute, | 43 | private route: ActivatedRoute, |
45 | private router: Router, | 44 | private router: Router |
46 | private i18n: I18n | 45 | ) { |
47 | ) { | ||
48 | super() | 46 | super() |
49 | } | 47 | } |
50 | 48 | ||
@@ -82,26 +80,26 @@ export class UserListComponent extends RestTable implements OnInit { | |||
82 | this.bulkUserActions = [ | 80 | this.bulkUserActions = [ |
83 | [ | 81 | [ |
84 | { | 82 | { |
85 | label: this.i18n('Delete'), | 83 | label: $localize`Delete`, |
86 | description: this.i18n('Videos will be deleted, comments will be tombstoned.'), | 84 | description: $localize`Videos will be deleted, comments will be tombstoned.`, |
87 | handler: users => this.removeUsers(users), | 85 | handler: users => this.removeUsers(users), |
88 | isDisplayed: users => users.every(u => this.authUser.canManage(u)) | 86 | isDisplayed: users => users.every(u => this.authUser.canManage(u)) |
89 | }, | 87 | }, |
90 | { | 88 | { |
91 | label: this.i18n('Ban'), | 89 | label: $localize`Ban`, |
92 | description: this.i18n('User won\'t be able to login anymore, but videos and comments will be kept as is.'), | 90 | description: $localize`User won't be able to login anymore, but videos and comments will be kept as is.`, |
93 | handler: users => this.openBanUserModal(users), | 91 | handler: users => this.openBanUserModal(users), |
94 | isDisplayed: users => users.every(u => this.authUser.canManage(u) && u.blocked === false) | 92 | isDisplayed: users => users.every(u => this.authUser.canManage(u) && u.blocked === false) |
95 | }, | 93 | }, |
96 | { | 94 | { |
97 | label: this.i18n('Unban'), | 95 | label: $localize`Unban`, |
98 | handler: users => this.unbanUsers(users), | 96 | handler: users => this.unbanUsers(users), |
99 | isDisplayed: users => users.every(u => this.authUser.canManage(u) && u.blocked === true) | 97 | isDisplayed: users => users.every(u => this.authUser.canManage(u) && u.blocked === true) |
100 | } | 98 | } |
101 | ], | 99 | ], |
102 | [ | 100 | [ |
103 | { | 101 | { |
104 | label: this.i18n('Set Email as Verified'), | 102 | label: $localize`Set Email as Verified`, |
105 | handler: users => this.setEmailsAsVerified(users), | 103 | handler: users => this.setEmailsAsVerified(users), |
106 | isDisplayed: users => { | 104 | isDisplayed: users => { |
107 | return this.requiresEmailVerification && | 105 | return this.requiresEmailVerification && |
@@ -160,7 +158,7 @@ export class UserListComponent extends RestTable implements OnInit { | |||
160 | openBanUserModal (users: User[]) { | 158 | openBanUserModal (users: User[]) { |
161 | for (const user of users) { | 159 | for (const user of users) { |
162 | if (user.username === 'root') { | 160 | if (user.username === 'root') { |
163 | this.notifier.error(this.i18n('You cannot ban root.')) | 161 | this.notifier.error($localize`You cannot ban root.`) |
164 | return | 162 | return |
165 | } | 163 | } |
166 | } | 164 | } |
@@ -197,17 +195,13 @@ export class UserListComponent extends RestTable implements OnInit { | |||
197 | } | 195 | } |
198 | 196 | ||
199 | async unbanUsers (users: User[]) { | 197 | async unbanUsers (users: User[]) { |
200 | const message = this.i18n('Do you really want to unban {{num}} users?', { num: users.length }) | 198 | const res = await this.confirmService.confirm($localize`Do you really want to unban ${users.length} users?`, $localize`Unban`) |
201 | |||
202 | const res = await this.confirmService.confirm(message, this.i18n('Unban')) | ||
203 | if (res === false) return | 199 | if (res === false) return |
204 | 200 | ||
205 | this.userService.unbanUsers(users) | 201 | this.userService.unbanUsers(users) |
206 | .subscribe( | 202 | .subscribe( |
207 | () => { | 203 | () => { |
208 | const message = this.i18n('{{num}} users unbanned.', { num: users.length }) | 204 | this.notifier.success($localize`${users.length} users unbanned.`) |
209 | |||
210 | this.notifier.success(message) | ||
211 | this.loadData() | 205 | this.loadData() |
212 | }, | 206 | }, |
213 | 207 | ||
@@ -218,18 +212,18 @@ export class UserListComponent extends RestTable implements OnInit { | |||
218 | async removeUsers (users: User[]) { | 212 | async removeUsers (users: User[]) { |
219 | for (const user of users) { | 213 | for (const user of users) { |
220 | if (user.username === 'root') { | 214 | if (user.username === 'root') { |
221 | this.notifier.error(this.i18n('You cannot delete root.')) | 215 | this.notifier.error($localize`You cannot delete root.`) |
222 | return | 216 | return |
223 | } | 217 | } |
224 | } | 218 | } |
225 | 219 | ||
226 | const message = this.i18n('If you remove these users, you will not be able to create others with the same username!') | 220 | const message = $localize`If you remove these users, you will not be able to create others with the same username!` |
227 | const res = await this.confirmService.confirm(message, this.i18n('Delete')) | 221 | const res = await this.confirmService.confirm(message, $localize`Delete`) |
228 | if (res === false) return | 222 | if (res === false) return |
229 | 223 | ||
230 | this.userService.removeUser(users).subscribe( | 224 | this.userService.removeUser(users).subscribe( |
231 | () => { | 225 | () => { |
232 | this.notifier.success(this.i18n('{{num}} users deleted.', { num: users.length })) | 226 | this.notifier.success($localize`${users.length} users deleted.`) |
233 | this.loadData() | 227 | this.loadData() |
234 | }, | 228 | }, |
235 | 229 | ||
@@ -240,7 +234,7 @@ export class UserListComponent extends RestTable implements OnInit { | |||
240 | async setEmailsAsVerified (users: User[]) { | 234 | async setEmailsAsVerified (users: User[]) { |
241 | this.userService.updateUsers(users, { emailVerified: true }).subscribe( | 235 | this.userService.updateUsers(users, { emailVerified: true }).subscribe( |
242 | () => { | 236 | () => { |
243 | this.notifier.success(this.i18n('{{num}} users email set as verified.', { num: users.length })) | 237 | this.notifier.success($localize`${users.length} users email set as verified.`) |
244 | this.loadData() | 238 | this.loadData() |
245 | }, | 239 | }, |
246 | 240 | ||