pradyunsg / furo

A clean customizable documentation theme for Sphinx
https://pradyunsg.me/furo/quickstart
MIT License
2.7k stars 311 forks source link

Translations for the theme #434

Open pradyunsg opened 2 years ago

pradyunsg commented 2 years ago

Discussed in https://github.com/pradyunsg/furo/discussions/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.

mpaglia0 commented 2 years ago

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 commented 2 years ago

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

pradyunsg commented 2 years ago

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!

eviau-sat commented 2 years ago

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 commented 2 years ago

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

eviau-sat commented 2 years ago

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 commented 1 year ago

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 commented 1 year ago

Any progress on the current issue?

pradyunsg commented 1 year ago

help would be welcome for this!

dbitouze commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

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 commented 10 months ago

🙋 I can do German

alperyazar commented 4 months ago

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.