Skip to content

bug: Sphinx button disappears in translated content #664

Open

Description

@lwasser

When you create a button in Sphinx, it renders well. However, if you try to translate the content and vie wthe translated content, the button disappears - see images below

packaging guide in english:

Image

packaging guide translated into japanese
Image

this seems to be an issue with buttons specifically.

Activity

  1. lwasser commented on May 19, 2026

    @lwasser
    MemberAuthor

    @sneakers-the-rat do you have any guesses as to why a translated page would drop the <a> and css and it converts the button to a <p> ? It's a fairly odd bug.

  2. added
    bug
    translations
    on May 19, 2026
  3. sneakers-the-rat commented on May 19, 2026

    @sneakers-the-rat
    Contributor

    no, that's weird, let me take a look

  4. sneakers-the-rat commented on May 19, 2026

    @sneakers-the-rat
    Contributor
  5. sneakers-the-rat commented on May 19, 2026

    @sneakers-the-rat
    Contributor

    there is allegedly some fix here, but it doesn't work for me - executablebooks/sphinx-design#175

    but what i can confirm works is that if you just do the HTML manually and then update the .po files that it works fine.

    i.e. instead of

    ```{button-link} https://github.com/pyOpenSci/python-package-guide#contributors-
    :color: primary
    :class: sd-rounded-pill float-left
    
    View guidebook contributors
    
    ```

    you do

    <a class="sd-sphinx-override sd-btn sd-text-wrap sd-btn-primary sd-rounded-pill float-left reference external" href="https://github.com/pyOpenSci/python-package-guide#contributors-">
    
    View guidebook contributors
    
    </a>

    then it works with the translations (but you need to update the .po files because the line numbers change slightly)

    I think the longerterm fix is to ping the executablebooks folks on that open issue, monkeying around with docutils internals is above my paygrade/too frustrating for me to consider lol

  6. sneakers-the-rat commented on May 19, 2026

    @sneakers-the-rat
    Contributor

    Alright I am distractable today and I was curious why this would happen so I started reading how the sphinx gettext builder works so I'll work on a patch for this since I'd like to learn how to make sphinx things localizable

  7. sneakers-the-rat commented on May 19, 2026

    @sneakers-the-rat
    Contributor

    got it!!! i think!!! executablebooks/sphinx-design#264

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugpyconus-26translations

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions