JDK-8247994: Localize javadoc search #16
JDK-8247994: Localize javadoc search #16
Conversation
👋 Welcome back jjg! A progress list of the required criteria for merging this PR into |
@jonathan-gibbons The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
@@ -74,7 +74,7 @@ define SetupInterimModule | |||
EXCLUDE_FILES := $(TOPDIR)/src/$1/share/classes/module-info.java \ | |||
Standard.java, \ | |||
EXTRA_FILES := $(BUILDTOOLS_OUTPUTDIR)/gensrc/$1.interim/module-info.java, \ | |||
COPY := .gif .png .xml .css .js .txt javax.tools.JavaCompilerTool, \ | |||
COPY := .gif .png .xml .css .js .js.template .txt javax.tools.JavaCompilerTool, \ |
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.
Build-folk: it would be nice if this macro could use $(jdk.javadoc_COPY)
instead of having to duplicate entries.
(Future RFE?)
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.
I agree. The entire design of CompileJavaModules.gmk needs to be updated. I've been procrastinating on cleaning this up, maybe it's time to get going on it...
Webrevs
|
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.
Looks good in general. <Unnamed>
shouldn't be localized as it is an internal tag (see inline comment).
var highlight = "<span class=\"result-highlight\">$&</span>"; | ||
var searchPattern = ""; | ||
var fallbackPattern = ""; | ||
var RANKING_THRESHOLD = 2; | ||
var NO_MATCH = 0xffff; | ||
var MIN_RESULTS = 3; | ||
var MAX_RESULTS = 500; | ||
var UNNAMED = "<Unnamed>"; | ||
var UNNAMED = "##REPLACE:doclet.search.unnamed##"; |
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.
<Unnamed>
is not a string that is ever shown to the user, it is what is used by javadoc to denote the default package (see toolkit.util.DocletConstants.DEFAULT_PACKAGE_NAME
). This variable shouldn't be localized as that would break behaviour for code in the default package (and show the localized string as package name, instead of no package name).
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.
Noted, thanks
try { | ||
sb.append(resources.getText(m.group("key"))); | ||
} catch (MissingResourceException e) { | ||
sb.append(m.group()); |
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.
Shouldn't we propagate an error here, or issue a warning? If a key is missing localized properties the value from default properties should be used, so this should never happen, right?
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.
I see the added check for "##REPLACE:" in TestSearch.java will catch that case, so I guess it's ok.
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.
Build changes look good.
@@ -74,7 +74,7 @@ define SetupInterimModule | |||
EXCLUDE_FILES := $(TOPDIR)/src/$1/share/classes/module-info.java \ | |||
Standard.java, \ | |||
EXTRA_FILES := $(BUILDTOOLS_OUTPUTDIR)/gensrc/$1.interim/module-info.java, \ | |||
COPY := .gif .png .xml .css .js .txt javax.tools.JavaCompilerTool, \ | |||
COPY := .gif .png .xml .css .js .js.template .txt javax.tools.JavaCompilerTool, \ |
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.
I agree. The entire design of CompileJavaModules.gmk needs to be updated. I've been procrastinating on cleaning this up, maybe it's time to get going on it...
@jonathan-gibbons This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 6 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
@@ -37,7 +37,7 @@ var RANKING_THRESHOLD = 2; | |||
var NO_MATCH = 0xffff; | |||
var MIN_RESULTS = 3; | |||
var MAX_RESULTS = 500; | |||
var UNNAMED = "##REPLACE:doclet.search.unnamed##"; | |||
var UNNAMED = "<Unnamed>>"; |
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.
Oops, an additional closing angle bracket slipped there.
/integrate |
@jonathan-gibbons Since your change was applied there have been 8 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 30ca0a5. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This is for JDK16, as a precursor to fixing JDK-8258002.
While it is good to be using localized strings in the generated output, the significance for JDK-8258002 is that the strings are now obtained from a resource file, and not hardcoded in JavaScript file itself.
The source file
search.js
is renamed tosearch.js.template
, and (unlike other template files) is copied as-is into the generated image. The values in the template are resolved when javadoc is executed, depending on the locale in use at the time. Because of the change in the file's extension, two makefiles are updated to accommodate the new extension: one is for the "interim" javadoc used to generate the API docs; the other is for the primary javadoc in the main JDK image.Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk16 pull/16/head:pull/16
$ git checkout pull/16