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.

This pull request has now been integrated.

Changeset: 37d8e05e
Author:    Hannes Wallnöfer <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/37d8e05eccc959b5b5e04b3da848f7de9220b00c
Stats:     162 lines in 3 files changed: 162 ins; 0 del; 0 mod

8372708: Javadoc ignores "-locale" and uses default locale for all messages and 
texts

Reviewed-by: liach

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

PR: https://git.openjdk.org/jdk/pull/28603

Reply via email to