-
Bug
-
Resolution: Fixed
-
P3
-
11, 11.0.2, 12
-
b09
-
generic
-
generic
Javadocs has the "-locale" parameter that allows to give the locale for generated javadocs, e.g. for English projects like Apache Lucene, the texts about methods, classes, titles should really be in English. To achieve this, you can pass "-locale en_US".
The problem: Javadocs ignores the param in Java 11 and Java 12 - but works correctly in Java 8. Giving the parameter has exactly one effect: it changes the language attribute of the element (and date/times in comments seem to be correct). If the default locale is Japanese (as on a Lucene committer's test system), all remaining text is japanese:
System setup:
$ /usr/java/jdk-11.0.3/bin/jshell
jshell> Locale.getDefault()
$1 ==> ja_JP
Without locale option:
```$ /usr/java/jdk-11.0.3/bin/javadoc --source-path src/java -d docs/ -package "com.example"
$ cat docs/index.html
<html lang="ja">
<head>
<!-- Generated by javadoc (11.0.3) on Sun Apr 21 22:13:06 JST 2019 -->
<title>生成されたドキュメント(タイトルなし)</title>
...```
With locale option:
```$ /usr/java/jdk-11.0.3/bin/javadoc -locale en_US --source-path src/java -d docs/ -package "com.example"
$ cat docs/help-doc.html
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.3) on Sun Apr 21 22:13:34 JST 2019 -->
<title>生成されたドキュメント(タイトルなし)</title>
...```
The only workaround is to give the locale as a system property with "-J" param: And when I give the locale via sysprops, lang is "en" and the generated texts are English:
```$ /usr/java/jdk-11.0.3/bin/javadoc --source-path src/java -d docs/ -package "com.example" -J-Duser.language=en -J-Duser.country=US
$ cat docs/index.html
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.3) on Sun Apr 21 22:21:14 JST 2019 -->
<title>Generated Documentation (Untitled)</title>
...```
In Apache Lucene we now pass both things (-locale) and sysprops. But this issue may affect many projects.
Interestingly, with German default Locale it does not happen, but this could be related to the fact that there are no German messages shipped with JDK.
Java 8 works fine.
The problem: Javadocs ignores the param in Java 11 and Java 12 - but works correctly in Java 8. Giving the parameter has exactly one effect: it changes the language attribute of the element (and date/times in comments seem to be correct). If the default locale is Japanese (as on a Lucene committer's test system), all remaining text is japanese:
System setup:
$ /usr/java/jdk-11.0.3/bin/jshell
jshell> Locale.getDefault()
$1 ==> ja_JP
Without locale option:
```$ /usr/java/jdk-11.0.3/bin/javadoc --source-path src/java -d docs/ -package "com.example"
$ cat docs/index.html
<html lang="ja">
<head>
<!-- Generated by javadoc (11.0.3) on Sun Apr 21 22:13:06 JST 2019 -->
<title>生成されたドキュメント(タイトルなし)</title>
...```
With locale option:
```$ /usr/java/jdk-11.0.3/bin/javadoc -locale en_US --source-path src/java -d docs/ -package "com.example"
$ cat docs/help-doc.html
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.3) on Sun Apr 21 22:13:34 JST 2019 -->
<title>生成されたドキュメント(タイトルなし)</title>
...```
The only workaround is to give the locale as a system property with "-J" param: And when I give the locale via sysprops, lang is "en" and the generated texts are English:
```$ /usr/java/jdk-11.0.3/bin/javadoc --source-path src/java -d docs/ -package "com.example" -J-Duser.language=en -J-Duser.country=US
$ cat docs/index.html
<html lang="en">
<head>
<!-- Generated by javadoc (11.0.3) on Sun Apr 21 22:21:14 JST 2019 -->
<title>Generated Documentation (Untitled)</title>
...```
In Apache Lucene we now pass both things (-locale) and sysprops. But this issue may affect many projects.
Interestingly, with German default Locale it does not happen, but this could be related to the fact that there are no German messages shipped with JDK.
Java 8 works fine.
- relates to
-
JDK-8238437 Support separate locales for console messages and HTML content.
- Resolved
-
JDK-8238503 Remove unused field and accessor for docLocale from ToolOptions
- Resolved
- links to
-
Commit openjdk/panama-foreign/98f5d98a