Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

p:fileUpload invalid size message is not localized according locale config

When a user uploads files which is larger than the allowed size he gets a error-message in english and not the language which I set in faces-config.xml

There are any special settings needed to display the error-message in the right language? The other error messages for example on the field I set to required="true" are correct. Also my own messages which I set in Messages_de.properties are working.

Error Message

    Invalid file sizeDSC_6773.JPG 2.9 MB

faces-config.xml:

<locale-config>
  <default-locale>de</default-locale>
  <supported-locale>de</supported-locale>
</locale-config>
<message-bundle>
   jsfmessages.Messages_de
</message-bundle>   

Messages_de.properties:

javax.faces.component.UIInput.REQUIRED=bitte ausf\u00fcllen

page.xhtml:

<p:fileUpload fileUploadListener="#{eintrag.handleFileUpload}"
    mode="advanced" update="msgFileUpload" auto="true"
    sizeLimit="#{config.fileUploadMaxSize}"
    allowTypes="/(\.|\/)(jpeg|jpg|png)$/" label="Auswählen"
    disable="false" id="fileUpload" />
like image 243
gregor Avatar asked Jan 02 '26 01:01

gregor


1 Answers

In fileUpload tag you can add message (in your language) about invalid file size in invalidSizeMessage attribute.

like image 87
Szarpul Avatar answered Jan 05 '26 06:01

Szarpul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!