@@ -58,6 +58,7 @@ export class FileDropper extends Component<FileDropperProps, {}> {
58
58
59
59
private onDrop ( acceptedFiles : File [ ] , fileRejections : FileRejection [ ] ) : void {
60
60
const { store } = this . props ;
61
+ const { FILERECTEDSIZE , FILESREJECTED } = store . texts ;
61
62
const maxSize = store . maxSize || null ;
62
63
let maxReached = false ;
63
64
@@ -71,8 +72,12 @@ export class FileDropper extends Component<FileDropperProps, {}> {
71
72
const otherRejected : File [ ] = [ ] ;
72
73
fileRejections . forEach ( reject => {
73
74
if ( maxSize !== null && reject && reject . file . size && reject . file . size > maxSize ) {
75
+ const text = FILERECTEDSIZE
76
+ . replace ( / % % F I L E N A M E % % / g, reject . file . name )
77
+ . replace ( / % % M A X S I Z E % % / g, fileSize ( maxSize ) ) ;
78
+
74
79
const message = new ValidationMessage (
75
- `File: ' ${ reject . file . name } ' is rejected, file size exceeds ${ fileSize ( maxSize ) } ` ,
80
+ text ,
76
81
"warning"
77
82
) ;
78
83
store . addValidationMessage ( message ) ;
@@ -83,7 +88,7 @@ export class FileDropper extends Component<FileDropperProps, {}> {
83
88
84
89
if ( otherRejected . length > 0 ) {
85
90
mx . ui . info (
86
- [ "The following files are rejected:" , "" , ...otherRejected . map ( file => file . name ) ] . join ( "\n" ) ,
91
+ [ FILESREJECTED , "" , ...otherRejected . map ( file => file . name ) ] . join ( "\n" ) ,
87
92
true
88
93
) ;
89
94
}
0 commit comments