diff options
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.ts | 13 |
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 | |||
2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' | 2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' |
3 | import { Notifier } from '@app/core' | 3 | import { Notifier } from '@app/core' |
4 | import { GlobalIconName } from '@app/shared/shared-icons' | 4 | import { GlobalIconName } from '@app/shared/shared-icons' |
5 | import { 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 |