aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-forms/reactive-file.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/shared/shared-forms/reactive-file.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/shared/shared-forms/reactive-file.component.ts')
-rw-r--r--client/src/app/shared/shared-forms/reactive-file.component.ts13
1 files changed, 3 insertions, 10 deletions
diff --git a/client/src/app/shared/shared-forms/reactive-file.component.ts b/client/src/app/shared/shared-forms/reactive-file.component.ts
index 9ebf487ce..eeb2a3fd8 100644
--- a/client/src/app/shared/shared-forms/reactive-file.component.ts
+++ b/client/src/app/shared/shared-forms/reactive-file.component.ts
@@ -2,7 +2,6 @@ import { Component, EventEmitter, forwardRef, Input, OnInit, Output } from '@ang
2import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' 2import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
3import { Notifier } from '@app/core' 3import { Notifier } from '@app/core'
4import { GlobalIconName } from '@app/shared/shared-icons' 4import { GlobalIconName } from '@app/shared/shared-icons'
5import { I18n } from '@ngx-translate/i18n-polyfill'
6 5
7@Component({ 6@Component({
8 selector: 'my-reactive-file', 7 selector: 'my-reactive-file',
@@ -31,10 +30,7 @@ export class ReactiveFileComponent implements OnInit, ControlValueAccessor {
31 30
32 private file: File 31 private file: File
33 32
34 constructor ( 33 constructor (private notifier: Notifier) { }
35 private notifier: Notifier,
36 private i18n: I18n
37 ) {}
38 34
39 get filename () { 35 get filename () {
40 if (!this.file) return '' 36 if (!this.file) return ''
@@ -51,16 +47,13 @@ export class ReactiveFileComponent implements OnInit, ControlValueAccessor {
51 const [ file ] = event.target.files 47 const [ file ] = event.target.files
52 48
53 if (file.size > this.maxFileSize) { 49 if (file.size > this.maxFileSize) {
54 this.notifier.error(this.i18n('This file is too large.')) 50 this.notifier.error($localize`This file is too large.`)
55 return 51 return
56 } 52 }
57 53
58 const extension = '.' + file.name.split('.').pop() 54 const extension = '.' + file.name.split('.').pop()
59 if (this.extensions.includes(extension) === false) { 55 if (this.extensions.includes(extension) === false) {
60 const message = this.i18n( 56 const message = $localize`PeerTube cannot handle this kind of file. Accepted extensions are ${this.allowedExtensionsMessage}}.`
61 'PeerTube cannot handle this kind of file. Accepted extensions are {{extensions}}.',
62 { extensions: this.allowedExtensionsMessage }
63 )
64 this.notifier.error(message) 57 this.notifier.error(message)
65 58
66 return 59 return