-
-
Notifications
You must be signed in to change notification settings - Fork 73
Fix translation of html pages #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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) |
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.
So the issue here is, we are loading just messages from python-docs-theme.po
for HTML files.
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.
LGTM
if trans == msg: | ||
return sphinx_gettext(msg) |
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.
Do we have strings that we don't extract, or rather it is used by languages that doesn't have theme translation and subset of strings is available in Sphinx translation?
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.
The strings for the index are in that file.
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 insphinx.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:
📚 Documentation preview 📚: https://python-docs-theme-previews--263.org.readthedocs.build/