On Tue, 2 Dec 2025 14:05:10 GMT, Hannes Wallnöfer <[email protected]> wrote:

> Please review a simple change to make the JavaDoc `-locale` option work with 
> English language locales when the system default is a non-English locale 
> supported by JavaDoc. The problem is that root resource bundles such as 
> `standard.properties` are not recognized as English, and 
> [java.util.ResourceBundle][1] will use the system default locale as fallback 
> before returning the root bundle.
> 
> [1]: 
> https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ResourceBundle.html#default_behavior
> 
> The solution is to provide empty English resource bundles that will use the 
> root bundles as parents. An alternative would be to use a 
> [ResourceBundleProvider][2], but I think the added complexity is not 
> justified for this case. Also, we can't use [ResourceBundle.Control][3] in a 
> named module.
> 
> [2]: 
> https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/spi/ResourceBundleProvider.html
> [3]: 
> https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ResourceBundle.Control.html#getNoFallbackControl(java.util.List)
> 
> The test runs JavaDoc with all combinations of supported locales for default 
> locale and `-locale` option, making sure the console output uses the default 
> locale while generated docuentation adheres to the `-locale` option.

I assume things like `-locale jp` doesn't work right now in an English 
environment too, right?

-------------

Marked as reviewed by liach (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/28603#pullrequestreview-3531003259

Reply via email to