sphinx-doc / sphinx-intl

A Sphinx utility that make it easy to translate and to apply translations.
https://sphinx-intl.readthedocs.io/
BSD 2-Clause "Simplified" License
74 stars 38 forks source link

Question: does a page have the resource-key at build time #37

Open rduivenvoorde opened 4 years ago

rduivenvoorde commented 4 years ago

Thanks for all this work!!

We (QGIS-project) use sphinx/sphinx-intl/transifex to build/translate our documentation Eg: https://docs.qgis.org/3.10/ja/docs/

In an earlier version of the docs we created the 'resource-keys' for transifex ourselves, and in that way were able to generate a 'translate this page here' link into every page footer, linking to the exact resource in transifex.

Now we use sphinx-intl update-txconfig-resources

and .tx/config contains keys like:

qgis-documentation.docs--user_manual--introduction--qgis_gui

which can be found on transifex here:

https://www.transifex.com/qgis/qgis-documentation/translate/#ja/docs--user_manual--introduction--qgis_gui

So I was wondering if the machinery to 'create' these keys were also available (or put in some context) during the build of the html pages?

In that way it would be easy to construct direct links to transifex.

I am aware that the build of html and tx-config are two separate processes... so maybe it is harder then I hope :-)

TIA

rffontenelle commented 1 year ago

Hi @rduivenvoorde. I don't think so. Transifex resource slugs are not visible for Sphinx when building a reST doc regardless of the file format (html, epub, etc.). Transifex resources slugs are available when interacting with Transifex, e.g. pulling or pushing translations or source strings.

The qgis-documentation.docs--user_manual--introduction--qgis_gui is a Transifex resource slug which is basically a conversion of the filepath into something compatible with URLs (directory separators become double-hyphens '--', dots become underscore '_' and file extension is removed).