-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add German validation messages #511
Add German validation messages #511
Conversation
@rustermi Thanks a lot for your help. |
Sorry, but I seem to have run into a scenario where the translation is incomplete: "requestBody.data darf nur für ein einziges Schema but more than one schemas {{"$ref":"#/components/schemas/tEnS"}{"$ref":"#/components/schemas/vEnS"}{"$ref":"#/components/schemas/vEnSAndTens"}} are valid gültig sein" This is NOT a bug in the translated messages, but rather the code location raising this validation message makes improper use of the parameter to augment the message text, which then leads to this mixture of German and English... Can you please look into fixing this? Shall I open a new issue for this? Thanks a million! 😄 |
@AndreasALoew If you know how to get it fixed, please open a PR and let @rustermi review it. Thanks a lot for raising the issue. |
@stevehu Unfortunately I don't 😢 @rustermi Can you help? My assumption is that the place in the codebase where the above exception is being thrown, adds exception text "but more than one schemas" (...) "are valid" to the exception parameters instead of treating this text as part of the message resource text that is to be translated Does that help? |
Good find @AndreasALoew. I currently don't have the time to further investigate but at first glance, it seems straight forward: We need a new message string for that in
Just add a translation for messages that you speak. Let's say, we call this message oneOfMultipleSchemas = but more than one schemas {0} are valid Then, in Maybe this information is sufficient for you to create a PR? |
Many thanks @rustermi - from the Java codebase perspective, it now looks feasible to me. I have to admit that this will be the very first PR that I ever raised on GitHub (we're using GitLab internally at my customer), but I hope I'll find my way through (otherwise, I'll get back here and ask...). So stay tuned, if all goes well, you should find a PR here early next week... |
Another case of incomplete German translation: "requestBody.data.zeitraum.vonZeitpunkt: X is an invalid date-time" When I look into this over the weekend, I try to find the matching code location as well... |
@AndreasALoew thanks for your efforts. You can just paste the untranslated snippet into the Github search bar on the top left and search for code appearances in this repository. You will then find that |
I've completed a "potential" patch/candidate pull request, but as I cannot get Maven tests to complete without numerous errors, I have so far refrained from creating the PR. The issue is that I seem unable to find out how to make the Maven surefire plugin use a locale of "en_US" to run the tests (and not my default locale of de_DE)... @rustermi can you please advise how I can successfully switch my Maven and/or JVM locale to make the Maven tests pass? |
@AndreasALoew you can use
|
So does this mean that - as my main work computer runs with a German Windows OS Locale, I don't have any other chance passing the full testsuites of json-schema-validator other than by modifying test sources directly? Unfortunately, I am far too busy in my current customer project in order to even think about making more substantial contributions, but I'd rather hoped that it would be possible to externally configure my Maven environment (and/or the main Maven POM, but even this would not be an elegant way) in order to run/pass all tests with a default Locale of en_US that can be set by JVM and/or Maven system properties? In case this indeed is not possible, would you accept a PR that has not even been verified by running the Maven surefire tests? |
The tests that verify i18n should not rely on the system locale or else they would fail on some systems and succeed on others. Instead, the i18n tests should programmatically define a locale via I have not tried to manipulate my system locale on maven level but this StackOverflow post seems to illustrate exactly this; once via pom and once via an environment variable. You can open up a PR and assign me. If I don't get the tests running myself then, I wouldn't approve though. |
@rustermi I've tried it in several ways including the ones mentioned in the StackOverflow post you mentioned, but I simply cannot get the standard "mvn clean install" surefire tests to assume any other locale than German, and so a huge number fails... Either there is something really strange in my environment that does not allow Locales to be overridden (but I would have no idea what this could be...), or I fear that the whole "json-schema-validator" testing needs to be reworked to support running from clients with a default locale that is different from en_US... 😢 So if you also don't know of a specific change in Maven settings and/or MAVEN_OPTS, JVM system properties etc. I fear that the only way to move forward is that I create an untested PR (or attach an old-style unified patch, because it's just very few lines...). Please advise! |
Do so, I'm working with an English locale anyways. If tests run green for me, your changes look okay and I understand why it would fail on your machine, I'd approve it. To help, it would be great if you could post your (failing test) output together with your PR so that I can verify what's going on. |
ALL CLEAR: Successfully uncovered and properly resolved the true root cause of the Locale/testing issues -> see PR #536 |
Hi, I am importing this library for my project and I am trying to understand why System.exit() calls were added in this commit. In general, a library is not expected to have JVM exit() calls. Could you help understand the requirements here? |
I did a full-text search and couldn't find the exit() you mentioned. Could you please point me to the line of code? Thanks. |
@rishabh413 Thanks for raising it. I have fixed it with the following issue. |
Summary
Similar to the addition of Chinese i18n messages, I have added German message strings.
Drawbacks
For simplicity reasons, I have reused the
Issue471Test
. Using a single class to test different languages would be a hassle due to theResourceBundle
being statically initialised. I hope this suffices as I did not want to add a Powermock dependency or do similar reflective classloader manipulation.