aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main/buttons
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/shared/shared-main/buttons
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/shared/shared-main/buttons')
-rw-r--r--client/src/app/shared/shared-main/buttons/delete-button.component.ts7
-rw-r--r--client/src/app/shared/shared-main/buttons/edit-button.component.ts7
2 files changed, 4 insertions, 10 deletions
diff --git a/client/src/app/shared/shared-main/buttons/delete-button.component.ts b/client/src/app/shared/shared-main/buttons/delete-button.component.ts
index aced0f881..18995422a 100644
--- a/client/src/app/shared/shared-main/buttons/delete-button.component.ts
+++ b/client/src/app/shared/shared-main/buttons/delete-button.component.ts
@@ -1,5 +1,4 @@
1import { Component, Input, OnInit } from '@angular/core' 1import { Component, Input, OnInit } from '@angular/core'
2import { I18n } from '@ngx-translate/i18n-polyfill'
3 2
4@Component({ 3@Component({
5 selector: 'my-delete-button', 4 selector: 'my-delete-button',
@@ -11,17 +10,15 @@ export class DeleteButtonComponent implements OnInit {
11 @Input() label: string 10 @Input() label: string
12 @Input() title: string 11 @Input() title: string
13 12
14 constructor (private i18n: I18n) { }
15
16 ngOnInit () { 13 ngOnInit () {
17 // <my-delete-button /> No label 14 // <my-delete-button /> No label
18 if (this.label === undefined && !this.title) { 15 if (this.label === undefined && !this.title) {
19 this.title = this.i18n('Delete') 16 this.title = $localize`Delete`
20 } 17 }
21 18
22 // <my-delete-button label /> Use default label 19 // <my-delete-button label /> Use default label
23 if (this.label === '') { 20 if (this.label === '') {
24 this.label = this.i18n('Delete') 21 this.label = $localize`Delete`
25 22
26 if (!this.title) { 23 if (!this.title) {
27 this.title = this.label 24 this.title = this.label
diff --git a/client/src/app/shared/shared-main/buttons/edit-button.component.ts b/client/src/app/shared/shared-main/buttons/edit-button.component.ts
index d8ae39b84..4b76551ca 100644
--- a/client/src/app/shared/shared-main/buttons/edit-button.component.ts
+++ b/client/src/app/shared/shared-main/buttons/edit-button.component.ts
@@ -1,5 +1,4 @@
1import { Component, Input, OnInit } from '@angular/core' 1import { Component, Input, OnInit } from '@angular/core'
2import { I18n } from '@ngx-translate/i18n-polyfill'
3 2
4@Component({ 3@Component({
5 selector: 'my-edit-button', 4 selector: 'my-edit-button',
@@ -12,17 +11,15 @@ export class EditButtonComponent implements OnInit {
12 @Input() title: string 11 @Input() title: string
13 @Input() routerLink: string[] | string = [] 12 @Input() routerLink: string[] | string = []
14 13
15 constructor (private i18n: I18n) { }
16
17 ngOnInit () { 14 ngOnInit () {
18 // <my-edit-button /> No label 15 // <my-edit-button /> No label
19 if (this.label === undefined && !this.title) { 16 if (this.label === undefined && !this.title) {
20 this.title = this.i18n('Update') 17 this.title = $localize`Update`
21 } 18 }
22 19
23 // <my-edit-button label /> Use default label 20 // <my-edit-button label /> Use default label
24 if (this.label === '') { 21 if (this.label === '') {
25 this.label = this.i18n('Update') 22 this.label = $localize`Update`
26 23
27 if (!this.title) { 24 if (!this.title) {
28 this.title = this.label 25 this.title = this.label