Skip to content

Conversation

StanFromIreland
Copy link
Member

@StanFromIreland StanFromIreland commented Sep 9, 2025

There two issues, firstly some languages were not compiled and therefore don't load (e.g. Polish), and secondly, we hijacked the gettext for html files with python-docs-theme.po, resulting in messages in sphinx.po not loading (e.g. Greek).

Complete preview, built with translations: https://stan.ulbrych.org/preview/theme-translation/ (vs. current docs)

Compilation issue

We now get:

compiling catalog python_docs_theme/locale/zh_TW/LC_MESSAGES/python-docs-theme.po to python_docs_theme/locale/zh_TW/LC_MESSAGES/python-docs-theme.mo
compiling catalog python_docs_theme/locale/tr/LC_MESSAGES/python-docs-theme.po to python_docs_theme/locale/tr/LC_MESSAGES/python-docs-theme.mo
compiling catalog python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.po to python_docs_theme/locale/pt_BR/LC_MESSAGES/python-docs-theme.mo
compiling catalog python_docs_theme/locale/sv/LC_MESSAGES/python-docs-theme.po to python_docs_theme/locale/sv/LC_MESSAGES/python-docs-theme.mo
compiling catalog python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.po to python_docs_theme/locale/pl/LC_MESSAGES/python-docs-theme.mo
compiling catalog python_docs_theme/locale/ja/LC_MESSAGES/python-docs-theme.po to python_docs_theme/locale/ja/LC_MESSAGES/python-docs-theme.mo
compiling catalog python_docs_theme/locale/zh_CN/LC_MESSAGES/python-docs-theme.po to python_docs_theme/locale/zh_CN/LC_MESSAGES/python-docs-theme.mo
compiling catalog python_docs_theme/locale/es/LC_MESSAGES/python-docs-theme.po to python_docs_theme/locale/es/LC_MESSAGES/python-docs-theme.mo
compiling catalog python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.po to python_docs_theme/locale/el/LC_MESSAGES/python-docs-theme.mo

📚 Documentation preview 📚: https://python-docs-theme-previews--263.org.readthedocs.build/

def setup(app: Sphinx) -> ExtensionMetadata:
app.require_sphinx("7.3")

app.add_html_theme("python_docs_theme", str(THEME_PATH))
app.add_message_catalog(MESSAGE_CATALOG_NAME, LOCALE_DIR)

def add_translation_to_context(app, pagename, templatename, context, doctree):
_ = get_translation(MESSAGE_CATALOG_NAME)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the issue here is, we are loading just messages from python-docs-theme.po for HTML files.

Copy link
Contributor

@rffontenelle rffontenelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@StanFromIreland
Copy link
Member Author

Added type hints per documentation.

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.

4 participants