aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/admin.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-12 10:40:04 +0200
committerChocobozzz <me@florianbigard.com>2020-08-14 10:28:30 +0200
commit66357162f8e1227495f09bd4f68446aad7071c6d (patch)
tree7d4429506deb512b2fe1d0267f38a28cda20af55 /client/src/app/+admin/admin.component.ts
parent8c360747995e17eb5520e22fc3d7bd4c3d26eeee (diff)
downloadPeerTube-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/admin.component.ts')
-rw-r--r--client/src/app/+admin/admin.component.ts32
1 files changed, 15 insertions, 17 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 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { AuthService, ScreenService } from '@app/core' 2import { AuthService, ScreenService } from '@app/core'
3import { ListOverflowItem } from '@app/shared/shared-main' 3import { ListOverflowItem } from '@app/shared/shared-main'
4import { I18n } from '@ngx-translate/i18n-polyfill'
5import { UserRight } from '@shared/models'
6import { TopMenuDropdownParam } from '@app/shared/shared-main/misc/top-menu-dropdown.component' 4import { TopMenuDropdownParam } from '@app/shared/shared-main/misc/top-menu-dropdown.component'
5import { 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