Fix sphinx.js discovery for when documentation source is in a subdir #14160
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If .rst etc source files (and conf.py) are placed in a subdirectory of Sphinx project root, such as "src", "source" or similar (instead of in the Sphinx root), then when building html documentation, the html builder will not find a custom localized sphinx.js file even if the file exists in the correct path (<conf.py::locale_dirs[index]>/<LANG>/LC_MESSAGES/sphinx.js).
The above has the result of causing JavaScript errors when Sphinx-generated HTML+JavaScript attempts to dynamically translate (in browser/client-side) parts of the UI, such as the string describing how many results a given search yielded.
This commit fixes the aforementioned problem.
With a quick search I did not find an open issue that seemed to be related to this.