[Qgis-community-team] Translation of images

Paolo Corti pcorti at gmail.com
Wed Aug 1 05:48:52 PDT 2012


On Thu, Jul 19, 2012 at 9:39 AM, Rudi Thiede <rudi at linfiniti.com> wrote:
> Hi all,
>
> Thanks for the help so far Paolo!
>
> Just wanted to know, is there a way to have image paths added automatically
> to the generated .pot files? This is for another project -
> QGIS-Training-Manual - but using the same structure as QGIS-Documentation
> for internationalization.
>
> Right now when .pot files are generated, image paths are not seen as targets
> for translation. So a translator editing the .po files would be unable to
> specify new images.
>
> I've been looking at QGIS-Documentation but have been unable to identify so
> far how this works in that project.
>
>

You are right, so this cannot be the approach to follow.
We could use replacements in the rst_epilog section of conf.py.

For example we could do something like this using a language variable
in conf.py (but needs to be tested):

rst_epilog = """
.. |nix| image:: /img/en/nix.png
   :width: 1em
.. |win| image:: /img/en/win.png
   :width: 1em
   ...
.. |image_path| replace:: /img/%s
""" % language

and then use this in the rst files:

.. figure:: |image_path|/shortcuts.png

and compile like this:

$(SPHINXBUILD) -b html -D language=$$lang $(ALLSPHINXOPTS)
$(BUILDDIR)/$(DESTINATION)/html/$$lang;\

cheers
p

-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti


More information about the Qgis-community-team mailing list