Skip to content
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

Is togglebutton_hint translatable? #22

Open
mgeier opened this issue Oct 20, 2020 · 6 comments
Open

Is togglebutton_hint translatable? #22

mgeier opened this issue Oct 20, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@mgeier
Copy link
Contributor

mgeier commented Oct 20, 2020

I'm not quite sure how Sphinx's translation system works, sorry for the naive question.

It's nice to have the togglebutton_hint string configurable, but I'm not sure whether that's enough (or the right way) to make it translatable.

There are other Sphinx features like copyright, which have a conf.py option but also have special markup in the HTML template in order to be translatable. At least that's how I understand it ...

@mgeier mgeier added the enhancement New feature or request label Oct 20, 2020
@welcome
Copy link

welcome bot commented Oct 20, 2020

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@choldgraf
Copy link
Member

choldgraf commented Oct 20, 2020

It should be translateable but is not currently.

I believe we'd need to use this pattern:

https://github.com/executablebooks/sphinx-book-theme/blob/master/sphinx_book_theme/topbar.html#L20

here:

https://github.com/executablebooks/sphinx-togglebutton/blob/master/sphinx_togglebutton/__init__.py#L16

(and access the translate function in Python via context['translate'])

@mgeier
Copy link
Contributor Author

mgeier commented Oct 20, 2020

The place I was referring to is https://github.com/sphinx-doc/sphinx/blob/0476e1cea93b587e3c0ab295aa20b2b9f0f81a34/sphinx/themes/basic/layout.html#L206 using the trans thingie.

I don't know which is more appropriate here.

@mgeier
Copy link
Contributor Author

mgeier commented Oct 20, 2020

This seems to work outside the Sphinx translation mechanism, right?
I would prefer staying compatible with Sphinx's stuff and not reinvent translation.

@choldgraf
Copy link
Member

well it's not using Sphinx's translation mechanism directly, but seems to be piggy-backing on the language that Sphinx sets in the environment. (note: I didn't implement that above, another contributor did, so I am trying to backwards engineer this as much as you are :-) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants