Closed ansidev closed 4 years ago
I mean that there is only one English translation for passay.properties
at this time. I want to have many passay.properties
so the developer can load based on locale.
For example: Currently, if I want the message is in German, I must translate it manually, then add config to load the German translation manually.
We'd certainly welcome those sorts of contributions. We don't have the expertise to provide additional translations.
@dfish3r Of course, but at this time the library always loads passay.properties. You should support dynamic loading the properties file by language code. Then the community will make contributions for the language files.
So the way to accomplish that is:
Create a properties file called passay_de.properties
and put it on your classpath.
Then
ResourceBundleMessageResolver resolver = new ResourceBundleMessageResolver(
ResourceBundle.getBundle("passay", Locale.GERMAN));
PasswordValidator validator = new PasswordValidator(resolver, rule1, rule2, ...);
Using the default locale should load language specific properties if they exist, otherwise it will fallback to the english default.
Yes, I know. I have read your documentation. But with the current implementation:
If the project is using English only, it does not the problem.
If your library support this locale files by default, it 's better. We just load the passay file with the input locale.
Sure. If/when someone contributes a language specific file we'll include it in the jar. Until then, you have to solve the problem of distributing a custom properties file.
I think the first step is support loading the passay_{languageCode}.properties. After that, we will update the translation for each language.
It will make the contribution easier.
Please send me a PR for the changes you're thinking about. I think code review is the best way to continue this discussion.
Pushed a commit related to this: https://github.com/vt-middleware/passay/commit/5587010e4da27c6f794bff3660fab49069052623
No feedback from reporter. Feel free to reopen this for further discussion.
Support for resource bundles was added in this commit: https://github.com/vt-middleware/passay/commit/51eeabbd7a2de0f370be020218617491c646b8e9
Please try out the latest snapshot and let us know if that meets your requirements.