I use Passay library in the spring boot project for password validation. In the library itself there is a file messages.properties with a description of validation errors in English. I need to issue these messages in Russian. I tried to change the message text itself into Russian with the replacement of the file encoding with utf-8. In spring, it correctly displays the Cyrillic alphabet, and on the web page there is a kryakozyabra in the iso 8859-1 encoding. At the same time .properties files of the project itself work fine with Cyrillic. Advise how to deduce the Cyrillic alphabet on the web page. Thank.
1 answer
The question was resolved by adding a custom localization file from the passay manual as follows:
Properties props = new Properties(); props.load(new FileInputStream("/path/to/messages.properties")); MessageResolver resolver = new PropertiesMessageResolver(props); PasswordValidator validator = new PasswordValidator( resolver, new LengthRule(8, 16), new WhitespaceRule());
Further questions on the coding disappear.
- Please try to leave a little more detailed answers. You can add an answer by clicking edit - aleksandr barakin
|