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

Translations for the theme #434

Open
pradyunsg opened this issue May 3, 2022 Discussed in #429 · 15 comments
Open

Translations for the theme #434

pradyunsg opened this issue May 3, 2022 Discussed in #429 · 15 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@pradyunsg
Copy link
Owner

pradyunsg commented May 3, 2022

Discussed in #429

This theme currently does not provide translations for any of the text in it, that isn't already a part of the Sphinx translations database. This is an issue for discussing and tracking improvements on this front.

@pradyunsg pradyunsg changed the title Translation fo the theme Translations for the theme May 3, 2022
@mpaglia0
Copy link

Hi, I found this very nice theme right now but noticed the same issue.
I am interested to translate it in Italian.
thanks
Maurizio

@dbitouze
Copy link
Contributor

AFAICS, “Back to top” isn't translated either.

@pradyunsg
Copy link
Owner Author

Broadly speaking, most of the stuff in this theme is not translated. It's plumbed into Sphinx's translation engine, but the theme doesn't contain localisations for any of the strings it has that aren't in Sphinx's default translations bundle. Text like "Back to top" is an example of that.

Honestly, I'm not familiar with how to add translations to this theme such that Sphinx would pick it up (and obviously can't translate to languages that I don't know) -- so help would be welcome for this!

@pradyunsg pradyunsg added enhancement New feature or request help wanted Extra attention is needed labels Jul 11, 2022
@eviau-sat
Copy link
Contributor

Hello - I was onboarded into working on tech doc by working on translation projects using Sphinx, so let me give you a few insights if I may ?

I hope I understand the question correctly, let me know if that is not the case.

I would be happy to help translate this theme messages from English to French and to figure out how to set things up generally speaking.

A few things:

  1. To fetch messages from your theme that needs to be translated, you may follow the general i18n instructions and look for a file named sphinx.po in the locale folder. This is the file with the Sphinx-specific messages. Here is a example of such a file.
  2. There seems to be a Transifex project for translations of Sphinx itself.
  3. Maybe there is a way to take existing translations and integrate them into the Furo theme ?
  4. I am not sure how to add new messages to a Transifex project !

I am happy to do some research on all of this, let me know what questions you have!

@DiddiLeija
Copy link
Contributor

If you need a Spanish translator, count with me ;)

@eviau-sat
Copy link
Contributor

I did some more research !

The short version is : I believe the more straightforward path would be to add messages to this transifex project for sphinx system messages.

I believe this because of a message on the Sphinx users list and another similar message on Github.

I haven't found yet proper instructions on how to translate just one theme while making this translation available... I guess you could commit the sphinx.po file I spoke earlier to the theme ?

More resources consulted include this Transifex doc on integrating with Sphinx

@guifcoelho
Copy link

I know that this is not the right solution by far, but if you just need to translate a couple of components you can extend the 'page.html' template (or any other). This was the simplest and quickest solution I managed to implement.

In the example below, I needed to translate from "On this page" to "Nesta página":

{% extends "!page.html" %}

{% block right_sidebar %}
  {% if not furo_hide_toc %}
  <div class="toc-sticky toc-scroll">
    <div class="toc-title-container">
      <span class="toc-title">
        {{ _("Nesta página") }}
      </span>
    </div>
    <div class="toc-tree-container">
      <div class="toc-tree">
        {{ toc }}
      </div>
    </div>
  </div>
  {% endif %}
{% endblock right_sidebar %}`

@dbitouze
Copy link
Contributor

Any progress on the current issue?

@pradyunsg
Copy link
Owner Author

help would be welcome for this!

@dbitouze
Copy link
Contributor

dbitouze commented Aug 24, 2023

Perhaps you could ask the team who manage the translation of sphinx-rtd-theme on Transifex for help. I have no idea how to go about it but, if you decide to use Transifex, I'll help you translate (as I do for other projects, Sphinx for example).

But, BTW, while I could find the "Back to top" string in the Furo repo, I couldn't find "on this page" either in the Furo repo or in the Transifex repo for Sphinx.

@damian-krawczyk
Copy link

@pradyunsg you can count me in for Polish 🇵🇱 It would be great to have a native button to switch the language! 🤩

Here is what I partially did without Transifex

https://github.com/damian-krawczyk/damiankrawczyk.com/blob/master/docs/locale/pl/LC_MESSAGES/sphinx.po

@CAM-Gerlach
Copy link

For reference, the similar Pydata Sphinx Theme implemented translation support recently (minus a language switcher, which I plan to hopefully try to contribute in the future), see PR pydata/pydata-sphinx-theme#1192 for details on that.

@Kamik423
Copy link

🙋 I can do German

@alperyazar
Copy link

I can do Turkish translation. I checked the latest code and saw {% trans %} tags, ref but I don't know whether the theme supports translations at that moment or not. If it is, I would like to contribute.

@rffontenelle
Copy link

rffontenelle commented Oct 28, 2024

@pradyunsg I'm working on a script to handle localization of Python docs theme at python/python-docs-theme#195. It extracts source strings into template POT file, initializes locale PO files, updates existing PO based on new POT files, and compiles MO files from locales PO file to be used by the theme.

Are you looking for something like that? Or a more complicated solution ia needed?

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

No branches or pull requests