Skip to content

Conversation

@jannecederberg
Copy link

@jannecederberg jannecederberg commented Dec 7, 2025

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.

…subdir

If conf.py and .rst etc source files are placed in a subdirectory
such as "src", "source" or similar (instead of the Sphinx project root),
then when building html documentation, the html builder will not find
a custom localized sphinx.js file even if sphinx.js 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 attempting to
dynamically translate parts of the UI, such as the string describing
how many results a given search yielded.

This commit fixes the aforementioned problem.
@jannecederberg jannecederberg changed the title Fix custom sphinx.js discovery for cases where documentation source is in a subdir Fix sphinx.js discovery for cases where documentation source is in a subdir Dec 8, 2025
@jannecederberg jannecederberg changed the title Fix sphinx.js discovery for cases where documentation source is in a subdir Fix sphinx.js discovery for when documentation source is in a subdir Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant