-
Notifications
You must be signed in to change notification settings - Fork 104
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
Use PropertyResourceBundle
for localization
#357
Conversation
While I appreciate the sentiment, as in #105 (review) I am not sure this is prudent. Whoever added the ability to load
This seems like a nice heuristic but since anything is valid ISO-8859-1 you can never be sure that it was meant to be UTF-8: we might load some old XML (#171) would be a safer choice, though it is awkward to edit. JSON would be fine, but does not support comments, which we need. YAML would solve that problem and be more familiar to people born after the 1970s, but require us to package a parser in Stapler, conflicting with the library wrapper plugin (unless we shaded it, which has its own problems). |
I had some leftover spaghetti code from the Guava upgrade project to do searches like this, so I did a corpus search for
Here are the links to the plugins: These plugins haven't had any substantive commits or releases since 2016, so I think we can deprecate them and proceed with this change. |
Even the results reported above appear to be false positives, since they are using Unicode escapes but just happen to contain comments with the unescaped text. In short I do not think compatibility is a legitimate concern. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! As mentioned in the preceding comments, I do not think compatibility is a legitimate concern here.
jelly/src/main/java/org/kohsuke/stapler/jelly/ResourceBundle.java
Outdated
Show resolved
Hide resolved
jelly/src/main/java/org/kohsuke/stapler/jelly/ResourceBundle.java
Outdated
Show resolved
Hide resolved
ha well I've found the issue you've commented all over, https://bz.apache.org/netbeans/show_bug.cgi?id=75906 Huge thanks to @basil for doing the scan of the org |
Co-authored-by: Basil Crow <[email protected]>
87f53e2
to
7445827
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks very much for taking care of it, Tim!
I think this copypasta in the |
PropertyResourceBundle
for localization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If compatibility is not a major concern then OK, may as well do it this way.
My understanding is that when updating a plugin to a baseline requiring Java 11 then you may—but need not—switch *.properties
to UTF-8.
It would be possible to add an hpi:
mojo to check your bundles vs. your Java version and advise if you should switch, but I am not sure it would be worth the effort (and overhead on every build).
jelly/src/main/java/org/kohsuke/stapler/jelly/ResourceBundle.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Jesse Glick <[email protected]>
Fixes #356
Prior art:
#105
This would allow us to switch to utf-8 encoding in the future for localization when Java 11 is the baseline.
I wasted far too much time confused on why my tests were failing, turns out my IDE automatically created the encoding in iso-8859-1, at least in IntelliJ this is configurable per project:
https://www.jetbrains.com/help/idea/properties-files.html#encoding