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

Text in navigation footer (previous, next) in not translated #359

Closed
1 of 2 tasks
pfelber opened this issue Jul 28, 2021 · 12 comments · Fixed by #374
Closed
1 of 2 tasks

Text in navigation footer (previous, next) in not translated #359

pfelber opened this issue Jul 28, 2021 · 12 comments · Fixed by #374
Labels
bug Something isn't working 🏷️ templating Related to the Jinja templating

Comments

@pfelber
Copy link

pfelber commented Jul 28, 2021

Describe the problem

Hi,

The new navigation footer now has "PREVIOUS" and "NEXT" labels. These labels seem to be hardcoded in the css and are not translated when changing the language of the book. While they can be overridden in the CSS, it might be good to have them generated directly in the book's language (I am using "language: fr").

(As a side note, I preferred the old style with "<<", ">>" and the smaller font.)

Thanks,

Pascal

Link to your repository or website

No response

Steps to reproduce

This problem can be seen in any generated book when setting the language to anything different from English.

The version of Python you're using

No response

Your operating system

No response

Versions of your packages

❯ jupyter-book --version
Jupyter Book      : 0.11.2
External ToC      : 0.2.2
MyST-Parser       : 0.13.7
MyST-NB           : 0.12.3
Sphinx Book Theme : 0.1.1
Jupyter-Cache     : 0.4.2
NbClient          : 0.5.3

Tasks

@pfelber pfelber added the bug Something isn't working label Jul 28, 2021
@welcome
Copy link

welcome bot commented Jul 28, 2021

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! 🎉

@chrisjsewell
Copy link
Member

chrisjsewell commented Aug 5, 2021

Heya, yeh these navigations are inherited from pydata-sphinx-theme:https://github.com/pydata/pydata-sphinx-theme/blob/f0834772d24c962b7d11643114db88615c43674e/pydata_sphinx_theme/layout.html#L4, and so are not currently handled by the translation functionality included in sphinx-book-theme

So either it needs to be "fixed" there (cc @jorisvandenbossche) or we need to override that macro

@chrisjsewell chrisjsewell added the 🏷️ templating Related to the Jinja templating label Aug 5, 2021
@choldgraf
Copy link
Member

choldgraf commented Aug 6, 2021

Ah this was actually a recent change in the CSS to add "previous" and "next" (it was inspired from the Furo docs). This makes me think we might want to change the implementation as I doubt CSS can be translated unless we turn it into a _t template, which seems sub-optimal 🤔

here's the CSS where that's defined:

@chrisjsewell
Copy link
Member

Ah ok yeh no that needs to go in the html templates, so it can be translated

@chrisjsewell
Copy link
Member

@choldgraf did you check that #374 actually works, because I don't think it will; you are using sphinx's internal translation function which does not include PREVIOUS/NEXT, rather than using the translation function I set up in #214

@chrisjsewell chrisjsewell reopened this Aug 18, 2021
@chrisjsewell
Copy link
Member

testing in #381

@choldgraf
Copy link
Member

ahhh in that case you are right - I didn't realize we needed a separate setup for this. I will keep this on my plate in that case and try to get to it when I have time.

@choldgraf choldgraf self-assigned this Aug 18, 2021
@choldgraf
Copy link
Member

I can confirm that the translations do not work. I tried using the translate function and looked at the README docs of the translate folder which seems like it would work, with a few confusion points.

@chrisjsewell what languages did you select when you generated the translations? And after that you just put it in a specific folder and then ran python sphinx_book_theme/translations/_convert.py? I think we need to have a "step by step" guide for adding a new translation to the theme so that it's straightforward to do this. I can try to write this but I need to know the steps first haha.

@chrisjsewell
Copy link
Member

what languages did you select when you generated the translations?

all of them

nd after that you just put it in a specific folder and then ran python sphinx_book_theme/translations/_convert.py

yep should be as easy as that

@choldgraf
Copy link
Member

I spent a while trying to figure out the translation machinery and was not able to do so. I don't have time to work on this now so instead I've opened up an issue about documenting this infrastructure, and added in my steps that I took in that issue in case others have time to take a look: #382

I'll leave this issue open in the meantime, though removing myself from assignment because I'm not sure when I'll have a moment to work on coding stuff. We might also consider reverting back to just using -> instead of english words, so that we don't have to do the translation stuff.

@choldgraf
Copy link
Member

choldgraf commented Aug 22, 2021

OK I believe that #384 fixed this issue. @pfelber can you install the latest version from master and report back if the translations correctly happen? I will close this issue, but if somebody notices that this didn't correctly fix it, we can re-open

@pfelber
Copy link
Author

pfelber commented Aug 25, 2021

I verified and translations happen correctly, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 🏷️ templating Related to the Jinja templating
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants