Skip to content

Fix gettext skipping MyST table cells inside tab-item - #306

Open
BetterAndBetterII wants to merge 1 commit into
executablebooks:mainfrom
BetterAndBetterII:fix/tab-table-i18n
Open

Fix gettext skipping MyST table cells inside tab-item#306
BetterAndBetterII wants to merge 1 commit into
executablebooks:mainfrom
BetterAndBetterII:fix/tab-table-i18n

Conversation

@BetterAndBetterII

Copy link
Copy Markdown

Summary

MyST GFM table cells nested under tab-item were omitted from gettext .pot files (and therefore never translated), while the same table at document root extracted fine.

Root cause: MyST sets source on the table node but not on cell paragraphs. At document level those cells inherit document.current_source; during tab-item's nested_parse, that is None, so Sphinx's is_translatable skips them.

Fix: after nested_parse of tab content, propagate the table's source/line onto descendants that lack them.

Fixes #234

Test plan

  • test_tab_table_i18n_gettext — UniqueHeader/UniqueCell msgids present in .pot
  • test_tab_table_i18n_translated — German catalog renders translated cell text in HTML
  • Existing tests/test_misc.py + button/card suites still pass

MyST sets source on the table node but not on cell paragraphs. During
nested_parse of tab-item content, document.current_source is None, so
Sphinx is_translatable skips those cells and they never appear in .pot.
Propagate the table's source/line onto descendants after nested_parse.

Fixes executablebooks#234
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.

i18n: Table in the tab does not have translation

1 participant