Skip to content

Translations for page elements #257

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

Closed
chrisjsewell opened this issue Sep 23, 2020 · 9 comments · Fixed by #1192
Closed

Translations for page elements #257

chrisjsewell opened this issue Sep 23, 2020 · 9 comments · Fixed by #1192

Comments

@chrisjsewell
Copy link

I'm pretty sure the next/previous page translations don't work here, because the internal sphinx catalog (https://github.com/sphinx-doc/sphinx/tree/3.x/sphinx/locale) does not contain translations for them (the _ filter is a shorthand for using this)

https://github.com/pandas-dev/pydata-sphinx-theme/blob/7163801b25d3e2f15a06fa403bac4fbd00818198/pydata_sphinx_theme/layout.html#L7-L10

FYI I noticed this whilst adding a custom translation catalog to sphinx-book-theme: executablebooks/sphinx-book-theme@d2a8b44 😄

We could think about adding something similar here

@chrisjsewell
Copy link
Author

chrisjsewell commented Sep 23, 2020

note there are individual translations for "next" "previous" and "page", so as a minimum you could just use those i.e. "{{ _('next')}} {{ _('page')}}", but obviously this does not guarantee the correct translation

@jpmckinney
Copy link
Contributor

I see the project has no PO or MO files. If I were to provide Spanish and French translations, would they be merged?

@choldgraf
Copy link
Collaborator

Does this mean that Sphinx would be able to translate these files?

I'd be +1 on this, though we should also document the files in the docs so others know how to edit them etc

@jpmckinney
Copy link
Contributor

My understanding is that at minimum MO files must be committed in the theme, e.g. https://github.com/sphinx-doc/sphinx/tree/4.x/sphinx/locale contains strings for files in the basic theme. Same for sphinx_rtd_theme and others. Committing the PO file makes it much easier to update the MO file.

@jpmckinney
Copy link
Contributor

Why is there a _templates directory? Py-Babel will not look in directories with an underscore: https://github.com/python-babel/babel/blob/5afe2b2f11dcdd6090c00231d342c2e9cd1bdaab/babel/messages/extract.py#L140-L143

I don't think the theme should be using _templates...

@jpmckinney jpmckinney mentioned this issue Apr 22, 2021
3 tasks
@choldgraf
Copy link
Collaborator

@jpmckinney
Copy link
Contributor

Hmm, well I think it's fine for a theme to use any name. I remove the _ in #399.

@jpmckinney
Copy link
Contributor

I'm a bit confused why some templates are in pydata-sphinx-theme and others are in _templates, TBH.

@choldgraf
Copy link
Collaborator

choldgraf commented Apr 22, 2021

I'm personally fine with it - we were just following convention I think.

I think the idea is that the HTML templates in the main folder are larger structural pieces, and _templates contains smaller "components" (maybe components is a better folder name) that are inserted into the bigger templates. But this folder was created after we had already created some "components" in the larger folder, which is why this might be confusing.

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 a pull request may close this issue.

4 participants