Repository navigation
Conversation
Documentation build overview
156 files changed ·
|
…rtifact paths alphabetically in pyproject.toml
|
Thanks for doing the work @m-aciek! I should have time tomorrow for a review :) |
Affirm-Session: 01a20a8a-1869-7c52-8e68-246dde4499c5
Affirm-Session: 01a20a8a-1869-7c52-8e68-246dde4499c5
tomasr8
left a comment
There was a problem hiding this comment.
Looks good, but I'll let Hugo have another look :)
| ) | ||
| jsfile.write_text( | ||
| f"// {DOMAIN} translations for {pofile.parents[1].name}\n" | ||
| f"Documentation.addTranslations({serialized});\n", |
There was a problem hiding this comment.
🤖 says this, does it matter here?
Documentation.addTranslations also replaces the global PLURAL_EXPR, and our file loads after Sphinx's translations.js, so our plural rule overrides Sphinx's. They don't always match: for German we emit a three-form rule but Sphinx's German catalog has two forms, so ngettext in searchtools.js would return undefined for most counts.
None of our three JS strings are plural, so let's merge into TRANSLATIONS and leave the plural rule to Sphinx:
# The plural rule is global and set by Sphinx's own catalog
if message.pluralizable:
continue
if message.fuzzy or not message.string:
continue
messages[message.id] = message.string
serialized = json.dumps(messages, ensure_ascii=True, sort_keys=True)
jsfile.write_text(
f"// {DOMAIN} translations for {pofile.parents[1].name}\n"
f"Object.assign(Documentation.TRANSLATIONS, {serialized});\n",
encoding="utf-8",
)There was a problem hiding this comment.
That's right, thank you. Potentially we could be incorrectly overriding core Sphinx plural rules for JS messages.
I've applied a fix while keeping support for ngettext, for potential future use. b85739d What do you think?
Regarding the undefined issue in forms I've opened sphinx-doc/sphinx#14872 in Sphinx.
There was a problem hiding this comment.
The most correct fix would be to bring support for plural rules per gettext domain in JS catalogs on Sphinx side, but I think the use of it is so niche that I'm not sure if it's worth ticketing now.
Alternative to #337.
Add and mount missing JS translations catalog. Extraction was/is working correctly.