Skip to content

[Docs] adjust sphinx theme templates for gettext builder#26923

Open
hwhsu1231 wants to merge 1 commit into
emscripten-core:mainfrom
hwhsu1231-fork:i18n-sphinx-rtd-theme
Open

[Docs] adjust sphinx theme templates for gettext builder#26923
hwhsu1231 wants to merge 1 commit into
emscripten-core:mainfrom
hwhsu1231-fork:i18n-sphinx-rtd-theme

Conversation

@hwhsu1231
Copy link
Copy Markdown
Contributor

  • Add _() and {% trans %}{% endtrans %} for gettext builder.
  • Adjust the indentation of the sphinx theme templates.
  • Trim trailing spaces and replace tabs with spaces.

- Add `_()` and `{% trans %}{% endtrans %}` for gettext builder.
- Adjust the indentation of the sphinx theme templates.
- Trim trailing spaces and replace tabs with spaces.
@sbc100
Copy link
Copy Markdown
Collaborator

sbc100 commented May 12, 2026

Is this template something that we copied from an upstream location?

If so, I'm not sure we want to be in the businesses of modifying it, unless it is an update from the upstream version, or some important fix?

@hwhsu1231
Copy link
Copy Markdown
Contributor Author

Hello @sbc100

Is this template something that we copied from an upstream location?

Judging by the content, the entire emscripten_sphinx_rtd_theme appears to have been forked or copied from a specific version of sphinx_rtd_theme and subsequently customized.

If so, I'm not sure we want to be in the businesses of modifying it, unless it is an update from the upstream version, or some important fix?

The primary objective of this PR is to add _() and {% trans %}{% endtrans %} wrappers for the gettext builder. Without these modifications, those specific text strings cannot be extracted or localized when utilizing Sphinx’s Internationalization with Gettext feature. This is a necessary fix to enable multi-language support for the documentation.

@sbc100
Copy link
Copy Markdown
Collaborator

sbc100 commented May 13, 2026

I see, so is the idea that we could then followup with the translations themselves? i.e. does this change do anything on its own or does it require some actual translations too?

Maybe you could submit just the translation stuff without the whitespace changes?

Has the upstream sphinx_rtd_theme being modified to handle translations?

@sbc100
Copy link
Copy Markdown
Collaborator

sbc100 commented May 13, 2026

The last time this theme had any kind of updates was in #22872. Perhaps @lorsanta has some optionions on how to proceed here?

@hwhsu1231
Copy link
Copy Markdown
Contributor Author

Hello @sbc100

I see, so is the idea that we could then followup with the translations themselves? i.e. does this change do anything on its own or does it require some actual translations too?

After this modification, we will be able to extract those wrapped strings by running sphinx-build -b gettext <...> command.

Maybe you could submit just the translation stuff without the whitespace changes?

But the layout of the original Jinja templates is quite messy. I made these adjustments to make future maintenance easier.

Has the upstream sphinx_rtd_theme being modified to handle translations?

Yes, it has, but there are some strings that are provided by the emscripten_sphinx_rtd_theme itself, which is why I submitted this PR.

@sbc100
Copy link
Copy Markdown
Collaborator

sbc100 commented May 13, 2026

Perhaps we can just pull the latest version of the upstream theme once again, like @lorsanta did in the past.

I'm wary of making downstream modifications to these files because we (I) don't really have any expertise in maintaining them over time, so its hard for is to know which modification and how to rebase them if/when we do want to pull in new upstream changed.

Basically, I don't really understand this stuff, so I'm not very keen on carrying patches to it. But if folks like yourself and @lorsanta and interested in maintaining this stuff over time that seems reasonable and I think I should bow to your greater experience.

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.

2 participants